@workflow/nitro 5.0.0-beta.1 → 5.0.0-beta.3

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.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # workflow/nitro
2
2
 
3
- The docs have moved! Refer to them [here](https://useworkflow.dev/)
3
+ The docs have moved! Refer to them [here](https://workflow-sdk.dev/)
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAEX,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,qBAAa,aAAc,SAAQ,2BAA2B;gBAChD,KAAK,EAAE,KAAK;IAUT,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAWtC;AAED,qBAAa,YAAa,SAAQ,WAAW;;gBAE/B,KAAK,EAAE,KAAK;IAaT,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAwCtC"}
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAEX,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAezC,qBAAa,aAAc,SAAQ,2BAA2B;gBAChD,KAAK,EAAE,KAAK;IAWT,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAWtC;AAED,qBAAa,YAAa,SAAQ,WAAW;;gBAE/B,KAAK,EAAE,KAAK;IAkBf,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA2EhC"}
package/dist/builders.js CHANGED
@@ -1,6 +1,16 @@
1
- import { mkdir, readFile, writeFile } from 'node:fs/promises';
1
+ import { randomUUID } from 'node:crypto';
2
+ import { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
2
3
  import { BaseBuilder, createBaseBuilderConfig, VercelBuildOutputAPIBuilder, } from '@workflow/builders';
3
4
  import { join } from 'pathe';
5
+ /**
6
+ * Forward string entries from Nitro's `externals.external` config to the
7
+ * workflow builder's esbuild `external` option. RegExp and function entries
8
+ * are skipped since esbuild's `external` only supports literal strings.
9
+ */
10
+ function getNitroStringExternals(nitro) {
11
+ const externals = nitro.options.externals?.external?.filter((entry) => typeof entry === 'string');
12
+ return externals && externals.length > 0 ? externals : undefined;
13
+ }
4
14
  export class VercelBuilder extends VercelBuildOutputAPIBuilder {
5
15
  constructor(nitro) {
6
16
  super({
@@ -8,6 +18,7 @@ export class VercelBuilder extends VercelBuildOutputAPIBuilder {
8
18
  workingDir: nitro.options.rootDir,
9
19
  dirs: ['.'], // Different apps that use nitro have different directories
10
20
  runtime: nitro.options.workflow?.runtime,
21
+ externalPackages: getNitroStringExternals(nitro),
11
22
  }),
12
23
  buildTarget: 'vercel-build-output-api',
13
24
  });
@@ -30,44 +41,79 @@ export class LocalBuilder extends BaseBuilder {
30
41
  workingDir: nitro.options.rootDir,
31
42
  watch: nitro.options.dev,
32
43
  dirs: ['.'], // Different apps that use nitro have different directories
44
+ externalPackages: getNitroStringExternals(nitro),
33
45
  }),
34
46
  buildTarget: 'next', // Placeholder, not actually used
35
47
  });
36
48
  this.#outDir = outDir;
37
49
  }
