fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

fix(swc-plugin): rewrite anonymous export default class to const declaration - #1601

Merged
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding
Apr 3, 2026
Merged

fix(swc-plugin): rewrite anonymous export default class to const declaration#1601
TooTallNate merged 9 commits into
mainfrom
fix/export-default-class-anonymous-binding

Conversation

@TooTallNate

Copy link
Copy Markdown
Member

Summary

  • Fixes potential ReferenceError when export default class { ... } (anonymous) has serde or step methods
  • The generated registration code needs a binding name accessible at module scope, but anonymous default class exports have none
  • Rewrites export default class { ... }const __defaultClass = class __defaultClass { ... }; export default __defaultClass;
  • Also sets current_class_binding_name for named default class exports (export default class Foo { ... }) so registration uses the class name

Stacked on#1599

Details

When an anonymous class is exported as the default export:

exportdefaultclass{static[WORKFLOW_SERIALIZE](inst){ ... }static[WORKFLOW_DESERIALIZE](data){ ... }asyncprocess(input){"use step"; ... }}

The SWC plugin generates registration code at module scope that needs to reference the class by name (e.g., registerStepFunction("...", ClassName.prototype["process"])). Without a binding name, the fallback was "AnonymousClass" which doesn't exist as a variable — causing a ReferenceError at runtime.

Fix

Two changes in the SWC plugin:

  1. visit_mut_export_default_decl (DefaultDecl::Class): Detects anonymous classes with serde/step methods, generates a unique name (__defaultClass), sets current_class_binding_name, and defers the rewrite to visit_mut_module_items.

  2. visit_mut_export_default_expr (Expr::Class): Same logic for the expression form (e.g., export default (class { ... })).

  3. visit_mut_module_items: Processes the deferred rewrites — removes the original export default, inserts const __defaultClass = class __defaultClass { ... };, and re-exports with export default __defaultClass;.

Named default class exports (export default class Foo { ... }) don't need rewriting — Foo is already in scope. The fix just sets current_class_binding_name so the transformer uses Foo consistently.

Tests

6 new tests (2 fixtures × 3 modes):

  • export-default-class-anonymous: Anonymous default class with serde + step method → verifies rewrite to const __defaultClass = class __defaultClass { ... }; export default __defaultClass; with correct registration code
  • export-default-class-named: Named default class (export default class MyService { ... }) → verifies no rewrite needed, MyService used for all registrations

144 total SWC tests pass (138 existing + 6 new).

…p/serde entries
When node_modules packages include "sideEffects": false in their
package.json, esbuild drops bare imports from the virtual-entry.js
file. This is incorrect because the SWC compiler transform injects
side-effectful registration code (workflow IDs, step IDs, class
serialization) into these modules.
Fix: return the resolved path alongside sideEffects: true from the
onResolve handler so esbuild uses the plugin's resolution result
instead of re-reading the package.json.
…mlink compatibility
Extract withRealpaths() helper and use it for both normalizedEntriesToBundle
and sideEffectEntries at all three bundle sites. This ensures the
sideEffects override works correctly under pnpm/workspace symlinked
layouts where enhanced-resolve may return realpaths that differ from
the original discovered file paths.
@TooTallNate
TooTallNate requested a review from a team as a code ownerApril 3, 2026 06:26
CopilotAI review requested due to automatic review settings April 3, 2026 06:26
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0af6af

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

This PR includes changesets to release 17 packages
NameType
@workflow/swc-pluginPatch
@workflow/buildersPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nestPatch
@workflow/nextPatch
@workflow/nitroPatch
@workflow/rollupPatch
@workflow/sveltekitPatch
@workflow/vitePatch
@workflow/vitestPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch
@workflow/corePatch
@workflow/web-sharedPatch

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

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production857067924
✅ 💻 Local Development83001781008
✅ 📦 Local Production83001781008
✅ 🐘 Local Postgres83001781008
✅ 🪟 Windows760884
❌ 🌍 Community Worlds1335924216
✅ 📋 Other210042252
Total3766596754500

❌ Failed Tests

🌍 Community Worlds (59 failed)

