Skip to content

Conversation

@pranaygp
Copy link
Collaborator

Moves NextBuilder from @workflow/cli to @workflow/next package, establishing
proper package boundaries where framework-specific builders live in their
respective framework integration packages.

Changes:

  • Moved NextBuilder from @workflow/cli to @workflow/next
  • Added @workflow/builders and watchpack dependencies to @workflow/next
  • Updated runtime re-export to use @workflow/core/dist/runtime directly
  • Removed direct dependency on @workflow/cli from @workflow/next

This aligns the Next.js builder with the Nitro builder pattern (which already
lives in @workflow/nitro), creating consistent package organization.

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2025

🦋 Changeset detected

Latest commit: 4f44c89

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

This PR includes changesets to release 4 packages
Name Type
@workflow/next Patch
workflow Patch
@workflow/ai Patch
@workflow/world-testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Oct 26, 2025

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

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Nov 3, 2025 10:25pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Nov 3, 2025 10:25pm
example-workflow Ready Ready Preview Comment Nov 3, 2025 10:25pm
workbench-nitro-workflow Ready Ready Preview Comment Nov 3, 2025 10:25pm
workbench-sveltekit-workflow Error Error Nov 3, 2025 10:25pm
workbench-vite-workflow Ready Ready Preview Comment Nov 3, 2025 10:25pm
workflow-docs Ready Ready Preview Comment Nov 3, 2025 10:25pm

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The export line was referencing a non-existent ./constants.js file, causing the TypeScript compiler to fail when building the builders package.

View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
 export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
 export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
 export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+

Analysis

Missing constants file causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 when trying to import from non-existent ./constants.js file

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The code was trying to export constants STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER from a non-existent ./constants.js file, causing the TypeScript compiler to fail during the build process.

View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..32a74a6 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,3 @@ export { applySwcTransform } from './apply-swc-transform.js';
 export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
 export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
 export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';

Analysis

Missing constants file causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts at line 11 due to importing from non-existent ./constants.js file

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The export statement was trying to import STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER from a non-existent ./constants.js file.

View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
 export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
 export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
 export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+

Analysis

Missing constants.js file causes TypeScript build failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to missing ./constants.js module

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The constants.ts file was missing from the builders package, causing a TypeScript compilation error when trying to import STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER constants.

View Details
📝 Patch Details
diff --git a/packages/builders/src/constants.ts b/packages/builders/src/constants.ts
new file mode 100644
index 0000000..53e502d
--- /dev/null
+++ b/packages/builders/src/constants.ts
@@ -0,0 +1,5 @@
+/**
+ * Queue trigger topics used for Vercel's experimental queue functionality
+ */
+export const STEP_QUEUE_TRIGGER = '__wkf_step_*';
+export const WORKFLOW_QUEUE_TRIGGER = '__wkf_workflow_*';
\ No newline at end of file

Analysis

Missing constants.ts file causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts at line 11 trying to import constants from a non-existent module

How to reproduce:

npx turbo run build --filter=@workflow/builders --only

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

Root cause: The packages/builders/src/constants.ts file was missing but is referenced in the index.ts export statement. The constants STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER are used throughout the codebase for Vercel's experimental queue functionality but were not defined.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The constants.ts file was missing from the @workflow/builders package, causing a TypeScript module resolution error when trying to import STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER constants in index.ts.

View Details
📝 Patch Details
diff --git a/packages/builders/src/constants.ts b/packages/builders/src/constants.ts
new file mode 100644
index 0000000..27ea9d5
--- /dev/null
+++ b/packages/builders/src/constants.ts
@@ -0,0 +1,5 @@
+/**
+ * Queue trigger identifiers for workflow operations
+ */
+export const STEP_QUEUE_TRIGGER = 'step';
+export const WORKFLOW_QUEUE_TRIGGER = 'workflow';
\ No newline at end of file

Analysis

Missing constants.js file causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/builders/src/index.ts at line 11 due to missing module './constants.js'

How to reproduce:

cd packages/builders && pnpm run build

Result:

src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.

The constants file was referenced in the index.ts exports but never created when the @workflow/builders package was extracted from @workflow/cli in commit 736b61a.

@pranaygp pranaygp force-pushed the pranaygp/move-next-builder-to-next-package branch from 1809786 to 8696674 Compare November 3, 2025 22:12
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import type { WorkflowConfig } from '../config/types.js';
import { NextBuilder } from './next-build.js';
import { NextBuilder } from '@workflow/next/builder';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this test doesn't have a good place to live right now because of the migration. I'm just disabling it for now by changing it to .bkp and will bring it back in the top of the PR stack once everything is done migrating

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The TypeScript configuration uses outdated moduleResolution: "node" which cannot properly resolve the @workflow/core/runtime module path, causing compilation to fail with module not found errors.