38
- async build() {
50
+ // Serialize concurrent build() calls so overlapping dev rebuilds don't
51
+ // stomp on each other's temp files or partially overwrite output.
52
+ #buildQueue = Promise.resolve();
53
+ build() {
54
+ const next = this.#buildQueue.then(() => this.#buildOnce(), () => this.#buildOnce());
55
+ // Swallow rejections on the queue itself so a failed build doesn't
56
+ // permanently reject all subsequent builds; each caller still sees
57
+ // its own rejection via the returned promise.
58
+ this.#buildQueue = next.catch(() => { });
59
+ return next;
60
+ }
61
+ async #buildOnce() {
39
62
  const inputFiles = await this.getInputFiles();
40
63
  await mkdir(this.#outDir, { recursive: true });
41
- const { manifest: workflowsManifest } = await this.createWorkflowsBundle({
42
- outfile: join(this.#outDir, 'workflows.mjs'),
43
- bundleFinalOutput: false,
44
- format: 'esm',
45
- inputFiles,
46
- });
47
- const { manifest: stepsManifest } = await this.createStepsBundle({
48
- outfile: join(this.#outDir, 'steps.mjs'),
49
- externalizeNonSteps: true,
50
- format: 'esm',
51
- inputFiles,
52
- });
53
- const webhookRouteFile = join(this.#outDir, 'webhook.mjs');
54
- await this.createWebhookBundle({
55
- outfile: webhookRouteFile,
56
- bundle: false,
57
- });
58
- // Merge manifests from both bundles
59
- const manifest = {
60
- steps: { ...stepsManifest.steps, ...workflowsManifest.steps },
61
- workflows: { ...stepsManifest.workflows, ...workflowsManifest.workflows },
62
- classes: { ...stepsManifest.classes, ...workflowsManifest.classes },
63
- };
64
- // Generate manifest
65
- const workflowBundlePath = join(this.#outDir, 'workflows.mjs');
66
- await this.createManifest({
67
- workflowBundlePath,
68
- manifestDir: this.#outDir,
69
- manifest,
70
- });
64
+ // Build to temporary files first, then move them into place.
65
+ // This prevents leaving partial/inconsistent output when a build
66
+ // fails mid-way (e.g., a file was deleted between discovery and
67
+ // compilation during dev HMR). A per-build UUID guarantees uniqueness
68
+ // across concurrent invocations, in case the queue is bypassed.
69
+ const tmpSuffix = `.tmp.${randomUUID()}`;
70
+ const workflowsTmpFile = join(this.#outDir, `workflows${tmpSuffix}.mjs`);
71
+ const stepsTmpFile = join(this.#outDir, `steps${tmpSuffix}.mjs`);
72
+ const webhookTmpFile = join(this.#outDir, `webhook${tmpSuffix}.mjs`);
73
+ try {
74
+ const { manifest: workflowsManifest } = await this.createWorkflowsBundle({
75
+ outfile: workflowsTmpFile,
76
+ bundleFinalOutput: false,
77
+ format: 'esm',
78
+ inputFiles,
79
+ });
80
+ const { manifest: stepsManifest } = await this.createStepsBundle({
81
+ outfile: stepsTmpFile,
82
+ externalizeNonSteps: true,
83
+ format: 'esm',
84
+ inputFiles,
85
+ });
86
+ await this.createWebhookBundle({
87
+ outfile: webhookTmpFile,
88
+ bundle: false,
89
+ });
90
+ // All builds succeeded — atomically move files into place
91
+ await rename(workflowsTmpFile, join(this.#outDir, 'workflows.mjs'));
92
+ await rename(stepsTmpFile, join(this.#outDir, 'steps.mjs'));
93
+ await rename(webhookTmpFile, join(this.#outDir, 'webhook.mjs'));
94
+ // Merge manifests from both bundles
95
+ const manifest = {
96
+ steps: { ...stepsManifest.steps, ...workflowsManifest.steps },
97
+ workflows: {
98
+ ...stepsManifest.workflows,
99
+ ...workflowsManifest.workflows,
100
+ },
101
+ classes: { ...stepsManifest.classes, ...workflowsManifest.classes },
102
+ };
103
+ // Generate manifest
104
+ const workflowBundlePath = join(this.#outDir, 'workflows.mjs');
105
+ await this.createManifest({
106
+ workflowBundlePath,
107
+ manifestDir: this.#outDir,
108
+ manifest,
109
+ });
110
+ }
111
+ finally {
112
+ // Clean up temporary files on success or failure
113
+ await unlink(workflowsTmpFile).catch(() => { });
114
+ await unlink(stepsTmpFile).catch(() => { });
115
+ await unlink(webhookTmpFile).catch(() => { });
116
+ }
71
117
  }
72
118
  }
73
119
  //# sourceMappingURL=builders.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builders.js","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,MAAM,OAAO,aAAc,SAAQ,2BAA2B;IAC5D,YAAY,KAAY;QACtB,KAAK,CAAC;YACJ,GAAG,uBAAuB,CAAC;gBACzB,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO;gBACjC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,2DAA2D;gBACxE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,OA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';\nimport {\n BaseBuilder,\n createBaseBuilderConfig,\n VercelBuildOutputAPIBuilder,\n} from '@workflow/builders';\nimport type { Nitro } from 'nitro/types';\nimport { join } from 'pathe';\n\n/**\n * Forward string entries from Nitro's `externals.external` config to the\n * workflow builder's esbuild `external` option. RegExp and function entries\n * are skipped since esbuild's `external` only supports literal strings.\n */\nfunction getNitroStringExternals(nitro: Nitro): string[] | undefined {\n const externals = nitro.options.externals?.external?.filter(\n (entry): entry is string => typeof entry === 'string'\n );\n return externals && externals.length > 0 ? externals : undefined;\n}\n\nexport class VercelBuilder extends VercelBuildOutputAPIBuilder {\n constructor(nitro: Nitro) {\n super({\n ...createBaseBuilderConfig({\n workingDir: nitro.options.rootDir,\n dirs: ['.'], // Different apps that use nitro have different directories\n runtime: nitro.options.workflow?.runtime,\n externalPackages: getNitroStringExternals(nitro),\n }),\n buildTarget: 'vercel-build-output-api',\n });\n }\n override async build(): Promise<void> {\n const configPath = join(\n this.config.workingDir,\n '.vercel/output/config.json'\n );\n const originalConfig = JSON.parse(await readFile(configPath, 'utf-8'));\n await super.build();\n const newConfig = JSON.parse(await readFile(configPath, 'utf-8'));\n originalConfig.routes.unshift(...newConfig.routes);\n await writeFile(configPath, JSON.stringify(originalConfig, null, 2));\n }\n}\n\nexport class LocalBuilder extends BaseBuilder {\n #outDir: string;\n constructor(nitro: Nitro) {\n const outDir = join(nitro.options.buildDir, 'workflow');\n super({\n ...createBaseBuilderConfig({\n workingDir: nitro.options.rootDir,\n watch: nitro.options.dev,\n dirs: ['.'], // Different apps that use nitro have different directories\n externalPackages: getNitroStringExternals(nitro),\n }),\n buildTarget: 'next', // Placeholder, not actually used\n });\n this.#outDir = outDir;\n }\n\n // Serialize concurrent build() calls so overlapping dev rebuilds don't\n // stomp on each other's temp files or partially overwrite output.\n #buildQueue: Promise<void> = Promise.resolve();\n\n override build(): Promise<void> {\n const next = this.#buildQueue.then(\n () => this.#buildOnce(),\n () => this.#buildOnce()\n );\n // Swallow rejections on the queue itself so a failed build doesn't\n // permanently reject all subsequent builds; each caller still sees\n // its own rejection via the returned promise.\n this.#buildQueue = next.catch(() => {});\n return next;\n }\n\n async #buildOnce(): Promise<void> {\n const inputFiles = await this.getInputFiles();\n await mkdir(this.#outDir, { recursive: true });\n\n // Build to temporary files first, then move them into place.\n // This prevents leaving partial/inconsistent output when a build\n // fails mid-way (e.g., a file was deleted between discovery and\n // compilation during dev HMR). A per-build UUID guarantees uniqueness\n // across concurrent invocations, in case the queue is bypassed.\n const tmpSuffix = `.tmp.${randomUUID()}`;\n const workflowsTmpFile = join(this.#outDir, `workflows${tmpSuffix}.mjs`);\n const stepsTmpFile = join(this.#outDir, `steps${tmpSuffix}.mjs`);\n const webhookTmpFile = join(this.#outDir, `webhook${tmpSuffix}.mjs`);\n\n try {\n const { manifest: workflowsManifest } = await this.createWorkflowsBundle({\n outfile: workflowsTmpFile,\n bundleFinalOutput: false,\n format: 'esm',\n inputFiles,\n });\n\n const { manifest: stepsManifest } = await this.createStepsBundle({\n outfile: stepsTmpFile,\n externalizeNonSteps: true,\n format: 'esm',\n inputFiles,\n });\n\n await this.createWebhookBundle({\n outfile: webhookTmpFile,\n bundle: false,\n });\n\n // All builds succeeded — atomically move files into place\n await rename(workflowsTmpFile, join(this.#outDir, 'workflows.mjs'));\n await rename(stepsTmpFile, join(this.#outDir, 'steps.mjs'));\n await rename(webhookTmpFile, join(this.#outDir, 'webhook.mjs'));\n\n // Merge manifests from both bundles\n const manifest = {\n steps: { ...stepsManifest.steps, ...workflowsManifest.steps },\n workflows: {\n ...stepsManifest.workflows,\n ...workflowsManifest.workflows,\n },\n classes: { ...stepsManifest.classes, ...workflowsManifest.classes },\n };\n\n // Generate manifest\n const workflowBundlePath = join(this.#outDir, 'workflows.mjs');\n await this.createManifest({\n workflowBundlePath,\n manifestDir: this.#outDir,\n manifest,\n });\n } finally {\n // Clean up temporary files on success or failure\n await unlink(workflowsTmpFile).catch(() => {});\n await unlink(stepsTmpFile).catch(() => {});\n await unlink(webhookTmpFile).catch(() => {});\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAA6B,MAAM,aAAa,CAAC;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,YAAY,EAAE,aAAa,EAAE,CAAC;;;6BAIT,KAAK;;AAF1B,wBAwHwB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAA6B,MAAM,aAAa,CAAC;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,YAAY,EAAE,aAAa,EAAE,CAAC;;;6BAIT,KAAK;;AAF1B,wBAwMwB"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { fileURLToPath } from 'node:url';
2
3
  import { workflowTransformPlugin } from '@workflow/rollup';
3
4
  import { join } from 'pathe';
4
5
  import { LocalBuilder, VercelBuilder } from './builders.js';
@@ -22,12 +23,77 @@ export default {
22
23
  if (!nitro.options.workflow?._vite) {
23
24
  nitro.options.alias['debug'] ??= 'debug';
24
25
  }
25
- // NOTE: Externalize .nitro/workflow to prevent dev reloads
26
26
  if (nitro.options.dev) {
27
- nitro.options.externals ||= {};
28
- nitro.options.externals.external ||= [];
29
- const outDir = join(nitro.options.buildDir, 'workflow');
30
- nitro.options.externals.external.push((id) => id.startsWith(outDir));
27
+ const workflowBuildGlob = `${join(nitro.options.buildDir, 'workflow')}/**`;
28
+ nitro.options.watchOptions ||= {};
29
+ const existingIgnored = nitro.options.watchOptions.ignored;
30
+ if (!existingIgnored) {
31
+ nitro.options.watchOptions.ignored = [workflowBuildGlob];
32
+ }
33
+ else if (Array.isArray(existingIgnored)) {
34
+ nitro.options.watchOptions.ignored = [
35
+ ...existingIgnored,
36
+ workflowBuildGlob,
37
+ ];
38
+ }
39
+ else {
40
+ nitro.options.watchOptions.ignored = [
41
+ existingIgnored,
42
+ workflowBuildGlob,
43
+ ];
44
+ }
45
+ }
46
+ // In dev mode, force workflow SDK packages to be bundled by Nitro's
47
+ // Rollup rather than externalized. This ensures the SWC transform
48
+ // plugin processes files containing workflow patterns (like
49
+ // @workflow/core/dist/runtime/run.js) and adds the classId
50
+ // registration IIFEs needed for serialization. Without this, serde
51
+ // classes from npm packages (like `Run`) would be externalized, the
52
+ // SWC transform would never fire on them, and serialization would
53
+ // fail with "must have a static classId property".
54
+ //
55
+ // We use a Rollup resolveId hook (added BEFORE the externalization
56
+ // plugin) that intercepts workflow package imports and marks them
57
+ // as non-external. This is more targeted than `noExternals = true`
58
+ // which would bundle ALL dependencies and cause TDZ errors from
59
+ // circular imports in packages like vue-bundle-renderer/h3.
60
+ if (nitro.options.dev) {
61
+ nitro.hooks.hook('rollup:before', (_nitro, config) => {
62
+ config.plugins.unshift({
63
+ name: 'workflow:force-inline',
64
+ async resolveId(source, importer, options) {
65
+ if (!importer)
66
+ return null;
67
+ // Let other plugins resolve first to get the file path
68
+ const resolved = await this.resolve(source, importer, {
69
+ ...options,
70
+ skipSelf: true,
71
+ });
72
+ if (!resolved)
73
+ return null;
74
+ if (!resolved.external)
75
+ return null;
76
+ // Force workflow packages and their internal imports
77
+ // to be bundled (not external). We match both the
78
+ // package specifier (e.g., `@workflow/core/runtime`)
79
+ // and resolved file paths within workflow packages.
80
+ const isWorkflowPkg = /^@?workflow(\/|$)/.test(source) ||
81
+ /[\\/]packages[\\/](workflow|core|serde|errors|utils|builders|rollup|ai|world|world-local|world-vercel|world-postgres|world-testing|cli|next|nitro|nuxt|vite|vitest|web|web-shared|astro|sveltekit|nest)[\\/]/.test(resolved.id);
82
+ if (isWorkflowPkg) {
83
+ // Strip file:// protocol if present — Rollup needs
84
+ // a plain filesystem path to load the module.
85
+ // `fileURLToPath` correctly handles Windows paths
86
+ // (e.g., file:///C:/... -> C:\...) and percent-decoding.
87
+ let resolvedId = resolved.id;
88
+ if (resolvedId.startsWith('file://')) {
89
+ resolvedId = fileURLToPath(resolvedId);
90
+ }
91
+ return { id: resolvedId, external: false };
92
+ }
93
+ return null;
94
+ },
95
+ });
96
+ });
31
97
  }
32
98
  // Add tsConfig plugin
33
99
  if (nitro.options.workflow?.typescriptPlugin) {
@@ -65,7 +131,16 @@ export default {
65
131
  isInitialBuild = false;
66
132
  return;
67
133
  }
68
- await builder.build();
134
+ try {
135
+ await builder.build();
136
+ }
137
+ catch (error) {
138
+ // During dev, files may be added/removed while the builder
139
+ // is rebuilding (e.g., during test cleanup). Log the error
140
+ // but don't crash — the next file change will trigger
141
+ // another rebuild with the correct file list.
142
+ console.warn('Warning: Workflow rebuild failed:', error);
143
+ }
69
144
  });
70
145
  }
71
146
  addVirtualHandler(nitro, '/.well-known/workflow/v1/webhook/:token', 'workflow/webhook.mjs');
@@ -94,11 +169,72 @@ function addVirtualHandler(nitro, route, buildPath) {
94
169
  route,
95
170
  handler: `#${buildPath}`,
96
171
  });
172
+ const handlerImportPath = JSON.stringify(join(nitro.options.buildDir, buildPath));
173
+ if (nitro.options.dev) {
174
+ // Dev mode: load generated workflow bundles from disk at request time.
175
+ // This keeps `.nitro/workflow/*.mjs` out of Nitro's own bundle graph,
176
+ // which avoids rebuild loops and stale dependency graphs during HMR.
177
+ // Cache-bust by file mtime so each successful rebuild loads fresh code.
178
+ if (!nitro.routing) {
179
+ nitro.options.virtual[`#${buildPath}`] = /* js */ `
180
+ import { fromWebHandler } from "h3";
181
+ import { statSync } from "node:fs";
182
+ import { pathToFileURL } from "node:url";
183
+
184
+ const handlerPath = ${handlerImportPath};
185
+ let currentVersion = "";
186
+ let currentImportPath = "";
187
+
188
+ async function loadPOST() {
189
+ const version = String(statSync(handlerPath).mtimeMs);
190
+ if (version !== currentVersion) {
191
+ currentVersion = version;
192
+ currentImportPath = pathToFileURL(handlerPath).href + "?t=" + version;
193
+ }
194
+ return (await import(currentImportPath)).POST;
195
+ }
196
+
197
+ export default fromWebHandler(async (request, context) => {
198
+ const POST = await loadPOST();
199
+ return POST(request, context);
200
+ });
201
+ `;
202
+ }
203
+ else {
204
+ nitro.options.virtual[`#${buildPath}`] = /* js */ `
205
+ import { statSync } from "node:fs";
206
+ import { pathToFileURL } from "node:url";
207
+
208
+ const handlerPath = ${handlerImportPath};
209
+ let currentVersion = "";
210
+ let currentImportPath = "";
211
+
212
+ async function loadPOST() {
213
+ const version = String(statSync(handlerPath).mtimeMs);
214
+ if (version !== currentVersion) {
215
+ currentVersion = version;
216
+ currentImportPath = pathToFileURL(handlerPath).href + "?t=" + version;
217
+ }
218
+ return (await import(currentImportPath)).POST;
219
+ }
220
+
221
+ export default async ({ req }) => {
222
+ try {
223
+ const POST = await loadPOST();
224
+ return await POST(req);
225
+ } catch (error) {
226
+ console.error('Handler error:', error);
227
+ return new Response('Internal Server Error', { status: 500 });
228
+ }
229
+ };
230
+ `;
231
+ }
232
+ return;
233
+ }
97
234
  // Keep a bare import alongside `POST`: in Nuxt + Nitro production builds
98
235
  // using `@workflow/nuxt`, importing only `POST` could drop the generated
99
236
  // step bundle's top-level registrations, so the handler loaded but steps
100
237
  // were missing at runtime.
101
- const handlerImportPath = JSON.stringify(join(nitro.options.buildDir, buildPath));
102
238
  if (!nitro.routing) {
103
239
  // Nitro v2 (legacy)
104
240
  nitro.options.virtual[`#${buildPath}`] = /* js */ `
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,YAAY,EAA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AAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW;QAExC,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,OAAO;YAChC,CAAC,CAAC;mBACW,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;;;;CAIjD;YACK,CAAC,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;;;;CAI1D,CAAC;QACE,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,+BAA+B;QAC/B,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO;YAC7B,CAAC,CAAC;;CAEP;YACK,CAAC,CAAC;CACP,CAAC;QACE,aAAa,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;AACH,CAAC","sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { workflowTransformPlugin } from '@workflow/rollup';\nimport type { Nitro, NitroModule, RollupConfig } from 'nitro/types';\nimport { join } from 'pathe';\nimport { LocalBuilder, VercelBuilder } from './builders.js';\nimport type { ModuleOptions } from './types';\n\nexport type { ModuleOptions };\n\nexport default {\n name: 'workflow/nitro',\n async setup(nitro: Nitro) {\n const isVercelDeploy =\n !nitro.options.dev && nitro.options.preset === 'vercel';\n\n // Pre-built workflow bundles directory - must be excluded from re-transformation\n const workflowBuildDir = join(nitro.options.buildDir, 'workflow');\n\n // Add transform plugin at the BEGINNING to run before other transforms\n // (especially before class property transforms that rename classes like _ClassName)\n nitro.hooks.hook('rollup:before', (_nitro: Nitro, config: RollupConfig) => {\n (config.plugins as Array<unknown>).unshift(\n workflowTransformPlugin({\n // Exclude pre-built workflow bundles from re-transformation\n // These are already processed and re-processing causes issues like\n // undefined class references when Nitro's bundler renames variables\n exclude: [workflowBuildDir],\n })\n );\n });\n\n // NOTE: Temporary workaround for debug unenv mock\n if (!nitro.options.workflow?._vite) {\n nitro.options.alias['debug'] ??= 'debug';\n }\n\n if (nitro.options.dev) {\n const workflowBuildGlob = `${join(nitro.options.buildDir, 'workflow')}/**`;\n nitro.options.watchOptions ||= {};\n const existingIgnored = nitro.options.watchOptions.ignored;\n if (!existingIgnored) {\n nitro.options.watchOptions.ignored = [workflowBuildGlob];\n } else if (Array.isArray(existingIgnored)) {\n nitro.options.watchOptions.ignored = [\n ...existingIgnored,\n workflowBuildGlob,\n ];\n } else {\n nitro.options.watchOptions.ignored = [\n existingIgnored,\n workflowBuildGlob,\n ];\n }\n }\n\n // In dev mode, force workflow SDK packages to be bundled by Nitro's\n // Rollup rather than externalized. This ensures the SWC transform\n // plugin processes files containing workflow patterns (like\n // @workflow/core/dist/runtime/run.js) and adds the classId\n // registration IIFEs needed for serialization. Without this, serde\n // classes from npm packages (like `Run`) would be externalized, the\n // SWC transform would never fire on them, and serialization would\n // fail with \"must have a static classId property\".\n //\n // We use a Rollup resolveId hook (added BEFORE the externalization\n // plugin) that intercepts workflow package imports and marks them\n // as non-external. This is more targeted than `noExternals = true`\n // which would bundle ALL dependencies and cause TDZ errors from\n // circular imports in packages like vue-bundle-renderer/h3.\n if (nitro.options.dev) {\n nitro.hooks.hook(\n 'rollup:before',\n (_nitro: Nitro, config: RollupConfig) => {\n (config.plugins as Array<unknown>).unshift({\n name: 'workflow:force-inline',\n async resolveId(\n this: { resolve: Function },\n source: string,\n importer: string | undefined,\n options: { skipSelf?: boolean }\n ) {\n if (!importer) return null;\n // Let other plugins resolve first to get the file path\n const resolved = await this.resolve(source, importer, {\n ...options,\n skipSelf: true,\n });\n if (!resolved) return null;\n if (!resolved.external) return null;\n // Force workflow packages and their internal imports\n // to be bundled (not external). We match both the\n // package specifier (e.g., `@workflow/core/runtime`)\n // and resolved file paths within workflow packages.\n const isWorkflowPkg =\n /^@?workflow(\\/|$)/.test(source) ||\n /[\\\\/]packages[\\\\/](workflow|core|serde|errors|utils|builders|rollup|ai|world|world-local|world-vercel|world-postgres|world-testing|cli|next|nitro|nuxt|vite|vitest|web|web-shared|astro|sveltekit|nest)[\\\\/]/.test(\n resolved.id\n );\n if (isWorkflowPkg) {\n // Strip file:// protocol if present — Rollup needs\n // a plain filesystem path to load the module.\n // `fileURLToPath` correctly handles Windows paths\n // (e.g., file:///C:/... -> C:\\...) and percent-decoding.\n let resolvedId = resolved.id;\n if (resolvedId.startsWith('file://')) {\n resolvedId = fileURLToPath(resolvedId);\n }\n return { id: resolvedId, external: false };\n }\n return null;\n },\n });\n }\n );\n }\n\n // Add tsConfig plugin\n if (nitro.options.workflow?.typescriptPlugin) {\n nitro.options.typescript.tsConfig ||= {};\n nitro.options.typescript.tsConfig.compilerOptions ||= {};\n nitro.options.typescript.tsConfig.compilerOptions.plugins ||= [];\n nitro.options.typescript.tsConfig.compilerOptions.plugins.push({\n name: 'workflow',\n });\n }\n\n // Generate functions for vercel build\n if (isVercelDeploy) {\n nitro.hooks.hook('compiled', async () => {\n await new VercelBuilder(nitro).build();\n });\n }\n\n // Generate local bundles for dev and local prod\n if (!isVercelDeploy) {\n const builder = new LocalBuilder(nitro);\n let isInitialBuild = true;\n\n nitro.hooks.hook('build:before', async () => {\n await builder.build();\n\n // For prod: write the manifest handler file with inlined content\n // now that the builder has generated the manifest. Rollup will\n // bundle this file into the compiled output.\n if (\n !nitro.options.dev &&\n process.env.WORKFLOW_PUBLIC_MANIFEST === '1'\n ) {\n writeManifestHandler(nitro);\n }\n });\n\n // Allows for HMR - but skip the first dev:reload since build:before already ran\n if (nitro.options.dev) {\n nitro.hooks.hook('dev:reload', async () => {\n if (isInitialBuild) {\n isInitialBuild = false;\n return;\n }\n try {\n await builder.build();\n } catch (error) {\n // During dev, files may be added/removed while the builder\n // is rebuilding (e.g., during test cleanup). Log the error\n // but don't crash — the next file change will trigger\n // another rebuild with the correct file list.\n console.warn('Warning: Workflow rebuild failed:', error);\n }\n });\n }\n\n addVirtualHandler(\n nitro,\n '/.well-known/workflow/v1/webhook/:token',\n 'workflow/webhook.mjs'\n );\n\n addVirtualHandler(\n nitro,\n '/.well-known/workflow/v1/step',\n 'workflow/steps.mjs'\n );\n\n addVirtualHandler(\n nitro,\n '/.well-known/workflow/v1/flow',\n 'workflow/workflows.mjs'\n );\n\n // Expose manifest as a public HTTP route when WORKFLOW_PUBLIC_MANIFEST=1\n if (process.env.WORKFLOW_PUBLIC_MANIFEST === '1') {\n // Write a placeholder manifest-data.mjs so rollup can resolve the\n // import. It will be overwritten with the real manifest in build:before.\n // Write a placeholder handler file so rollup can resolve the path\n // during prod compilation. It will be overwritten with the real\n // manifest content by writeManifestHandler() in build:before.\n if (!nitro.options.dev) {\n const dir = join(nitro.options.buildDir, 'workflow');\n mkdirSync(dir, { recursive: true });\n const handlerPath = join(dir, 'manifest-handler.mjs');\n writeFileSync(\n handlerPath,\n 'export default async () => new Response(\"Manifest not found\", { status: 404 });\\n'\n );\n }\n addManifestHandler(nitro);\n }\n }\n },\n} satisfies NitroModule;\n\nfunction addVirtualHandler(nitro: Nitro, route: string, buildPath: string) {\n nitro.options.handlers.push({\n route,\n handler: `#${buildPath}`,\n });\n const handlerImportPath = JSON.stringify(\n join(nitro.options.buildDir, buildPath)\n );\n\n if (nitro.options.dev) {\n // Dev mode: load generated workflow bundles from disk at request time.\n // This keeps `.nitro/workflow/*.mjs` out of Nitro's own bundle graph,\n // which avoids rebuild loops and stale dependency graphs during HMR.\n // Cache-bust by file mtime so each successful rebuild loads fresh code.\n if (!nitro.routing) {\n nitro.options.virtual[`#${buildPath}`] = /* js */ `\n import { fromWebHandler } from \"h3\";\n import { statSync } from \"node:fs\";\n import { pathToFileURL } from \"node:url\";\n\n const handlerPath = ${handlerImportPath};\n let currentVersion = \"\";\n let currentImportPath = \"\";\n\n async function loadPOST() {\n const version = String(statSync(handlerPath).mtimeMs);\n if (version !== currentVersion) {\n currentVersion = version;\n currentImportPath = pathToFileURL(handlerPath).href + \"?t=\" + version;\n }\n return (await import(currentImportPath)).POST;\n }\n\n export default fromWebHandler(async (request, context) => {\n const POST = await loadPOST();\n return POST(request, context);\n });\n `;\n } else {\n nitro.options.virtual[`#${buildPath}`] = /* js */ `\n import { statSync } from \"node:fs\";\n import { pathToFileURL } from \"node:url\";\n\n const handlerPath = ${handlerImportPath};\n let currentVersion = \"\";\n let currentImportPath = \"\";\n\n async function loadPOST() {\n const version = String(statSync(handlerPath).mtimeMs);\n if (version !== currentVersion) {\n currentVersion = version;\n currentImportPath = pathToFileURL(handlerPath).href + \"?t=\" + version;\n }\n return (await import(currentImportPath)).POST;\n }\n\n export default async ({ req }) => {\n try {\n const POST = await loadPOST();\n return await POST(req);\n } catch (error) {\n console.error('Handler error:', error);\n return new Response('Internal Server Error', { status: 500 });\n }\n };\n `;\n }\n return;\n }\n\n // Keep a bare import alongside `POST`: in Nuxt + Nitro production builds\n // using `@workflow/nuxt`, importing only `POST` could drop the generated\n // step bundle's top-level registrations, so the handler loaded but steps\n // were missing at runtime.\n\n if (!nitro.routing) {\n // Nitro v2 (legacy)\n nitro.options.virtual[`#${buildPath}`] = /* js */ `\n import ${handlerImportPath};\n import { fromWebHandler } from \"h3\";\n import { POST } from ${handlerImportPath};\n export default fromWebHandler(POST);\n `;\n } else {\n // Nitro v3+ (native web handlers)\n nitro.options.virtual[`#${buildPath}`] = /* js */ `\n import ${handlerImportPath};\n import { POST } from ${handlerImportPath};\n export default async ({ req }) => {\n try {\n return await POST(req);\n } catch (error) {\n console.error('Handler error:', error);\n return new Response('Internal Server Error', { status: 500 });\n }\n };\n `;\n }\n}\n\nconst MANIFEST_VIRTUAL_ID = '#workflow/manifest-handler';\n\nfunction addManifestHandler(nitro: Nitro) {\n const route = '/.well-known/workflow/v1/manifest.json';\n const manifestPath = join(nitro.options.buildDir, 'workflow/manifest.json');\n const handlerPath = join(\n nitro.options.buildDir,\n 'workflow/manifest-handler.mjs'\n );\n\n if (nitro.options.dev) {\n // Dev mode: use a virtual handler that reads the manifest from disk at\n // request time. The absolute path is valid because we're on the build machine.\n nitro.options.handlers.push({ route, handler: MANIFEST_VIRTUAL_ID });\n nitro.options.virtual[MANIFEST_VIRTUAL_ID] = !nitro.routing\n ? /* js */ `\n import { fromWebHandler } from \"h3\";\n import { readFileSync } from \"node:fs\";\n function GET() {\n try {\n const manifest = readFileSync(${JSON.stringify(manifestPath)}, \"utf-8\");\n return new Response(manifest, {\n headers: { \"content-type\": \"application/json\" },\n });\n } catch {\n return new Response(\"Manifest not found\", { status: 404 });\n }\n }\n export default fromWebHandler(GET);\n `\n : /* js */ `\n import { readFileSync } from \"node:fs\";\n export default async () => {\n try {\n const manifest = readFileSync(${JSON.stringify(manifestPath)}, \"utf-8\");\n return new Response(manifest, {\n headers: { \"content-type\": \"application/json\" },\n });\n } catch {\n return new Response(\"Manifest not found\", { status: 404 });\n }\n };\n `;\n } else {\n // Prod mode: register a physical handler file that will be written by\n // writeManifestHandler() after the builder generates the manifest.\n // This file is bundled by rollup into the compiled output.\n nitro.options.handlers.push({ route, handler: handlerPath });\n }\n}\n\n/**\n * Writes a physical manifest handler file with the manifest content inlined.\n * Must be called after the builder generates the manifest (during build:before)\n * and before Nitro compiles the bundle with rollup.\n */\nfunction writeManifestHandler(nitro: Nitro) {\n const manifestPath = join(nitro.options.buildDir, 'workflow/manifest.json');\n const handlerPath = join(\n nitro.options.buildDir,\n 'workflow/manifest-handler.mjs'\n );\n const dir = join(nitro.options.buildDir, 'workflow');\n mkdirSync(dir, { recursive: true });\n\n try {\n const manifestContent = readFileSync(manifestPath, 'utf-8');\n JSON.parse(manifestContent); // validate\n\n const handlerCode = !nitro.routing\n ? `import { fromWebHandler } from \"h3\";\nconst manifest = ${JSON.stringify(manifestContent)};\nexport default fromWebHandler(() => new Response(manifest, {\n headers: { \"content-type\": \"application/json\" },\n}));\n`\n : `const manifest = ${JSON.stringify(manifestContent)};\nexport default async () => new Response(manifest, {\n headers: { \"content-type\": \"application/json\" },\n});\n`;\n writeFileSync(handlerPath, handlerCode);\n } catch {\n // Write a 404 fallback handler\n const fallback = !nitro.routing\n ? `import { fromWebHandler } from \"h3\";\nexport default fromWebHandler(() => new Response(\"Manifest not found\", { status: 404 }));\n`\n : `export default async () => new Response(\"Manifest not found\", { status: 404 });\n`;\n writeFileSync(handlerPath, fallback);\n }\n}\n"]}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface ModuleOptions {\n /** @internal */\n _vite?: boolean;\n\n /**\n * Directories to scan for workflows and steps.\n *\n * By default, `workflows/` directory will be scanned from root and all layer source dirs.\n */\n dirs?: string[];\n\n /**\n * Enable workflow TypeScript plugin in generated tsconfig.json\n * @default false\n */\n typescriptPlugin?: boolean;\n\n /**\n * Node.js runtime version for Vercel Functions.\n * @example \"nodejs22.x\"\n * @example \"nodejs24.x\"\n */\n runtime?: string;\n}\n\ndeclare module 'nitro/types' {\n interface NitroOptions {\n workflow?: ModuleOptions;\n }\n}\n\n// @ts-expect-error (legacy)\ndeclare module 'nitropack' {\n interface NitroOptions {\n workflow?: ModuleOptions;\n }\n}\n"]}
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,WAAW,MAAM,YAAY,CAAC;AAErC,MAAM,UAAU,QAAQ,CAAC,OAAuB;IAC9C,IAA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EAAE;oBACV,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;wBACxC,sCAAsC;wBACtC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,2BAA2B,CAAC,EAAE,CAAC;4BACtD,OAAO,IAAI,EAAE,CAAC;wBAChB,CAAC;wBAED,uDAAuD;wBACvD,MAAM,iBAAiB,GAAG,GAAG,CAAC,SAAS,CAAC;wBACxC,GAAG,CAAC,SAAS,GAAG,UAA4B,GAAG,IAAW;4BACxD,MAAM,UAAU,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;4BAE/D,4EAA4E;4BAC5E,0DAA0D;4BAC1D,sEAAsE;4BACtE,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gCACvB,0DAA0D;gCAC1D,GAAG,CAAC,SAAS,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;4BACvC,CAAC;4BAED,gDAAgD;4BAChD,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;wBAC7C,CAAQ,CAAC;wBAET,IAAI,EAAE,CAAC;oBACT,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC;YACJ,CAAC;SACF;QACD,uBAAuB,CAAC;YACtB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO;YACtB,OAAO;SACR,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import { createBuildQueue } from '@workflow/builders';\nimport { workflowTransformPlugin } from '@workflow/rollup';\nimport { workflowHotUpdatePlugin } from '@workflow/vite';\nimport type { Nitro } from 'nitro/types';\nimport type {} from 'nitro/vite';\nimport { join } from 'pathe';\nimport type { Plugin } from 'vite';\nimport { LocalBuilder } from './builders.js';\nimport type { ModuleOptions } from './index.js';\nimport nitroModule from './index.js';\n\nexport function workflow(options?: ModuleOptions): Plugin[] {\n let builder: LocalBuilder;\n let workflowBuildDir: string;\n const enqueue = createBuildQueue();\n\n // Create a lazy transform plugin that excludes the workflow build directory\n // The exclusion path is set during nitro setup, so we need to defer plugin creation\n const lazyTransformPlugin: Plugin = {\n name: 'workflow:transform',\n transform(code, id) {\n // Delegate to the actual transform plugin with exclusion\n // workflowBuildDir is set during nitro setup before transforms run\n const plugin = workflowTransformPlugin({\n exclude: workflowBuildDir ? [workflowBuildDir] : [],\n });\n return (plugin.transform as Function)?.call(this, code, id);\n },\n };\n\n return [\n lazyTransformPlugin,\n {\n name: 'workflow:nitro',\n nitro: {\n setup: (nitro: Nitro) => {\n // Capture the workflow build directory for exclusion\n workflowBuildDir = join(nitro.options.buildDir, 'workflow');\n nitro.options.workflow = {\n ...nitro.options.workflow,\n ...options,\n _vite: true,\n };\n if (nitro.options.dev) {\n builder = new LocalBuilder(nitro);\n }\n return nitroModule.setup(nitro);\n },\n },\n // NOTE: This is a workaround because Nitro passes the 404 requests to the dev server to handle.\n // For workflow routes, we override to send an empty body to prevent Hono/Vite's SPA fallback.\n configureServer(server) {\n // Add middleware to intercept 404s on workflow routes before Vite's SPA fallback\n return () => {\n server.middlewares.use((req, res, next) => {\n // Only handle workflow webhook routes\n if (!req.url?.startsWith('/.well-known/workflow/v1/')) {\n return next();\n }\n\n // Wrap writeHead to ensure we send empty body for 404s\n const originalWriteHead = res.writeHead;\n res.writeHead = function (this: typeof res, ...args: any[]) {\n const statusCode = typeof args[0] === 'number' ? args[0] : 200;\n\n // NOTE: Workaround because Nitro passes 404 requests to the vite to handle.\n // Causes `webhook route with invalid token` test to fail.\n // For 404s on workflow routes, ensure we're sending the right headers\n if (statusCode === 404) {\n // Set content-length to 0 to prevent Vite from overriding\n res.setHeader('Content-Length', '0');\n }\n\n // @ts-expect-error - Complex overload signature\n return originalWriteHead.apply(this, args);\n } as any;\n\n next();\n });\n };\n },\n },\n workflowHotUpdatePlugin({\n builder: () => builder,\n enqueue,\n }),\n ];\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow/nitro",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.3",
4
4
  "description": "Nitro integration for Workflow SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,16 +24,16 @@
24
24
  "@swc/core": "1.15.3",
25
25
  "exsolve": "1.0.8",
26
26
  "pathe": "2.0.3",
27
- "@workflow/builders": "5.0.0-beta.1",
28
- "@workflow/core": "5.0.0-beta.1",
29
- "@workflow/rollup": "5.0.0-beta.1",
30
- "@workflow/swc-plugin": "5.0.0-beta.1",
31
- "@workflow/vite": "5.0.0-beta.1"
27
+ "@workflow/builders": "5.0.0-beta.3",
28
+ "@workflow/core": "5.0.0-beta.3",
29
+ "@workflow/rollup": "5.0.0-beta.3",
30
+ "@workflow/swc-plugin": "5.0.0-beta.3",
31
+ "@workflow/vite": "5.0.0-beta.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "22.19.0",
35
35
  "nitro": "3.0.1-alpha.1",
36
- "vite": "7.1.12",
36
+ "vite": "7.3.2",
37
37
  "@workflow/tsconfig": "5.0.0-beta.0"
38
38
  },
39
39
  "scripts": {