mongodb (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

redis (2 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4

turso (55 failed):

  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • addTenWorkflow | wrun_01KNAAJHK7DNC4AAKEDQ9143KK
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNAANAJJ387DC9ZH0K90BCJP
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNAAJR5Y4K3XD7V2R9NPZ5HY
  • promiseRaceWorkflow | wrun_01KNAAJWWSWBTBQ2KNSHXTTB9J
  • promiseAnyWorkflow | wrun_01KNAAJZ40GY1YS059F04W9BGW
  • importedStepOnlyWorkflow | wrun_01KNAANQFZB04Q0MJ0CSZ0PHFC
  • hookWorkflow | wrun_01KNAAKB4EP8QP9RVG50T3RC8B
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNAAKPPJ8K5YCEEYPTZY0SSE
  • webhookWorkflow | wrun_01KNAAKZE1DFNVBH9YWAVKABV7
  • sleepingWorkflow | wrun_01KNAAM99P8T4M3FJWJN89Z0R5
  • parallelSleepWorkflow | wrun_01KNAAMP6DCKKWG7HBXR81BH0G
  • nullByteWorkflow | wrun_01KNAAMTZXY610E6GV4Y3ZS6Q7
  • workflowAndStepMetadataWorkflow | wrun_01KNAAMXAFJ83Z6HBJ7RVGDHVD
  • fetchWorkflow | wrun_01KNAAR1BPNKMXM4AF7069C4C9
  • promiseRaceStressTestWorkflow | wrun_01KNAAR4RM5GNKXQQRQGRPXNFF
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNAAVP5KZTB5FMHFV92Y4MT9
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNAAWB5WH7C4VBMHPRFMNFZ4
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNAAX0QJY55D4FKMVYBZKGE9
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNAAXMFTNC3W8JR7Q9CZQDTP
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNAAXX2B365BMQJDSX9MA57H
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNAAY2GN8DMKJQKR10C3YECD
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNAAY4PS2SYWYG98ZTNVW354
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNAAYM0PQDWND2RJMM84FQK6
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNAAYSEZSBN4VT0945EG8B2G
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNAAZ017N5XBT9PRBYVMV4KC
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNAAZ6XMWMFHR5KZAARF1FN1
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNAAZE4QGRRXBQMNMN0A163G
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNAAZMN27XKKB8Q7ERR02E0C
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNAAZV5KX3FK5SYN023VJWQD
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNAB0522ZRFYK8VC20BSJT8M
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNAB0EJ0TFFCTNRMF8QM456A
  • cancelRun - cancelling a running workflow | wrun_01KNAB0NB6KHTECAS7XN6W2285
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNAB0YGQFM8X2QMF4N3NCN0J
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNAB1B6P1FEEQWT0SMMJTPFG
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNAB201KPJTC0Z7MK1XEPKHT
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNAB2AE84HE9AGP4JG22PMZ0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNAB2GZK9QT2HD96HG52P5HV

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7707
✅ example7707
✅ express7707
✅ fastify7707
✅ hono7707
✅ nextjs-turbopack8202
✅ nextjs-webpack8202
✅ nitro7707
✅ nuxt7707
✅ sveltekit7707
✅ vite7707
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable70014
✅ express-stable70014
✅ fastify-stable70014
✅ hono-stable70014
✅ nextjs-turbopack-canary59025
✅ nextjs-turbopack-stable7608
✅ nextjs-webpack-canary59025
✅ nextjs-webpack-stable7608
✅ nitro-stable70014
✅ nuxt-stable70014
✅ sveltekit-stable70014
✅ vite-stable70014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7608
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5728
✅ redis-dev500
❌ redis5728
✅ turso-dev500
❌ turso4558
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable70014
✅ e2e-local-postgres-nest-stable70014
✅ e2e-local-prod-nest-stable70014

📋 View full workflow run

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SWC workflow transform to ensure default-exported classes have a module-scope binding name when the plugin needs to emit registration code (serde and/or step/workflow method registrations), avoiding runtime ReferenceError for anonymous export default class { ... } patterns.

Changes:

  • Add transformer logic to defer and rewrite anonymous default class exports into const <name> = class <name> { ... }; export default <name>;.
  • Ensure named default class exports set the binding name so generated registration code consistently references the in-scope identifier.
  • Add/extend fixtures and spec documentation describing the new rewriting behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
packages/swc-plugin-workflow/transform/src/lib.rsImplements deferred rewrite for anonymous default class exports and binding-name tracking for default-exported classes.
packages/swc-plugin-workflow/spec.mdDocuments anonymous default class export rewriting behavior and expected output.
.changeset/tall-owls-glow.mdPublishes a patch changeset describing the fix.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/input.jsAdds fixture input for named export default class MyService { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-step.jsExpected step-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-workflow.jsExpected workflow-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.jsExpected client-mode output for named default class export.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/input.jsAdds fixture input for anonymous export default class { ... } with serde + step.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-step.jsExpected step-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-workflow.jsExpected workflow-mode output showing const-decl rewrite and correct registrations.
packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.jsExpected client-mode output showing const-decl rewrite and correct registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs
Comment threadpackages/swc-plugin-workflow/spec.md Outdated
Comment threadpackages/swc-plugin-workflow/transform/src/lib.rs Outdated
…s handling
- Remove dead Expr::Class handler in visit_mut_export_default_expr
(SWC wraps parenthesized form in Expr::Paren, so it never fires)
- Extract class_needs_binding_rewrite() helper, eliminating duplicated
detection logic and unnecessary body clones
- Add debug_assert for mutual exclusivity of default_workflow_exports
and default_class_exports
- Clarify spec.md on self-name behavior difference between serde and
step-only classes
@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.038s (-26.6% 🟢)1.005s (~)0.967s101.00x
💻 LocalNext.js (Turbopack)0.047s1.005s0.958s101.24x
🐘 PostgresExpress0.048s (-28.1% 🟢)1.010s (~)0.962s101.26x
🌐 MongoDBNext.js (Turbopack)0.058s1.007s0.949s101.52x
🐘 PostgresNext.js (Turbopack)0.058s1.011s0.954s101.53x
🌐 RedisNext.js (Turbopack)0.059s1.005s0.947s101.54x
🐘 PostgresNitro0.065s (+13.0% 🔺)1.013s (~)0.948s101.72x
💻 LocalExpress⚠️missing----
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro1.106s (-3.2%)2.006s (~)0.900s101.00x
💻 LocalNext.js (Turbopack)1.118s2.006s0.888s101.01x
🐘 PostgresExpress1.120s (-2.0%)2.011s (~)0.892s101.01x
🌐 RedisNext.js (Turbopack)1.129s2.007s0.878s101.02x
🐘 PostgresNext.js (Turbopack)1.146s2.009s0.863s101.04x
🐘 PostgresNitro1.150s (~)2.012s (~)0.862s101.04x
🌐 MongoDBNext.js (Turbopack)1.309s2.009s0.700s101.18x
💻 LocalExpress⚠️missing----
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro10.651s (-3.3%)11.025s (-2.9%)0.374s31.00x
🐘 PostgresExpress10.735s (-1.2%)11.025s (~)0.289s31.01x
💻 LocalNext.js (Turbopack)10.769s11.024s0.254s31.01x
🐘 PostgresNext.js (Turbopack)10.805s11.021s0.216s31.01x
🌐 RedisNext.js (Turbopack)10.843s11.024s0.181s31.02x
🐘 PostgresNitro10.867s (~)11.022s (~)0.155s31.02x
🌐 MongoDBNext.js (Turbopack)12.229s13.021s0.792s31.15x
💻 LocalExpress⚠️missing----
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express14.007s (-4.2%)14.421s (-4.0%)0.415s51.00x
💻 LocalNitro14.239s (-6.4% 🟢)15.030s (-6.2% 🟢)0.791s41.02x
🌐 RedisNext.js (Turbopack)14.308s15.031s0.723s41.02x
🐘 PostgresNext.js (Turbopack)14.365s15.028s0.663s41.03x
💻 LocalNext.js (Turbopack)14.512s15.028s0.516s41.04x
🐘 PostgresNitro14.581s (~)15.029s (~)0.449s41.04x
🌐 MongoDBNext.js (Turbopack)17.791s18.022s0.231s41.27x
💻 LocalExpress⚠️missing----
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express12.950s (-7.7% 🟢)13.024s (-9.9% 🟢)0.073s71.00x
🌐 RedisNext.js (Turbopack)13.499s14.027s0.528s71.04x
🐘 PostgresNext.js (Turbopack)13.952s14.165s0.213s71.08x
🐘 PostgresNitro14.030s (~)14.598s (~)0.567s71.08x
💻 LocalNitro14.931s (-13.0% 🟢)15.028s (-16.7% 🟢)0.097s61.15x
💻 LocalNext.js (Turbopack)15.844s16.028s0.184s61.22x
🌐 MongoDBNext.js (Turbopack)20.425s21.024s0.599s51.58x
💻 LocalExpress⚠️missing----
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.209s (-4.7%)2.010s (~)0.802s151.00x
🐘 PostgresNext.js (Turbopack)1.218s2.011s0.793s151.01x
🐘 PostgresNitro1.267s (+0.5%)2.011s (~)0.743s151.05x
🌐 RedisNext.js (Turbopack)1.318s2.007s0.688s151.09x
💻 LocalNitro1.467s (-6.3% 🟢)2.006s (~)0.539s151.21x
💻 LocalNext.js (Turbopack)1.485s2.005s0.521s151.23x
🌐 MongoDBNext.js (Turbopack)2.138s3.008s0.871s101.77x
💻 LocalExpress⚠️missing----
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.308s (-1.5%)3.010s (~)0.702s101.00x
🐘 PostgresNitro2.335s (~)3.011s (~)0.677s101.01x
🐘 PostgresNext.js (Turbopack)2.385s3.010s0.625s101.03x
🌐 RedisNext.js (Turbopack)2.633s3.108s0.476s101.14x
💻 LocalNitro2.736s (-12.3% 🟢)3.108s (-20.0% 🟢)0.372s101.19x
💻 LocalNext.js (Turbopack)2.770s3.107s0.337s101.20x
🌐 MongoDBNext.js (Turbopack)8.470s9.014s0.544s43.67x
💻 LocalExpress⚠️missing----
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.408s (-1.8%)4.013s (~)0.605s81.00x
🐘 PostgresNitro3.452s (-0.6%)4.012s (~)0.560s81.01x
🐘 PostgresNext.js (Turbopack)3.628s4.012s0.384s81.06x
🌐 RedisNext.js (Turbopack)4.197s5.011s0.814s61.23x
💻 LocalNitro6.989s (-16.6% 🟢)7.416s (-17.9% 🟢)0.427s52.05x
💻 LocalNext.js (Turbopack)7.048s7.621s0.574s52.07x
🌐 MongoDBNext.js (Turbopack)19.805s20.026s0.221s25.81x
💻 LocalExpress⚠️missing----
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.192s (-5.7% 🟢)2.010s (~)0.818s151.00x
🐘 PostgresNext.js (Turbopack)1.223s2.010s0.786s151.03x
🐘 PostgresNitro1.253s (~)2.009s (~)0.757s151.05x
🌐 RedisNext.js (Turbopack)1.356s2.007s0.651s151.14x
💻 LocalNext.js (Turbopack)1.473s2.006s0.533s151.24x
💻 LocalNitro1.486s (-5.1% 🟢)2.007s (~)0.521s151.25x
🌐 MongoDBNext.js (Turbopack)3.395s3.758s0.362s82.85x
💻 LocalExpress⚠️missing----
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.292s (-2.1%)3.011s (~)0.719s101.00x
🐘 PostgresNitro2.315s (~)3.012s (~)0.697s101.01x
🐘 PostgresNext.js (Turbopack)2.369s3.009s0.641s101.03x
🌐 RedisNext.js (Turbopack)2.581s3.009s0.428s101.13x
💻 LocalNext.js (Turbopack)2.872s3.208s0.336s101.25x
💻 LocalNitro2.888s (-10.1% 🟢)3.108s (-20.0% 🟢)0.220s101.26x
🌐 MongoDBNext.js (Turbopack)9.383s10.012s0.629s34.09x
💻 LocalExpress⚠️missing----
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.385s (-2.4%)4.012s (~)0.627s81.00x
🐘 PostgresNitro3.471s (~)4.013s (~)0.542s81.03x
🐘 PostgresNext.js (Turbopack)3.628s4.015s0.387s81.07x
🌐 RedisNext.js (Turbopack)4.189s4.725s0.535s71.24x
💻 LocalNitro7.565s (-15.4% 🟢)8.017s (-13.6% 🟢)0.452s42.23x
💻 LocalNext.js (Turbopack)7.734s8.271s0.536s42.28x
🌐 MongoDBNext.js (Turbopack)20.138s20.527s0.389s25.95x
💻 LocalExpress⚠️missing----
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.609s (-28.5% 🟢)1.007s (~)0.399s601.00x
💻 LocalNitro0.692s (-32.5% 🟢)1.005s (-47.5% 🟢)0.312s601.14x
🌐 RedisNext.js (Turbopack)0.733s1.022s0.289s591.20x
🐘 PostgresNext.js (Turbopack)0.766s1.007s0.241s601.26x
🐘 PostgresNitro0.831s (+0.6%)1.007s (~)0.176s601.37x
💻 LocalNext.js (Turbopack)0.833s1.039s0.205s581.37x
🌐 MongoDBNext.js (Turbopack)2.140s3.008s0.867s203.52x
💻 LocalExpress⚠️missing----
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.523s (-24.8% 🟢)2.031s (-24.4% 🟢)0.508s451.00x
🌐 RedisNext.js (Turbopack)1.733s2.028s0.296s451.14x
🐘 PostgresNext.js (Turbopack)1.839s2.007s0.168s451.21x
🐘 PostgresNitro1.956s (~)2.228s (+3.5%)0.272s411.28x
💻 LocalNitro2.246s (-27.3% 🟢)3.008s (-25.0% 🟢)0.762s301.48x
💻 LocalNext.js (Turbopack)2.586s3.007s0.422s301.70x
🌐 MongoDBNext.js (Turbopack)5.292s6.012s0.720s153.48x
💻 LocalExpress⚠️missing----
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express3.071s (-24.3% 🟢)3.882s (-18.8% 🟢)0.811s311.00x
🌐 RedisNext.js (Turbopack)3.447s4.009s0.562s301.12x
🐘 PostgresNext.js (Turbopack)3.777s4.045s0.268s301.23x
🐘 PostgresNitro4.035s (~)4.495s (-0.8%)0.461s271.31x
💻 LocalNitro7.328s (-22.2% 🟢)8.016s (-20.0% 🟢)0.688s152.39x
💻 LocalNext.js (Turbopack)8.460s9.017s0.557s142.75x
🌐 MongoDBNext.js (Turbopack)10.968s11.659s0.691s113.57x
💻 LocalExpress⚠️missing----
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.229s (-17.6% 🟢)1.008s (~)0.779s601.00x
🐘 PostgresNext.js (Turbopack)0.249s1.008s0.759s601.09x
🐘 PostgresNitro0.280s (+2.6%)1.008s (~)0.728s601.22x
🌐 RedisNext.js (Turbopack)0.313s1.004s0.691s601.37x
💻 LocalNext.js (Turbopack)0.548s1.004s0.457s602.39x
💻 LocalNitro0.580s (-15.1% 🟢)1.004s (-3.4%)0.425s602.53x
🌐 MongoDBNext.js (Turbopack)3.163s3.948s0.785s1613.80x
💻 LocalExpress⚠️missing----
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.392s (-21.2% 🟢)1.019s (+1.1%)0.627s891.00x
🐘 PostgresNext.js (Turbopack)0.471s1.007s0.536s901.20x
🐘 PostgresNitro0.496s (+1.5%)1.008s (~)0.511s901.27x
🌐 RedisNext.js (Turbopack)1.180s2.006s0.826s453.01x
💻 LocalNext.js (Turbopack)2.467s2.977s0.510s316.29x
💻 LocalNitro2.493s (-1.5%)3.008s (~)0.516s306.36x
🌐 MongoDBNext.js (Turbopack)9.454s10.016s0.562s924.10x
💻 LocalExpress⚠️missing----
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.584s (-26.3% 🟢)1.008s (~)0.424s1201.00x
🐘 PostgresNext.js (Turbopack)0.754s1.016s0.262s1191.29x
🐘 PostgresNitro0.811s (+4.8%)1.019s (+1.0%)0.208s1181.39x
🌐 RedisNext.js (Turbopack)2.805s3.085s0.280s394.80x
💻 LocalNext.js (Turbopack)10.212s10.942s0.730s1217.48x
💻 LocalNitro10.642s (-6.2% 🟢)11.027s (-7.6% 🟢)0.384s1118.22x
🌐 MongoDBNext.js (Turbopack)19.870s20.531s0.661s634.02x
💻 LocalExpress⚠️missing----
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.149s (-31.6% 🟢)1.003s (~)0.010s (-13.5% 🟢)1.016s (~)0.867s101.00x
🐘 PostgresExpress0.152s (-25.6% 🟢)0.999s (~)0.001s (-28.6% 🟢)1.010s (~)0.858s101.02x
💻 LocalNext.js (Turbopack)0.172s1.002s0.012s1.018s0.846s101.15x
🌐 RedisNext.js (Turbopack)0.182s1.001s0.002s1.008s0.826s101.22x
🐘 PostgresNext.js (Turbopack)0.193s1.002s0.001s1.012s0.820s101.29x
🐘 PostgresNitro0.209s (~)0.997s (~)0.001s (-13.3% 🟢)1.013s (~)0.803s101.41x
🌐 MongoDBNext.js (Turbopack)0.493s0.958s0.001s1.009s0.516s103.31x
💻 LocalExpress⚠️missing-----
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.508s1.001s0.003s1.012s0.504s601.00x
🐘 PostgresExpress0.526s (-14.6% 🟢)1.005s (~)0.004s (-9.1% 🟢)1.023s (~)0.497s591.04x
💻 LocalNitro0.583s (-23.3% 🟢)1.009s (~)0.008s (-15.2% 🟢)1.022s (~)0.439s591.15x
🐘 PostgresNext.js (Turbopack)0.597s1.009s0.004s1.024s0.427s591.18x
🐘 PostgresNitro0.633s (+4.8%)1.003s (~)0.005s (+37.4% 🔺)1.026s (~)0.393s591.25x
💻 LocalNext.js (Turbopack)0.638s1.009s0.010s1.023s0.385s591.26x
🌐 MongoDBNext.js (Turbopack)1.326s1.954s0.003s2.016s0.690s302.61x
💻 LocalExpress⚠️missing-----
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.912s (-6.7% 🟢)1.069s (-10.8% 🟢)0.000s (+Infinity% 🔺)1.089s (-12.0% 🟢)0.177s561.00x
🐘 PostgresNext.js (Turbopack)0.913s1.092s0.000s1.102s0.190s551.00x
🌐 RedisNext.js (Turbopack)0.919s1.034s0.000s1.039s0.120s581.01x
🐘 PostgresNitro1.022s (+4.8%)1.356s (+16.5% 🔺)0.000s (-100.0% 🟢)1.374s (+15.7% 🔺)0.352s441.12x
💻 LocalNitro1.175s (-9.3% 🟢)2.018s (~)0.000s (-72.7% 🟢)2.021s (~)0.846s301.29x
💻 LocalNext.js (Turbopack)1.217s2.018s0.000s2.020s0.804s301.33x
🌐 MongoDBNext.js (Turbopack)2.356s2.954s0.000s3.008s0.652s202.58x
💻 LocalExpress⚠️missing-----
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express1.703s (-2.7%)2.060s (~)0.000s (+Infinity% 🔺)2.090s (-0.6%)0.386s291.00x
🌐 RedisNext.js (Turbopack)1.732s2.034s0.000s2.040s0.308s301.02x
🐘 PostgresNext.js (Turbopack)1.835s2.145s0.000s2.197s0.362s281.08x
🐘 PostgresNitro1.852s (+8.0% 🔺)2.219s (+5.7% 🔺)0.000s (+7.4% 🔺)2.234s (+5.7% 🔺)0.382s271.09x
💻 LocalNext.js (Turbopack)3.461s4.030s0.000s4.034s0.573s152.03x
💻 LocalNitro3.497s (-6.4% 🟢)4.098s (-3.3%)0.000s (-63.6% 🟢)4.103s (-3.2%)0.606s152.05x
🌐 MongoDBNext.js (Turbopack)4.421s4.963s0.000s5.012s0.591s122.60x
💻 LocalExpress⚠️missing-----

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNitro15/21
🐘 PostgresExpress21/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres21/21
Next.js (Turbopack)🐘 Postgres10/21
Nitro🐘 Postgres14/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

Sign up for freeto 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

@TooTallNate@VaguelySerious