-
Notifications
You must be signed in to change notification settings - Fork 158
Support class static methods with "use step" / "use workflow" #753
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
Support class static methods with "use step" / "use workflow" #753
Conversation
🦋 Changeset detectedLatest commit: ff9e014 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 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 |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (19 failed)mongodb (1 failed):
redis (1 failed):
starter (16 failed):
turso (1 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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.
Pull request overview
This PR adds support for class static methods with "use step" and "use workflow" directives in the SWC compiler plugin. Previously, the plugin would walk through these methods but didn't apply any transformations.
Key changes:
- Extended the SWC plugin to properly transform static class methods with step/workflow directives
- Added tracking for class context to generate qualified names (ClassName.methodName) for static methods
- Implemented proper registration and property assignment logic for static step and workflow methods
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/swc-plugin-workflow/transform/src/lib.rs | Core transformation logic: added class name tracking, static method handling in visit_mut_class_method, and registration/assignment of static methods after class declarations |
| packages/swc-plugin-workflow/transform/tests/fixture/static-method-workflow/* | Test fixtures for static workflow methods showing expected transformations across step/workflow/client modes |
| packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/* | Test fixtures for static step methods showing expected transformations across step/workflow/client modes |
| packages/swc-plugin-workflow/transform/tests/errors/instance-methods/* | Updated error test outputs to reflect static method transformations while maintaining instance method errors |
| workbench/example/workflows/99_e2e.ts | Added example classes (MathService, Calculator, AllInOneService) demonstrating static method usage patterns |
| packages/core/e2e/e2e.test.ts | Added e2e tests validating static workflow methods calling static step methods |
| .changeset/shiny-brooms-invite.md | Changeset documenting the feature addition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The SWC compiler plugin had logic to walk through class static methods with "use step" / "use workflow", but no actual transformation was being applied. This fixes that.
4e49fd8 to
ff9e014
Compare
| async anotherInstance() { | ||
| 'use workflow'; | ||
| return 'also not allowed'; | ||
| } |
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.
should we also add test case for arrow syntax or regular function defined as a static property (not static fn)?
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.
will do in a follow-up PR
pranaygp
left a comment
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.
left 1 edge case comment but lgtm

The SWC compiler plugin had logic to walk through class static methods with "use step" / "use workflow", but no actual transformation was being applied. This fixes that.