@workflow/next 5.0.0-beta.20 → 5.0.0-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,30 @@ Remove that package from `serverExternalPackages` in your
36
36
  `next.config` to silence the warning.
37
37
  </Callout>
38
38
 
39
+ ### Workflow Discovery in Next.js
40
+
41
+ `withWorkflow()` discovers workflows by scanning your Next.js entrypoints — App
42
+ Router `route`, `page`, and `layout` files (under `app/` or `src/app/`) and any
43
+ file under `pages/` or `src/pages/` — for `start()` calls imported from
44
+ `workflow/api`. The workflow and step files themselves can live anywhere (for
45
+ example `src/workflows/`); they are discovered transitively through imports, as
46
+ long as a `start()` call in an entrypoint statically reaches them.
47
+
48
+ <Callout type="info">
49
+ Call `start()` from server-side entrypoints, including Route Handlers and Server
50
+ Actions. Don't call workflow functions directly — that bypasses the workflow
51
+ runtime.
52
+ </Callout>
53
+
54
+ ### Next.js Server Actions and `"use server"`
55
+
56
+ Don't put a top-level `"use server"` directive in modules imported by workflow
57
+ or step functions. Workflow transformation wraps imported modules in synchronous
58
+ initializers, and Next.js rejects a `"use server"` directive inside that wrapper
59
+ with errors like `Server Actions must be async functions`. Keep `"use server"`
60
+ on the files that define your Server Actions, and move shared logic into
61
+ separate modules that don't carry the directive.
62
+
39
63
  ### Monorepos and Workspace Imports
40
64
 
41
65
  By default, Next.js detects the correct workspace root automatically. If your Next.js app lives in a subdirectory such as `apps/web` and workspace resolution is not working correctly, you can set `outputFileTracingRoot` as a workaround:
@@ -68,7 +92,6 @@ const nextConfig: NextConfig = {};
68
92
 
69
93
  export default withWorkflow(nextConfig, {
70
94
  workflows: {
71
- lazyDiscovery: false,
72
95
  local: {
73
96
  port: 4000,
74
97
  },
@@ -79,7 +102,6 @@ export default withWorkflow(nextConfig, {
79
102
 
80
103
  | Option | Type | Default | Description |
81
104
  | --- | --- | --- | --- |
82
- | `workflows.lazyDiscovery` | `boolean` | `true` | Defers workflow discovery until files are requested instead of scanning eagerly at startup. Set to `false` to force eager discovery (scanning the project up front). Requires a Next.js version that supports deferred entries; older versions fall back to eager discovery automatically. |
83
105
  | `workflows.local.port` | `number` | — | Overrides the `PORT` environment variable for local development. Has no effect when deployed to Vercel. |
84
106
  | `workflows.sourcemap` | `boolean \| 'inline' \| 'linked' \| 'external' \| 'both'` | `'inline'` (dev) / `false` (prod) | Controls source maps on generated workflow bundles. See [Source maps](#source-maps) below. |
85
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow/next",
3
- "version": "5.0.0-beta.20",
3
+ "version": "5.0.0-beta.22",
4
4
  "description": "Next.js integration for Workflow SDK",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,8 @@
29
29
  "@swc/core": "1.15.3",
30
30
  "semver": "7.7.4",
31
31
  "watchpack": "2.5.1",
32
- "@workflow/builders": "5.0.0-beta.20",
33
- "@workflow/core": "5.0.0-beta.20",
32
+ "@workflow/builders": "5.0.0-beta.22",
33
+ "@workflow/core": "5.0.0-beta.22",
34
34
  "@workflow/swc-plugin": "5.0.0-beta.5"
35
35
  },
36
36
  "devDependencies": {
@@ -38,6 +38,7 @@
38
38
  "@types/semver": "7.7.1",
39
39
  "@types/watchpack": "2.4.4",
40
40
  "next": "16.2.1",
41
+ "vitest": "^4.0.18",
41
42
  "@workflow/tsconfig": "5.0.0-beta.0"
42
43
  },
43
44
  "peerDependencies": {
@@ -51,6 +52,7 @@
51
52
  "scripts": {
52
53
  "build": "tsc",
53
54
  "dev": "tsc --watch",
55
+ "test": "vitest run src",
54
56
  "clean": "tsc --build --clean && rm -rf dist docs"
55
57
  }
56
58
  }
@@ -1,2 +0,0 @@
1
- export declare function getNextBuilderDeferred(): Promise<any>;
2
- //# sourceMappingURL=builder-deferred.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"builder-deferred.d.ts","sourceRoot":"","sources":["../src/builder-deferred.ts"],"names":[],"mappings":"AAyCA,wBAAsB,sBAAsB,iBAiiE3C"}