View Details
📝 Patch Details
diff --git a/packages/next/tsconfig.json b/packages/next/tsconfig.json
index 1397247..615e7d9 100644
--- a/packages/next/tsconfig.json
+++ b/packages/next/tsconfig.json
@@ -3,8 +3,8 @@
   "compilerOptions": {
     "outDir": "dist",
     "target": "es2022",
-    "module": "commonjs",
-    "moduleResolution": "node"
+    "module": "nodenext",
+    "moduleResolution": "nodenext"
   },
   "include": ["src"],
   "exclude": ["node_modules", "**/*.test.ts"]

Analysis

TypeScript module resolution failure in @workflow/next package

What fails: TypeScript compiler fails to resolve @workflow/core/runtime module in packages/next/src/runtime.ts line 4

How to reproduce:

cd packages/next && pnpm run build

Result:

src/runtime.ts(4,15): error TS2307: Cannot find module '@workflow/core/runtime' or its corresponding type declarations.
  There are types at '/vercel/path0/packages/next/node_modules/@workflow/core/dist/runtime.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

Fix: Updated moduleResolution from "node" to "nodenext" and module from "commonjs" to "nodenext" in packages/next/tsconfig.json to use modern Node.js module resolution strategy.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The tsconfig.json overrides the base configuration with moduleResolution: "node" and module: "commonjs", which prevents TypeScript from resolving the @workflow/core/runtime module correctly.

View Details
📝 Patch Details
diff --git a/packages/next/tsconfig.json b/packages/next/tsconfig.json
index 1397247..3628e17 100644
--- a/packages/next/tsconfig.json
+++ b/packages/next/tsconfig.json
@@ -2,9 +2,7 @@
   "extends": "@workflow/tsconfig/base.json",
   "compilerOptions": {
     "outDir": "dist",
-    "target": "es2022",
-    "module": "commonjs",
-    "moduleResolution": "node"
+    "target": "es2022"
   },
   "include": ["src"],
   "exclude": ["node_modules", "**/*.test.ts"]

Analysis

TypeScript module resolution error prevents Next.js package build

What fails: TypeScript compiler fails on packages/next/src/runtime.ts due to module resolution incompatibility - cannot resolve @workflow/core/runtime module

How to reproduce:

cd packages/next && pnpm run build

Result:

src/runtime.ts(4,15): error TS2307: Cannot find module '@workflow/core/runtime' or its corresponding type declarations.
There are types at '/vercel/sandbox/primary/packages/next/node_modules/@workflow/core/dist/runtime.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

🔧 Build Fix:

The TypeScript compiler configuration uses moduleResolution: "node" which cannot resolve the @workflow/core/runtime module import, causing the build to fail.

View Details
📝 Patch Details
diff --git a/packages/next/tsconfig.json b/packages/next/tsconfig.json
index 1397247..5bda4f7 100644
--- a/packages/next/tsconfig.json
+++ b/packages/next/tsconfig.json
@@ -3,8 +3,8 @@
   "compilerOptions": {
     "outDir": "dist",
     "target": "es2022",
-    "module": "commonjs",
-    "moduleResolution": "node"
+    "module": "esnext",
+    "moduleResolution": "bundler"
   },
   "include": ["src"],
   "exclude": ["node_modules", "**/*.test.ts"]

Analysis

TypeScript module resolution error in @workflow/next package

What fails: TypeScript compiler fails on packages/next/src/runtime.ts due to module resolution settings preventing import of @workflow/core/runtime

How to reproduce:

cd packages/next && pnpm run build

Result:

src/runtime.ts(4,15): error TS2307: Cannot find module '@workflow/core/runtime' or its corresponding type declarations.
  There are types at '/vercel/path0/packages/next/node_modules/@workflow/core/dist/runtime.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

Moves NextBuilder from @workflow/cli to @workflow/next package, establishing
proper package boundaries where framework-specific builders live in their
respective framework integration packages.

Changes:
- Moved NextBuilder from @workflow/cli to @workflow/next
- Added @workflow/builders and watchpack dependencies to @workflow/next
- Updated runtime re-export to use @workflow/core/dist/runtime directly
- Removed direct dependency on @workflow/cli from @workflow/next

This aligns the Next.js builder with the Nitro builder pattern (which already
lives in @workflow/nitro), creating consistent package organization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants