Skip to content

Transform step functions to single useStep() calls#336

Merged
TooTallNate merged 1 commit into
mainfrom
swc-plugin-remove-outer-step-fn-wrapper
Nov 14, 2025
Merged

Transform step functions to single useStep() calls#336
TooTallNate merged 1 commit into
mainfrom
swc-plugin-remove-outer-step-fn-wrapper

Conversation

@TooTallNate
Copy link
Copy Markdown
Member

@TooTallNate TooTallNate commented Nov 13, 2025

  • Modified SWC plugin to convert exported step functions to var/let/const declarations
  • Instead of wrapping functions (calling useStep on every invocation), functions are now assigned directly to the result of useStep() call
  • This ensures useStep() is called only once at module initialization per step function
  • Applies to both file-level and function-level 'use step' directives
  • All step function exports now use pattern: export var fn = globalThis[Symbol.for('WORKFLOW_USE_STEP')](stepId)
  • Updated all test fixtures to reflect the new transformation

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 13, 2025

🦋 Changeset detected

Latest commit: a132ba4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@workflow/swc-plugin Patch
@workflow/core Patch
@workflow/builders Patch
@workflow/cli Patch
@workflow/next Patch
@workflow/nitro Patch
@workflow/sveltekit Patch
@workflow/web-shared Patch
workflow Patch
@workflow/world-testing Patch
@workflow/nuxt Patch
@workflow/ai Patch

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

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Nov 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Nov 13, 2025 11:37pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Nov 13, 2025 11:37pm
example-workflow Ready Ready Preview Comment Nov 13, 2025 11:37pm
workbench-hono-workflow Ready Ready Preview Comment Nov 13, 2025 11:37pm
workbench-nitro-workflow Ready Ready Preview Comment Nov 13, 2025 11:37pm
workbench-nuxt-workflow Ready Ready Preview Comment Nov 13, 2025 11:37pm
workbench-sveltekit-workflow Ready Ready Preview Comment Nov 13, 2025 11:37pm
workbench-vite-workflow Ready Ready Preview Comment Nov 13, 2025 11:37pm
workflow-docs Ready Ready Preview Comment Nov 13, 2025 11:37pm

Comment thread packages/swc-plugin-workflow/transform/src/lib.rs
…signments

- Modified SWC plugin to convert exported step functions to const declarations
- Instead of wrapping functions (calling useStep on every invocation), functions are now assigned directly to the result of useStep() call
- This ensures useStep() is called only once at module initialization, improving performance
- Applies to both file-level and function-level 'use step' directives
- All step function exports now use pattern: export const fn = globalThis[Symbol.for('WORKFLOW_USE_STEP')](stepId, fnName)
- Updated all test fixtures to reflect the new transformation
@TooTallNate TooTallNate merged commit f07b2da into main Nov 14, 2025
37 checks passed
@TooTallNate TooTallNate deleted the swc-plugin-remove-outer-step-fn-wrapper branch November 14, 2025 23:42
This was referenced Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants