refactor(swc-plugin): remove client transform mode, merge into step mode#1686
refactor(swc-plugin): remove client transform mode, merge into step mode#1686TooTallNate merged 3 commits intomainfrom
Conversation
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (98 failed)mongodb (15 failed):
redis (15 failed):
turso (68 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) 10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🦋 Changeset detectedLatest commit: dc6415b The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
aac9033 to
cf9fe73
Compare
a8cd2f8 to
89b944d
Compare
Remove the `client` transform mode from the SWC compiler plugin. The `client` and `step` modes were nearly identical — both preserved step function bodies, replaced workflow bodies with throw stubs, and emitted the same JSON manifest. Step mode now absorbs all client-mode behaviors: - Dead code elimination (previously only workflow + client) - Hoisted variable references for object property steps - All integrations use mode: 'step' instead of 'client' BREAKING CHANGE: The `client` value for the SWC plugin `mode` option is no longer accepted. Use `step` instead.
…sId registration In dev mode, Nitro's Rollup externalizes npm packages like @workflow/core, so the SWC transform plugin never processes files like run.js. This means serde classes (e.g. Run) never get the classId registration IIFE, causing serialization failures when step functions return Run instances. Uses a Rollup resolveId hook to force workflow SDK packages to be bundled (non-external) while leaving all other dependencies external. This is more targeted than noExternals=true which bundles everything and causes TDZ errors from circular imports in packages like vue-bundle-renderer/h3. The Nitro module now also ignores .nitro/workflow/** in watchOptions so writing generated workflow bundles does not retrigger Nitro's own dev bundle rebuild loop. Also wraps dev:reload workflow rebuilds and makes LocalBuilder.build() atomic (writes to temp files, renames on success) to avoid partial output state during HMR. For Nuxt, also configures Vite's ssr.noExternal to bundle workflow packages in the SSR context.
There was a problem hiding this comment.
Pull request overview
Removes the SWC plugin’s client transform mode by merging its behavior into step mode, and updates all repository integrations, docs, and fixtures to use the new 3-mode model (Step/Workflow/Detect).
Changes:
- Dropped
ClientfromTransformMode, updated step mode to include client-mode behaviors (notably DCE + object-property hoisting semantics), and removed client-mode fixture runners/outputs. - Updated framework/tooling integrations (Next loader, Rollup, Nest CLI, Builders, CLI) to use
mode: 'step'everywhereclientwas previously used. - Updated docs/spec and the SWC playground (WASM + UI/types) to remove the
clientoutput/view.
Reviewed changes
Copilot reviewed 103 out of 103 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| workbench/swc-playground/wasm/src/lib.rs | Removes client from batch transform output and runs only workflow+step. |
| workbench/swc-playground/lib/transform.ts | Updates TS types to drop client transform result. |
| workbench/swc-playground/components/swc-playground.tsx | Removes client view/panel/state in the playground UI. |
| packages/swc-plugin-workflow/transform/src/lib.rs | Removes Client mode and folds client behaviors into Step (DCE, hoisting/registration paths, etc.). |
| packages/swc-plugin-workflow/spec.md | Updates specification to reflect 3 modes and step-mode DCE/hoisting behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture.rs | Removes the client-mode fixture test harness. |
| packages/swc-plugin-workflow/transform/tests/errors.rs | Removes the client-mode errors fixture harness and updates imports. |
| packages/swc-plugin-workflow/transform/tests/fixture/workflow-client-property/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/workflow-arrow-function/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/var-named-step-function/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/using-declaration-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/user-named-dunder-default/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/unused-variables-and-types/output-step.js | Updates step-mode fixture to reflect new DCE behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/unused-variables-and-types/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/unused-exports/output-step.js | Updates step-mode fixture to reflect new DCE behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/unused-exports/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/sync-step/output-step.js | Updates step-mode fixture to reflect new object-property hoisting behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/sync-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/sync-step-default-export/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/sync-step-class/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/step-with-this-arguments-super/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/step-with-imports/output-step.js | Updates step-mode fixture to reflect new DCE behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/step-with-imports/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/step-arrow-function/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/static-method-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/static-method-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/static-getter-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/single-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/single-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/separate-export-statement/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/private-member-dce/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/private-member-dce-native/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/object-property-step/output-step.js | Updates step-mode fixture to reflect object-property hoist references. |
| packages/swc-plugin-workflow/transform/tests/fixture/object-property-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/object-getter-step/output-step.js | Updates step-mode fixture to reflect object getter/property behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/object-getter-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/nested-steps-in-object-constructor/output-step.js | Updates step-mode fixture to reflect new DCE behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/nested-steps-in-object-constructor/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/nested-step-with-closure/output-step.js | Updates step-mode fixture to reflect new DCE behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/nested-step-with-closure/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/nested-step-in-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/multiple-const-step-functions/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/module-level-workflow/output-step.js | Updates step-mode fixture to reflect new DCE behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/module-level-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/module-level-step/output-step.js | Updates step-mode fixture to reflect new DCE behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/module-level-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/mixed-functions/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/let-arrow-step-function/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/instance-method-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/instance-method-nested-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/instance-getter-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/factory-with-step-method/output-step.js | Updates step-mode fixture to reflect object-property hoist references. |
| packages/swc-plugin-workflow/transform/tests/fixture/factory-with-step-method/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/expr-fn-default-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-named/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/export-default-class-anonymous-step-only/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/destructuring/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/default-workflow-collision/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/default-parameter-usage/output-workflow.js | Updates fixture to reflect export changes under new behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/default-parameter-usage/output-step.js | Updates fixture to reflect export changes under new behavior. |
| packages/swc-plugin-workflow/transform/tests/fixture/default-parameter-usage/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/default-parameter-usage/input.js | Updates input fixture to be exported (aligning outputs). |
| packages/swc-plugin-workflow/transform/tests/fixture/default-arrow-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/deeply-nested-step/output-step.js | Updates step-mode fixture to reflect hoisted reference usage. |
| packages/swc-plugin-workflow/transform/tests/fixture/deeply-nested-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-require-namespace/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-require-destructured/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-local-const/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/custom-serialization-imported/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/closure-typescript-expressions/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/closure-new-expr-and-module-declarations/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/class-expression-binding-name/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/class-expression-binding-name-step-methods/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/anonymous-default-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step/output-step.js | Updates step-mode fixture to reflect object-property hoist references. |
| packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step-shorthand-method/output-step.js | Updates step-mode fixture to reflect object-property hoist references. |
| packages/swc-plugin-workflow/transform/tests/fixture/agent-with-tool-step-shorthand-method/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/sync-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/non-async-functions/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/misspelled-workflow-directive/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/misspelled-step-directive/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/misplaced-module-directive/output-step.js | Updates step-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/misplaced-module-directive/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/misplaced-function-directive/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/invalid-exports/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/invalid-default-exports-step/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/instance-methods/output-client.js | Deletes client-mode expected output fixture. |
| packages/swc-plugin-workflow/transform/tests/errors/getter-workflow/output-client.js | Deletes client-mode expected output fixture. |
| packages/next/src/loader.ts | Switches all transforms to mode: 'step'. |
| packages/rollup/src/index.ts | Switches Rollup integration transform mode to step. |
| packages/nest/src/cli.ts | Updates generated .swcrc to use mode: 'step' and help text accordingly. |
| packages/cli/src/commands/transform.ts | Removes client from CLI transform modes/options. |
| packages/builders/src/apply-swc-transform.ts | Updates API type to drop client mode. |
| packages/builders/src/swc-esbuild-plugin.ts | Updates SwcPluginOptions.mode type to drop client. |
| packages/builders/src/base-builder.ts | Updates builder SWC plugin usage from client to step. |
| packages/nuxt/src/module.ts | Forces Vite SSR bundling behavior for workflow packages and marks _vite for Nitro. |
| packages/nitro/src/index.ts | Adds dev-only rollup force-inline plugin and dev-time dynamic loading of generated workflow bundles. |
| packages/nitro/src/builders.ts | Writes workflow bundles to temp files first and renames into place. |
| .changeset/remove-client-mode.md | Adds changeset documenting the breaking removal of client mode and migration guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- nitro builders: use crypto.randomUUID() for temp file suffix instead of Date.now() to avoid collisions under rapid/concurrent build() calls, and serialize concurrent build() calls through an internal queue so two overlapping dev rebuilds cannot clobber each other's temp outputs. - nitro index: use fileURLToPath() to convert file:// URLs to filesystem paths, which correctly handles Windows paths (file:///C:/... -> C:\...) and percent-decoding, instead of relying on new URL(...).pathname. - nuxt module: normalize vite.ssr.noExternal to an array (preserving any existing string/RegExp/array entry) before appending workflow package matchers, so the force-bundle behavior is not a no-op when noExternal is already set to a non-array value.
VaguelySerious
left a comment
There was a problem hiding this comment.
LGTM assuming tests pass, we're only landing this on v5 right?
|
@VaguelySerious correct |
Summary
clienttransform mode from the SWC compiler plugin, merging it intostepmodemode: 'client'now usemode: 'step'Motivation
The
clientandstepmodes were nearly identical — both preserved step function bodies, replaced workflow bodies with throw stubs, and emitted the same JSON manifest. The only differences were:.stepIdproperty assignment; step used an IIFE with global Map registrationNone of these differences were fundamentally necessary. Merging them simplifies the codebase by ~450 lines of Rust and removes 67 test fixture files.
What changed in step mode
.stepIdis accessible on the same function objectChanged packages
@workflow/swc-pluginClientvariant fromTransformModeenum, ~450 lines of client-specific match arms@workflow/nextloader.tsnow always usesmode: 'step'@workflow/buildersbase-builder.ts,apply-swc-transform.ts,swc-esbuild-plugin.ts— removed'client'from types and mode values@workflow/cli'client'from transform command options@workflow/rollupmode: 'client'tomode: 'step'@workflow/nestmode: 'client'tomode: 'step'@workflow/swc-playground-wasm