@workflow/builders 5.0.0-beta.4 → 5.0.0-beta.6
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/dist/base-builder.d.ts +69 -2
- package/dist/base-builder.d.ts.map +1 -1
- package/dist/base-builder.js +368 -19
- package/dist/base-builder.js.map +1 -1
- package/dist/config-helpers.d.ts +2 -1
- package/dist/config-helpers.d.ts.map +1 -1
- package/dist/config-helpers.js +1 -0
- package/dist/config-helpers.js.map +1 -1
- package/dist/constants.d.ts +3 -13
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -13
- package/dist/constants.js.map +1 -1
- package/dist/discover-entries-esbuild-plugin.d.ts.map +1 -1
- package/dist/discover-entries-esbuild-plugin.js +16 -1
- package/dist/discover-entries-esbuild-plugin.js.map +1 -1
- package/dist/external-package-warning.test.d.ts +2 -0
- package/dist/external-package-warning.test.d.ts.map +1 -0
- package/dist/external-package-warning.test.js +219 -0
- package/dist/external-package-warning.test.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module-specifier.d.ts.map +1 -1
- package/dist/module-specifier.js +47 -9
- package/dist/module-specifier.js.map +1 -1
- package/dist/module-specifier.test.js +20 -0
- package/dist/module-specifier.test.js.map +1 -1
- package/dist/node-module-esbuild-plugin.d.ts.map +1 -1
- package/dist/node-module-esbuild-plugin.js +72 -22
- package/dist/node-module-esbuild-plugin.js.map +1 -1
- package/dist/node-module-esbuild-plugin.test.js +96 -0
- package/dist/node-module-esbuild-plugin.test.js.map +1 -1
- package/dist/resolve-sourcemap.test.d.ts +2 -0
- package/dist/resolve-sourcemap.test.d.ts.map +1 -0
- package/dist/resolve-sourcemap.test.js +126 -0
- package/dist/resolve-sourcemap.test.js.map +1 -0
- package/dist/standalone.d.ts +0 -3
- package/dist/standalone.d.ts.map +1 -1
- package/dist/standalone.js +10 -39
- package/dist/standalone.js.map +1 -1
- package/dist/swc-esbuild-plugin.d.ts +9 -0
- package/dist/swc-esbuild-plugin.d.ts.map +1 -1
- package/dist/swc-esbuild-plugin.js +63 -8
- package/dist/swc-esbuild-plugin.js.map +1 -1
- package/dist/swc-esbuild-plugin.test.js +279 -3
- package/dist/swc-esbuild-plugin.test.js.map +1 -1
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vercel-build-output-api.d.ts +0 -2
- package/dist/vercel-build-output-api.d.ts.map +1 -1
- package/dist/vercel-build-output-api.js +24 -55
- package/dist/vercel-build-output-api.js.map +1 -1
- package/package.json +5 -5
package/dist/base-builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-builder.js","sourceRoot":"","sources":["../src/base-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,uBAAuB,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EACL,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,yB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AQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1D,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;YACtB,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnD,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;YACrD,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { mkdir, readFile, realpath, rename, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join, relative, resolve } from 'node:path';\nimport { promisify } from 'node:util';\nimport { pluralize } from '@workflow/utils';\nimport chalk from 'chalk';\nimport enhancedResolveOriginal from 'enhanced-resolve';\nimport * as esbuild from 'esbuild';\nimport { findUp } from 'find-up';\nimport { glob } from 'tinyglobby';\nimport {\n applySwcTransform,\n type WorkflowManifest,\n} from './apply-swc-transform.js';\nimport { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';\nimport { getEsbuildTsconfigOptions } from './esbuild-tsconfig.js';\nimport { getImportPath } from './module-specifier.js';\nimport { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';\nimport { createPseudoPackagePlugin } from './pseudo-package-esbuild-plugin.js';\nimport { createSwcPlugin } from './swc-esbuild-plugin.js';\nimport type { WorkflowConfig } from './types.js';\nimport { extractWorkflowGraphs } from './workflows-extractor.js';\n\nconst enhancedResolve = promisify(enhancedResolveOriginal);\n\nconst EMIT_SOURCEMAPS_FOR_DEBUGGING =\n process.env.WORKFLOW_EMIT_SOURCEMAPS_FOR_DEBUGGING === '1';\n\n/**\n * Normalize an array of file paths by appending the `realpath()` of each entry\n * (to handle symlinks, e.g. pnpm/workspace layouts) and deduplicating.\n */\nasync function withRealpaths(entries: string[]): Promise<string[]> {\n return Array.from(\n new Set(\n (\n await Promise.all(\n entries.map(async (entry) => {\n const resolved = await realpath(entry).catch(() => undefined);\n return resolved ? [entry, resolved] : [entry];\n })\n )\n ).flat()\n )\n );\n}\n\nexport interface DiscoveredEntries {\n discoveredSteps: Set<string>;\n discoveredWorkflows: Set<string>;\n discoveredSerdeFiles: Set<string>;\n}\n\n/**\n * Base class for workflow builders. Provides common build logic for transforming\n * workflow source files into deployable bundles using esbuild and SWC.\n *\n * Subclasses must implement the build() method to define builder-specific logic.\n */\nexport abstract class BaseBuilder {\n protected config: WorkflowConfig;\n\n constructor(config: WorkflowConfig) {\n this.config = config;\n }\n\n protected get transformProjectRoot(): string {\n return this.config.projectRoot || this.config.workingDir;\n }\n\n /**\n * Whether informational BaseBuilder logs should be printed.\n * Subclasses can override this to silence progress logs while keeping warnings/errors.\n */\n protected get shouldLogBaseBuilderInfo(): boolean {\n return true;\n }\n\n protected logBaseBuilderInfo(...args: unknown[]): void {\n if (this.shouldLogBaseBuilderInfo) {\n console.log(...args);\n }\n }\n\n private logCreateWorkflowsBundleInfo(...args: unknown[]): void {\n if (!this.config.suppressCreateWorkflowsBundleLogs) {\n this.logBaseBuilderInfo(...args);\n }\n }\n\n private logCreateWebhookBundleInfo(...args: unknown[]): void {\n if (!this.config.suppressCreateWebhookBundleLogs) {\n this.logBaseBuilderInfo(...args);\n }\n }\n\n private logCreateManifestInfo(...args: unknown[]): void {\n if (!this.config.suppressCreateManifestLogs) {\n this.logBaseBuilderInfo(...args);\n }\n }\n\n /**\n * When outputting CJS, esbuild replaces `import.meta` with an empty object,\n * making `import.meta.url` (and `import.meta.resolve`) undefined. This method\n * returns banner code and `define` entries that polyfill them using CJS\n * equivalents (`__filename`, `require.resolve`) so user code (e.g. Prisma)\n * that relies on `import.meta.url` works correctly in bundled CJS output.\n */\n private getCjsImportMetaPolyfill(format: string): {\n banner: string;\n define: Record<string, string>;\n } {\n if (format !== 'cjs') return { banner: '', define: {} };\n return {\n banner:\n 'var __import_meta_url = typeof __filename !== \"undefined\" ? require(\"url\").pathToFileURL(__filename).href : undefined;\\n' +\n 'var __import_meta_resolve = typeof require !== \"undefined\" && typeof __filename !== \"undefined\" ' +\n '? (s) => require(\"url\").pathToFileURL(require.resolve(s)).href : undefined;\\n',\n define: {\n 'import.meta.url': '__import_meta_url',\n 'import.meta.resolve': '__import_meta_resolve',\n },\n };\n }\n\n /**\n * When outputting fully-bundled ESM, CJS dependencies that call require()\n * for Node.js builtins (e.g. debug → require('tty')) break because esbuild's\n * CJS-to-ESM __require shim doesn't have access to a real require function.\n * This banner provides one via createRequire so bundled CJS code works in ESM.\n */\n private getEsmRequireBanner(format: string): string {\n if (format !== 'esm') return '';\n return 'import { createRequire as __createRequire } from \"node:module\";\\nvar require = __createRequire(import.meta.url);\\n';\n }\n\n /**\n * Performs the complete build process for workflows.\n * Subclasses must implement this to define their specific build steps.\n */\n abstract build(): Promise<void>;\n\n /**\n * Finds tsconfig.json/jsconfig.json for the project.\n * Used by esbuild to properly resolve module imports during bundling.\n */\n protected async findTsConfigPath(): Promise<string | undefined> {\n const cwd = this.config.workingDir || process.cwd();\n return findUp(['tsconfig.json', 'jsconfig.json'], { cwd });\n }\n\n /**\n * Discovers all source files in the configured directories.\n * Searches for TypeScript and JavaScript files while excluding common build\n * and dependency directories.\n */\n protected async getInputFiles(): Promise<string[]> {\n const ignore = [\n '**/node_modules/**',\n '**/.git/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.output/**',\n '**/.vercel/**',\n '**/.workflow-data/**',\n '**/.workflow-vitest/**',\n '**/.well-known/workflow/**',\n '**/.svelte-kit/**',\n '**/.turbo/**',\n '**/.cache/**',\n '**/.yarn/**',\n '**/.pnpm-store/**',\n ];\n\n // Use relative patterns with `cwd` per directory so that `dot: true`\n // applies consistently to both the search pattern *and* the ignore\n // patterns. When absolute patterns are used with tinyglobby, the `**`\n // in ignore patterns does not match dot-prefixed path segments.\n const results = await Promise.all(\n this.config.dirs.map((dir) => {\n const cwd = resolve(this.config.workingDir, dir);\n return glob(['**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}'], {\n cwd,\n ignore,\n absolute: true,\n dot: true,\n });\n })\n );\n\n return results.flat();\n }\n\n /**\n * Caches discovered workflow entries by input array reference.\n * Uses WeakMap to allow garbage collection when input arrays are no longer referenced.\n * This cache is invalidated automatically when the inputs array reference changes\n * (e.g., when files are added/removed during watch mode).\n */\n private discoveredEntries: WeakMap<string[], DiscoveredEntries> =\n new WeakMap();\n\n protected async discoverEntries(\n inputs: string[],\n outdir: string,\n tsconfigPath?: string\n ): Promise<DiscoveredEntries> {\n const previousResult = this.discoveredEntries.get(inputs);\n\n if (previousResult) {\n return previousResult;\n }\n const state: DiscoveredEntries = {\n discoveredSteps: new Set(),\n discoveredWorkflows: new Set(),\n discoveredSerdeFiles: new Set(),\n };\n\n const discoverStart = Date.now();\n\n // Resolve the SDK runtime entry point so that the discovery pass\n // traces through it and discovers serde classes (like `Run`) that\n // live inside SDK packages. Without this, files like `run.js` are\n // only discovered when user code happens to import them.\n // This is resolved here (rather than in callers) so that the original\n // `inputs` array reference is preserved for WeakMap caching — callers\n // like createWorkflowsBundle and createStepsBundle can share the same\n // cache entry when they pass the same inputFiles array.\n const resolvedWorkflowRuntime = await enhancedResolve(\n outdir,\n 'workflow/runtime'\n ).catch(() => undefined);\n const entryPoints = resolvedWorkflowRuntime\n ? [...inputs, resolvedWorkflowRuntime]\n : inputs;\n\n const effectiveTsconfigPath =\n tsconfigPath ?? (await this.findTsConfigPath());\n const esbuildTsconfigOptions = await getEsbuildTsconfigOptions(\n effectiveTsconfigPath\n );\n try {\n await esbuild.build({\n treeShaking: true,\n entryPoints,\n plugins: [\n createDiscoverEntriesPlugin(state, this.transformProjectRoot),\n ],\n platform: 'node',\n write: false,\n outdir,\n bundle: true,\n sourcemap: false,\n absWorkingDir: this.config.workingDir,\n logLevel: 'silent',\n ...esbuildTsconfigOptions,\n // External packages that should not be bundled during discovery\n external: this.config.externalPackages || [],\n });\n } catch (_) {}\n\n this.logBaseBuilderInfo(\n `Discovering workflow directives`,\n `${Date.now() - discoverStart}ms`\n );\n\n this.discoveredEntries.set(inputs, state);\n return state;\n }\n\n /**\n * Writes debug information to a JSON file for troubleshooting build issues.\n * Uses atomic write (temp file + rename) to prevent race conditions when\n * multiple builds run concurrently.\n */\n private async writeDebugFile(\n outfile: string,\n debugData: object,\n merge?: boolean\n ): Promise<void> {\n const prefix = this.config.debugFilePrefix || '';\n const targetPath = `${dirname(outfile)}/${prefix}${basename(outfile)}.debug.json`;\n let existing = {};\n\n try {\n if (merge) {\n try {\n const content = await readFile(targetPath, 'utf8');\n existing = JSON.parse(content);\n } catch (e) {\n // File doesn't exist yet or is corrupted - start fresh.\n // Don't log error for ENOENT (file not found) as that's expected on first run.\n if ((e as NodeJS.ErrnoException).code !== 'ENOENT') {\n console.warn('Error reading debug file, starting fresh:', e);\n }\n }\n }\n\n const mergedData = JSON.stringify(\n {\n ...existing,\n ...debugData,\n },\n null,\n 2\n );\n\n // Write atomically: write to temp file, then rename.\n // rename() is atomic on POSIX systems and provides best-effort atomicity on Windows.\n // Prevents race conditions where concurrent builds read partially-written files.\n const tempPath = `${targetPath}.${randomUUID()}.tmp`;\n await writeFile(tempPath, mergedData);\n await rename(tempPath, targetPath);\n } catch (error: unknown) {\n console.warn('Failed to write debug file:', error);\n }\n }\n\n /**\n * Logs and optionally throws on esbuild errors and warnings.\n * @param throwOnError - If true, throws an error when esbuild errors are present\n */\n private logEsbuildMessages(\n result: { errors?: any[]; warnings?: any[] },\n phase: string,\n throwOnError = true,\n options?: {\n suppressWarnings?: boolean;\n }\n ): void {\n if (result.errors && result.errors.length > 0) {\n console.error(`❌ esbuild errors in ${phase}:`);\n const errorMessages: string[] = [];\n for (const error of result.errors) {\n console.error(` ${error.text}`);\n errorMessages.push(error.text);\n if (error.location) {\n const location = ` at ${error.location.file}:${error.location.line}:${error.location.column}`;\n console.error(location);\n errorMessages.push(location);\n }\n }\n\n if (throwOnError) {\n throw new Error(\n `Build failed during ${phase}:\\n${errorMessages.join('\\n')}`\n );\n }\n }\n\n if (\n !options?.suppressWarnings &&\n result.warnings &&\n result.warnings.length > 0\n ) {\n console.warn(`! esbuild warnings in ${phase}:`);\n for (const warning of result.warnings) {\n console.warn(` ${warning.text}`);\n if (warning.location) {\n console.warn(\n ` at ${warning.location.file}:${warning.location.line}:${warning.location.column}`\n );\n }\n }\n }\n }\n\n /**\n * Converts an absolute file path to a normalized relative path for the manifest.\n */\n private getRelativeFilepath(absolutePath: string): string {\n const normalizedFile = absolutePath.replace(/\\\\/g, '/');\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n let relativePath = relative(normalizedWorkingDir, normalizedFile).replace(\n /\\\\/g,\n '/'\n );\n // Handle files discovered outside the working directory\n if (relativePath.startsWith('../')) {\n relativePath = relativePath\n .split('/')\n .filter((part) => part !== '..')\n .join('/');\n }\n return relativePath;\n }\n\n /**\n * Creates a bundle for workflow step functions.\n * Steps have full Node.js runtime access and handle side effects, API calls, etc.\n *\n * @param externalizeNonSteps - If true, only bundles step entry points and externalizes other code\n * @returns Build context (for watch mode) and the collected workflow manifest\n */\n protected async createStepsBundle({\n inputFiles,\n format = 'esm',\n outfile,\n externalizeNonSteps,\n rewriteTsExtensions,\n tsconfigPath,\n discoveredEntries,\n }: {\n tsconfigPath?: string;\n inputFiles: string[];\n outfile: string;\n format?: 'cjs' | 'esm';\n externalizeNonSteps?: boolean;\n rewriteTsExtensions?: boolean;\n discoveredEntries?: DiscoveredEntries;\n }): Promise<{\n context: esbuild.BuildContext | undefined;\n manifest: WorkflowManifest;\n }> {\n const stepsBundleStart = Date.now();\n const workflowManifest: WorkflowManifest = {};\n const builtInSteps = 'workflow/internal/builtins';\n\n const resolvedBuiltInSteps = await enhancedResolve(\n dirname(outfile),\n 'workflow/internal/builtins'\n ).catch((err) => {\n throw new Error(\n [\n chalk.red('Failed to resolve built-in steps sources.'),\n `${chalk.yellow.bold('hint:')} run \\`${chalk.cyan.italic('npm install workflow')}\\` to resolve this issue.`,\n '',\n `Caused by: ${chalk.red(String(err))}`,\n ].join('\\n')\n );\n });\n\n // Discovery of workflow/step/serde entries. The SDK runtime entry point\n // (workflow/runtime) is resolved inside discoverEntries() itself so that\n // callers can pass the original inputFiles reference and benefit from\n // WeakMap caching across createWorkflowsBundle / createStepsBundle calls.\n const discovered =\n discoveredEntries ??\n (await this.discoverEntries(inputFiles, dirname(outfile), tsconfigPath));\n const stepFiles = [...discovered.discoveredSteps].sort();\n const workflowFiles = [...discovered.discoveredWorkflows].sort();\n const serdeFiles = [...discovered.discoveredSerdeFiles].sort();\n\n // Include serde files that aren't already step files for cross-context class registration.\n // Classes need to be registered in the step bundle so they can be deserialized\n // when receiving data from workflows and serialized when returning data to workflows.\n const stepFilesSet = new Set(stepFiles);\n const serdeOnlyFiles = serdeFiles.filter((f) => !stepFilesSet.has(f));\n\n // log the step files for debugging\n await this.writeDebugFile(outfile, {\n stepFiles,\n workflowFiles,\n serdeOnlyFiles,\n });\n\n // Helper to create import statement from file path\n // For workspace/node_modules packages, uses the package name so esbuild\n // will resolve through package.json exports with the appropriate conditions\n const createImport = (file: string) => {\n const { importPath, isPackage } = getImportPath(\n file,\n this.config.workingDir\n );\n\n if (isPackage) {\n // Use package name - esbuild will resolve via package.json exports\n return `import '${importPath}';`;\n }\n\n // Local app file - use relative path\n // Normalize both paths to forward slashes before calling relative()\n // This is critical on Windows where relative() can produce unexpected results with mixed path formats\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n const normalizedFile = file.replace(/\\\\/g, '/');\n // Calculate relative path from working directory to the file\n let relativePath = relative(normalizedWorkingDir, normalizedFile).replace(\n /\\\\/g,\n '/'\n );\n // Ensure relative paths start with ./ so esbuild resolves them correctly.\n // Paths like \".output/...\" are not valid relative specifiers and must\n // become \"./.output/...\".\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `import '${relativePath}';`;\n };\n\n // Create a virtual entry that imports all files. All step definitions\n // will get registered thanks to the swc transform.\n const stepImports = stepFiles.map(createImport).join('\\n');\n\n // Include serde-only files for class registration side effects\n const serdeImports = serdeOnlyFiles.map(createImport).join('\\n');\n\n const entryContent = `\n // Built in steps\n import '${builtInSteps}';\n // User steps\n ${stepImports}\n // Serde files for cross-context class registration\n ${serdeImports}\n // API entrypoint\n export { stepEntrypoint as POST } from 'workflow/runtime';`;\n\n // Bundle with esbuild and our custom SWC plugin\n const entriesToBundle = externalizeNonSteps\n ? [\n ...stepFiles,\n ...serdeFiles,\n ...(resolvedBuiltInSteps ? [resolvedBuiltInSteps] : []),\n ]\n : undefined;\n const normalizedEntriesToBundle = entriesToBundle\n ? await withRealpaths(entriesToBundle)\n : undefined;\n const normalizedSideEffectEntries = await withRealpaths([\n ...stepFiles,\n ...serdeOnlyFiles,\n ...(resolvedBuiltInSteps ? [resolvedBuiltInSteps] : []),\n ]);\n const esbuildTsconfigOptions =\n await getEsbuildTsconfigOptions(tsconfigPath);\n const { banner: importMetaBanner, define: importMetaDefine } =\n this.getCjsImportMetaPolyfill(format);\n const esmRequireBanner = this.getEsmRequireBanner(format);\n\n const esbuildCtx = await esbuild.context({\n banner: {\n js: `// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n${importMetaBanner}${esmRequireBanner}`,\n },\n stdin: {\n contents: entryContent,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n outfile,\n absWorkingDir: this.config.workingDir,\n bundle: true,\n format,\n platform: 'node',\n conditions: ['node'],\n target: 'es2022',\n write: true,\n treeShaking: true,\n keepNames: true,\n minify: false,\n jsx: 'preserve',\n logLevel: 'error',\n // Use tsconfig for path alias resolution.\n // For symlinked configs this uses tsconfigRaw to preserve cwd-relative aliases.\n ...esbuildTsconfigOptions,\n define: importMetaDefine,\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n // Inline source maps for better stack traces in step execution.\n // Steps execute in Node.js context and inline sourcemaps ensure we get\n // meaningful stack traces with proper file names and line numbers when errors\n // occur in deeply nested function calls across multiple files.\n sourcemap: 'inline',\n plugins: [\n // Handle pseudo-packages like 'server-only' and 'client-only' by providing\n // empty modules. Must run first to intercept these before other resolution.\n createPseudoPackagePlugin(),\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: normalizedEntriesToBundle,\n outdir: outfile ? dirname(outfile) : undefined,\n projectRoot: this.transformProjectRoot,\n workflowManifest,\n rewriteTsExtensions,\n sideEffectEntries: normalizedSideEffectEntries,\n }),\n ],\n // Plugin should catch most things, but this lets users hard override\n // if the plugin misses anything that should be externalized\n external: ['bun', 'bun:*', ...(this.config.externalPackages || [])],\n });\n\n const stepsResult = await esbuildCtx.rebuild();\n\n this.logEsbuildMessages(stepsResult, 'steps bundle creation');\n this.logBaseBuilderInfo(\n 'Created steps bundle',\n `${Date.now() - stepsBundleStart}ms`\n );\n\n // Handle workflow-only files that may have been tree-shaken from the bundle.\n // These files have no steps, so esbuild removes them, but we still need their\n // workflow metadata for the manifest. Transform them separately.\n const workflowOnlyFiles = workflowFiles.filter(\n (f) => !stepFiles.includes(f)\n );\n await Promise.all(\n workflowOnlyFiles.map(async (workflowFile) => {\n try {\n const source = await readFile(workflowFile, 'utf8');\n const relativeFilepath = this.getRelativeFilepath(workflowFile);\n const { workflowManifest: fileManifest } = await applySwcTransform(\n relativeFilepath,\n source,\n 'workflow',\n workflowFile,\n this.transformProjectRoot\n );\n if (fileManifest.workflows) {\n workflowManifest.workflows = Object.assign(\n workflowManifest.workflows || {},\n fileManifest.workflows\n );\n }\n if (fileManifest.classes) {\n workflowManifest.classes = Object.assign(\n workflowManifest.classes || {},\n fileManifest.classes\n );\n }\n } catch (error) {\n // Log warning but continue - don't fail build for workflow-only file issues\n console.warn(\n `Warning: Failed to extract workflow metadata from ${workflowFile}:`,\n error instanceof Error ? error.message : String(error)\n );\n }\n })\n );\n\n // Create .gitignore in .swc directory\n await this.createSwcGitignore();\n\n if (this.config.watch) {\n return { context: esbuildCtx, manifest: workflowManifest };\n }\n await esbuildCtx.dispose();\n return { context: undefined, manifest: workflowManifest };\n }\n\n /**\n * Creates a bundle for workflow orchestration functions.\n * Workflows run in a sandboxed VM and coordinate step execution.\n *\n * @param bundleFinalOutput - If false, skips the final bundling step (used by Next.js)\n */\n protected async createWorkflowsBundle({\n inputFiles,\n format = 'esm',\n outfile,\n bundleFinalOutput = true,\n keepInterimBundleContext = this.config.watch,\n tsconfigPath,\n discoveredEntries,\n }: {\n tsconfigPath?: string;\n inputFiles: string[];\n outfile: string;\n format?: 'cjs' | 'esm';\n bundleFinalOutput?: boolean;\n keepInterimBundleContext?: boolean;\n discoveredEntries?: DiscoveredEntries;\n }): Promise<{\n manifest: WorkflowManifest;\n interimBundleCtx?: esbuild.BuildContext;\n bundleFinal?: (interimBundleResult: string) => Promise<void>;\n }> {\n const discovered =\n discoveredEntries ??\n (await this.discoverEntries(inputFiles, dirname(outfile), tsconfigPath));\n const workflowFiles = [...discovered.discoveredWorkflows].sort();\n const serdeFiles = [...discovered.discoveredSerdeFiles].sort();\n\n // Include serde files that aren't already workflow files for cross-context class registration.\n // Classes need to be registered in the workflow bundle so they can be deserialized\n // when receiving data from steps or when serializing data to send to steps.\n const workflowFilesSet = new Set(workflowFiles);\n const serdeOnlyFiles = serdeFiles.filter((f) => !workflowFilesSet.has(f));\n\n // log the workflow files for debugging\n await this.writeDebugFile(outfile, { workflowFiles, serdeOnlyFiles });\n\n // Helper to create import statement from file path\n // For packages, uses the package name so esbuild will resolve through\n // package.json exports with conditions: ['workflow']\n const createImport = (file: string) => {\n const { importPath, isPackage } = getImportPath(\n file,\n this.config.workingDir\n );\n\n if (isPackage) {\n // Use package name - esbuild will resolve via package.json exports\n // and apply the 'workflow' condition\n return `import '${importPath}';`;\n }\n\n // Local app file - use relative path\n // Normalize both paths to forward slashes before calling relative()\n // This is critical on Windows where relative() can produce unexpected results with mixed path formats\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n const normalizedFile = file.replace(/\\\\/g, '/');\n // Calculate relative path from working directory to the file\n let relativePath = relative(normalizedWorkingDir, normalizedFile).replace(\n /\\\\/g,\n '/'\n );\n // Ensure relative paths start with ./ so esbuild resolves them correctly.\n // Paths like \".output/...\" are not valid relative specifiers and must\n // become \"./.output/...\".\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `import '${relativePath}';`;\n };\n\n // Create a virtual entry that imports all workflow files\n // The SWC plugin in workflow mode emits `globalThis.__private_workflows.set(workflowId, fn)`\n // calls directly, so we just need to import the files (Map is initialized via banner)\n const workflowImports = workflowFiles.map(createImport).join('\\n');\n\n // Include serde-only files for class registration side effects\n const serdeImports = serdeOnlyFiles.map(createImport).join('\\n');\n\n const imports = serdeImports\n ? `${workflowImports}\\n// Serde files for cross-context class registration\\n${serdeImports}`\n : workflowImports;\n\n const bundleStartTime = Date.now();\n const workflowManifest: WorkflowManifest = {};\n const esbuildTsconfigOptions =\n await getEsbuildTsconfigOptions(tsconfigPath);\n const normalizedWorkflowSideEffectEntries = await withRealpaths([\n ...workflowFiles,\n ...serdeOnlyFiles,\n ]);\n\n // Bundle with esbuild and our custom SWC plugin in workflow mode.\n // this bundle will be run inside a vm isolate\n const interimBundleCtx = await esbuild.context({\n stdin: {\n contents: imports,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n bundle: true,\n absWorkingDir: this.config.workingDir,\n format: 'cjs', // Runs inside the VM which expects cjs\n platform: 'neutral', // The platform is neither node nor browser\n mainFields: ['module', 'main'], // To support npm style imports\n conditions: ['workflow'], // Allow packages to export 'workflow' compliant versions\n target: 'es2022',\n write: false,\n treeShaking: true,\n keepNames: true,\n minify: false,\n // Initialize the workflow registry at the very top of the bundle\n // This must be in banner (not the virtual entry) because esbuild's bundling\n // can reorder code, and the .set() calls need the Map to exist first\n banner: {\n js: 'globalThis.__private_workflows = new Map();',\n },\n // Inline source maps for better stack traces in workflow VM execution.\n // This intermediate bundle is executed via runInContext() in a VM, so we need\n // inline source maps to get meaningful stack traces instead of \"evalmachine.<anonymous>\".\n sourcemap: 'inline',\n // Use tsconfig for path alias resolution.\n // For symlinked configs this uses tsconfigRaw to preserve cwd-relative aliases.\n ...esbuildTsconfigOptions,\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n plugins: [\n // Handle pseudo-packages like 'server-only' and 'client-only' by providing\n // empty modules. Must run first to intercept these before other resolution.\n createPseudoPackagePlugin(),\n createSwcPlugin({\n mode: 'workflow',\n projectRoot: this.transformProjectRoot,\n workflowManifest,\n sideEffectEntries: normalizedWorkflowSideEffectEntries,\n }),\n // This plugin must run after the swc plugin to ensure dead code elimination\n // happens first, preventing false positives on Node.js imports in unused code paths\n createNodeModuleErrorPlugin(),\n ],\n // NOTE: We intentionally do NOT use the external option here for workflow bundles.\n // When packages are marked external with format: 'cjs', esbuild generates require() calls.\n // However, the workflow VM (vm.runInContext) does not have require() defined - it only\n // provides module.exports and exports. External packages would fail at runtime with:\n // ReferenceError: require is not defined\n // Instead, we bundle everything and rely on:\n // - createPseudoPackagePlugin() to handle server-only/client-only with empty modules\n // - createNodeModuleErrorPlugin() to catch Node.js builtin imports at build time\n });\n let shouldDisposeInterimBundleCtx = !keepInterimBundleContext;\n try {\n const interimBundle = await interimBundleCtx.rebuild();\n\n this.logEsbuildMessages(\n interimBundle,\n 'intermediate workflow bundle',\n true,\n {\n suppressWarnings: this.config.suppressCreateWorkflowsBundleWarnings,\n }\n );\n this.logCreateWorkflowsBundleInfo(\n 'Created intermediate workflow bundle',\n `${Date.now() - bundleStartTime}ms`\n );\n\n if (this.config.workflowManifestPath) {\n const resolvedPath = resolve(\n process.cwd(),\n this.config.workflowManifestPath\n );\n let prefix = '';\n\n if (resolvedPath.endsWith('.cjs')) {\n prefix = 'module.exports = ';\n } else if (\n resolvedPath.endsWith('.js') ||\n resolvedPath.endsWith('.mjs')\n ) {\n prefix = 'export default ';\n }\n\n await mkdir(dirname(resolvedPath), { recursive: true });\n await writeFile(\n resolvedPath,\n prefix + JSON.stringify(workflowManifest, null, 2)\n );\n }\n\n // Create .gitignore in .swc directory\n await this.createSwcGitignore();\n\n if (\n !interimBundle.outputFiles ||\n interimBundle.outputFiles.length === 0\n ) {\n throw new Error('No output files generated from esbuild');\n }\n\n // Serde compliance warnings: check if workflow bundle has Node.js imports\n // alongside serde-registered classes (these will fail at runtime in the sandbox)\n if (\n workflowManifest.classes &&\n Object.keys(workflowManifest.classes).length > 0\n ) {\n const { analyzeSerdeCompliance } = await import('./serde-checker.js');\n const bundleText = interimBundle.outputFiles[0].text;\n const serdeResult = analyzeSerdeCompliance({\n sourceCode: '',\n workflowCode: bundleText,\n manifest: workflowManifest,\n });\n // De-dupe warnings: group identical issues across classes\n const issuesToClasses = new Map<string, Set<string>>();\n for (const cls of serdeResult.classes) {\n if (!cls.compliant) {\n for (const issue of cls.issues) {\n let affectedClasses = issuesToClasses.get(issue);\n if (!affectedClasses) {\n affectedClasses = new Set<string>();\n issuesToClasses.set(issue, affectedClasses);\n }\n affectedClasses.add(cls.className);\n }\n }\n }\n for (const [issue, affectedClasses] of issuesToClasses) {\n const classNames = [...affectedClasses];\n const classLabel =\n classNames.length === 1\n ? `class \"${classNames[0]}\"`\n : `classes ${classNames.map((name) => `\"${name}\"`).join(', ')}`;\n console.warn(\n chalk.yellow(`⚠ Serde warning for ${classLabel}: `) + issue\n );\n }\n }\n\n const bundleFinal = async (interimBundle: string) => {\n const workflowBundleCode = interimBundle;\n\n const workflowFunctionCode = `// biome-ignore-all lint: generated file\n/* eslint-disable */\nimport { workflowEntrypoint } from 'workflow/runtime';\n\nconst workflowCode = \\`${workflowBundleCode.replace(/[\\\\`$]/g, '\\\\$&')}\\`;\n\nexport const POST = workflowEntrypoint(workflowCode);`;\n\n // we skip the final bundling step for Next.js so it can bundle itself\n if (!bundleFinalOutput) {\n if (!outfile) {\n throw new Error(`Invariant: missing outfile for workflow bundle`);\n }\n // Ensure the output directory exists\n const outputDir = dirname(outfile);\n await mkdir(outputDir, { recursive: true });\n\n // Atomic write: write to temp file then rename to prevent\n // file watchers from reading partial file during write\n const tempPath = `${outfile}.${randomUUID()}.tmp`;\n await writeFile(tempPath, workflowFunctionCode);\n await rename(tempPath, outfile);\n return;\n }\n\n const bundleStartTime = Date.now();\n\n // Now bundle this so we can resolve the @workflow/core dependency\n // we could remove this if we do nft tracing or similar instead\n const finalEsmRequireBanner = this.getEsmRequireBanner(format);\n const finalWorkflowResult = await esbuild.build({\n banner: {\n js: `// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n${finalEsmRequireBanner}`,\n },\n stdin: {\n contents: workflowFunctionCode,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n outfile,\n // Source maps for the final workflow bundle wrapper (not important since this code\n // doesn't run in the VM - only the intermediate bundle sourcemap is relevant)\n sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,\n absWorkingDir: this.config.workingDir,\n bundle: true,\n format,\n platform: 'node',\n target: 'es2022',\n write: true,\n keepNames: true,\n minify: false,\n external: ['@aws-sdk/credential-provider-web-identity'],\n });\n\n this.logEsbuildMessages(\n finalWorkflowResult,\n 'final workflow bundle',\n true,\n {\n suppressWarnings: this.config.suppressCreateWorkflowsBundleWarnings,\n }\n );\n this.logCreateWorkflowsBundleInfo(\n 'Created final workflow bundle',\n `${Date.now() - bundleStartTime}ms`\n );\n };\n await bundleFinal(interimBundle.outputFiles[0].text);\n\n if (keepInterimBundleContext) {\n shouldDisposeInterimBundleCtx = false;\n return {\n manifest: workflowManifest,\n interimBundleCtx,\n bundleFinal,\n };\n }\n return { manifest: workflowManifest };\n } catch (error) {\n shouldDisposeInterimBundleCtx = true;\n throw error;\n } finally {\n if (shouldDisposeInterimBundleCtx) {\n try {\n await interimBundleCtx.dispose();\n } catch (disposeError) {\n console.warn(\n 'Warning: Failed to dispose workflow bundle context',\n disposeError\n );\n }\n }\n }\n }\n\n /**\n * Creates a client library bundle for workflow execution.\n * The client library allows importing and calling workflows from application code.\n * Only generated if clientBundlePath is specified in config.\n */\n protected async createClientLibrary(): Promise<void> {\n if (!this.config.clientBundlePath) {\n // Silently exit since no client bundle was requested\n return;\n }\n\n this.logBaseBuilderInfo(\n 'Generating a client library at',\n this.config.clientBundlePath\n );\n this.logBaseBuilderInfo(\n 'NOTE: The recommended way to use workflow with a framework like NextJS is using the loader/plugin with webpack/turbobpack/rollup'\n );\n\n // Ensure we have the directory for the client bundle\n const outputDir = dirname(this.config.clientBundlePath);\n await mkdir(outputDir, { recursive: true });\n\n const inputFiles = await this.getInputFiles();\n\n // Discover serde files from the input files' dependency tree for cross-context class registration.\n // Classes need to be registered in the client bundle so they can be serialized\n // when passing data to workflows via start() and deserialized when receiving workflow results.\n const { discoveredSerdeFiles } = await this.discoverEntries(\n inputFiles,\n outputDir\n );\n\n // Identify serde files that aren't in the inputFiles (deduplicated)\n const inputFilesNormalized = new Set(\n inputFiles.map((f) => f.replace(/\\\\/g, '/'))\n );\n const serdeOnlyFiles = [...discoveredSerdeFiles].filter(\n (f) => !inputFilesNormalized.has(f)\n );\n\n // Re-exports for input files (user's workflow/step definitions).\n // These must use valid relative specifiers because some frameworks pass\n // generated files like \".output/server/index.mjs\" as input files.\n const reexports = inputFiles\n .map((file) => {\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n let relativePath = relative(normalizedWorkingDir, file).replace(\n /\\\\/g,\n '/'\n );\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `export * from '${relativePath}';`;\n })\n .join('\\n');\n\n // Side-effect imports for serde files not in inputFiles (for class registration)\n const serdeImports = serdeOnlyFiles\n .map((file) => {\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n let relativePath = relative(normalizedWorkingDir, file).replace(\n /\\\\/g,\n '/'\n );\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `import '${relativePath}';`;\n })\n .join('\\n');\n\n // Combine: serde imports (for registration side effects) + re-exports\n const entryContent = serdeImports\n ? `// Serde files for cross-context class registration\\n${serdeImports}\\n${reexports}`\n : reexports;\n\n // Bundle with esbuild and our custom SWC plugin\n const normalizedClientSideEffectEntries = await withRealpaths([\n ...inputFiles,\n ...serdeOnlyFiles,\n ]);\n const clientResult = await esbuild.build({\n banner: {\n js: '// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n',\n },\n stdin: {\n contents: entryContent,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n outfile: this.config.clientBundlePath,\n bundle: true,\n format: 'esm',\n platform: 'node',\n jsx: 'preserve',\n target: 'es2022',\n write: true,\n treeShaking: true,\n external: ['@workflow/core'],\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n plugins: [\n createSwcPlugin({\n mode: 'step',\n projectRoot: this.transformProjectRoot,\n sideEffectEntries: normalizedClientSideEffectEntries,\n }),\n ],\n });\n\n this.logEsbuildMessages(clientResult, 'client library bundle');\n\n // Create .gitignore in .swc directory\n await this.createSwcGitignore();\n }\n\n /**\n * Creates a webhook handler bundle for resuming workflows via HTTP callbacks.\n *\n * @param bundle - If true, bundles dependencies (needed for Build Output API)\n */\n protected async createWebhookBundle({\n outfile,\n bundle = false,\n }: {\n outfile: string;\n bundle?: boolean;\n }): Promise<void> {\n this.logCreateWebhookBundleInfo('Creating webhook route');\n await mkdir(dirname(outfile), { recursive: true });\n\n // Create a static route that calls resumeWebhook\n // This route works for both Next.js and Vercel Build Output API\n const routeContent = `import { resumeWebhook } from 'workflow/api';\n\nasync function handler(request) {\n const url = new URL(request.url);\n // Extract token from pathname: /.well-known/workflow/v1/webhook/{token}\n const pathParts = url.pathname.split('/');\n const token = decodeURIComponent(pathParts[pathParts.length - 1]);\n\n if (!token) {\n return new Response('Missing token', { status: 400 });\n }\n\n try {\n const response = await resumeWebhook(token, request);\n return response;\n } catch (error) {\n // TODO: differentiate between invalid token and other errors\n console.error('Error during resumeWebhook', error);\n return new Response(null, { status: 404 });\n }\n}\n\nexport const GET = handler;\nexport const POST = handler;\nexport const PUT = handler;\nexport const PATCH = handler;\nexport const DELETE = handler;\nexport const HEAD = handler;\nexport const OPTIONS = handler;`;\n\n if (!bundle) {\n // For Next.js, just write the unbundled file\n await writeFile(outfile, routeContent);\n return;\n }\n\n // For Build Output API, bundle with esbuild to resolve imports\n\n const webhookEsmRequireBanner = this.getEsmRequireBanner('esm');\n const webhookBundleStart = Date.now();\n const result = await esbuild.build({\n banner: {\n js: `// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n${webhookEsmRequireBanner}`,\n },\n stdin: {\n contents: routeContent,\n resolveDir: this.config.workingDir,\n sourcefile: 'webhook-route.js',\n loader: 'js',\n },\n outfile,\n absWorkingDir: this.config.workingDir,\n bundle: true,\n jsx: 'preserve',\n format: 'esm',\n platform: 'node',\n conditions: ['import', 'module', 'node', 'default'],\n target: 'es2022',\n write: true,\n treeShaking: true,\n keepNames: true,\n minify: false,\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,\n mainFields: ['module', 'main'],\n // Don't externalize anything - bundle everything including workflow packages\n external: [],\n });\n\n this.logEsbuildMessages(result, 'webhook bundle creation');\n this.logCreateWebhookBundleInfo(\n 'Created webhook bundle',\n `${Date.now() - webhookBundleStart}ms`\n );\n }\n\n /**\n * Creates a package.json file with the specified module type.\n */\n protected async createPackageJson(\n dir: string,\n type: 'commonjs' | 'module'\n ): Promise<void> {\n const packageJson = { type };\n await writeFile(\n join(dir, 'package.json'),\n JSON.stringify(packageJson, null, 2)\n );\n }\n\n /**\n * Creates a .vc-config.json file for Vercel Build Output API functions.\n */\n protected async createVcConfig(\n dir: string,\n config: {\n runtime?: string;\n handler?: string;\n launcherType?: string;\n architecture?: string;\n shouldAddHelpers?: boolean;\n shouldAddSourcemapSupport?: boolean;\n maxDuration?: number | 'max';\n experimentalTriggers?: Array<{\n type: 'queue/v2beta';\n topic: string;\n consumer: string;\n maxDeliveries?: number;\n retryAfterSeconds?: number;\n initialDelaySeconds?: number;\n }>;\n }\n ): Promise<void> {\n const vcConfig = {\n runtime: config.runtime ?? 'nodejs22.x',\n handler: config.handler ?? 'index.mjs',\n launcherType: config.launcherType ?? 'Nodejs',\n architecture: config.architecture ?? 'arm64',\n shouldAddHelpers: config.shouldAddHelpers ?? true,\n ...(config.maxDuration !== undefined && {\n maxDuration: config.maxDuration,\n }),\n ...(config.shouldAddSourcemapSupport !== undefined && {\n shouldAddSourcemapSupport: config.shouldAddSourcemapSupport,\n }),\n ...(config.experimentalTriggers && {\n experimentalTriggers: config.experimentalTriggers,\n }),\n };\n\n await writeFile(\n join(dir, '.vc-config.json'),\n JSON.stringify(vcConfig, null, 2)\n );\n }\n\n /**\n * Resolves a path relative to the working directory.\n */\n protected resolvePath(path: string): string {\n return resolve(this.config.workingDir, path);\n }\n\n /**\n * Ensures the directory for a file path exists, creating it if necessary.\n */\n protected async ensureDirectory(filePath: string): Promise<void> {\n await mkdir(dirname(filePath), { recursive: true });\n }\n\n private async createSwcGitignore(): Promise<void> {\n try {\n await writeFile(\n join(this.config.workingDir, '.swc', '.gitignore'),\n '*\\n'\n );\n } catch {\n // We're intentionally silently ignoring this error - creating .gitignore isn't critical\n }\n }\n\n /**\n * Whether the manifest should be exposed as a public HTTP route.\n * Controlled by the `WORKFLOW_PUBLIC_MANIFEST` environment variable.\n */\n protected get shouldExposePublicManifest(): boolean {\n return process.env.WORKFLOW_PUBLIC_MANIFEST === '1';\n }\n\n /**\n * Resolves the workflow manifest diagnostics path, when this builder should\n * emit one.\n */\n protected getDiagnosticsManifestPath(): string | undefined {\n if (this.config.diagnosticsDir) {\n return resolve(\n this.config.workingDir,\n this.config.diagnosticsDir,\n 'workflows-manifest.json'\n );\n }\n\n if (this.config.buildTarget === 'vercel-build-output-api') {\n return this.resolvePath(\n '.vercel/output/diagnostics/workflows-manifest.json'\n );\n }\n }\n\n /**\n * Creates a manifest JSON file containing step/workflow/class metadata\n * and graph data for visualization.\n *\n * @returns The manifest JSON string, or undefined if manifest creation failed.\n */\n protected async createManifest({\n workflowBundlePath,\n manifestDir,\n manifest,\n }: {\n workflowBundlePath: string;\n manifestDir: string;\n manifest: WorkflowManifest;\n }): Promise<string | undefined> {\n const buildStart = Date.now();\n this.logCreateManifestInfo('Creating manifest...');\n\n try {\n const workflowGraphs = await extractWorkflowGraphs(workflowBundlePath);\n\n const steps = this.convertStepsManifest(manifest.steps);\n const workflows = this.convertWorkflowsManifest(\n manifest.workflows,\n workflowGraphs\n );\n const classes = this.convertClassesManifest(manifest.classes);\n\n const output = { version: '1.0.0', steps, workflows, classes };\n const manifestJson = JSON.stringify(output, null, 2);\n\n await mkdir(manifestDir, { recursive: true });\n await writeFile(join(manifestDir, 'manifest.json'), manifestJson);\n\n const diagnosticsManifestPath = this.getDiagnosticsManifestPath();\n if (diagnosticsManifestPath) {\n await this.ensureDirectory(diagnosticsManifestPath);\n await writeFile(diagnosticsManifestPath, manifestJson);\n }\n\n const stepCount = Object.values(steps).reduce(\n (acc, s) => acc + Object.keys(s).length,\n 0\n );\n const workflowCount = Object.values(workflows).reduce(\n (acc, w) => acc + Object.keys(w).length,\n 0\n );\n const classCount = Object.values(classes).reduce(\n (acc, c) => acc + Object.keys(c).length,\n 0\n );\n\n this.logCreateManifestInfo(\n `Created manifest with ${stepCount} ${pluralize('step', 'steps', stepCount)}, ${workflowCount} ${pluralize('workflow', 'workflows', workflowCount)}, and ${classCount} ${pluralize('class', 'classes', classCount)}`,\n `${Date.now() - buildStart}ms`\n );\n\n return manifestJson;\n } catch (error) {\n console.warn(\n 'Failed to create manifest:',\n error instanceof Error ? error.message : String(error)\n );\n return undefined;\n }\n }\n\n private convertStepsManifest(\n steps: WorkflowManifest['steps']\n ): Record<string, Record<string, { stepId: string }>> {\n const result: Record<string, Record<string, { stepId: string }>> = {};\n if (!steps) return result;\n\n for (const [filePath, entries] of Object.entries(steps)) {\n result[filePath] = {};\n for (const [name, data] of Object.entries(entries)) {\n result[filePath][name] = { stepId: data.stepId };\n }\n }\n return result;\n }\n\n private convertWorkflowsManifest(\n workflows: WorkflowManifest['workflows'],\n graphs: Record<\n string,\n Record<string, { graph: { nodes: any[]; edges: any[] } }>\n >\n ): Record<\n string,\n Record<\n string,\n { workflowId: string; graph: { nodes: any[]; edges: any[] } }\n >\n > {\n const result: Record<\n string,\n Record<\n string,\n { workflowId: string; graph: { nodes: any[]; edges: any[] } }\n >\n > = {};\n if (!workflows) return result;\n\n // Build a normalized lookup for graphs since the graph extractor uses\n // paths from workflowId (e.g. \"./workflows/hello-agent\") while the\n // manifest uses source file paths (e.g. \"workflows/hello-agent.ts\").\n // Normalize by stripping leading \"./\" and file extensions.\n const normalizedGraphs = new Map<\n string,\n Record<string, { graph: { nodes: any[]; edges: any[] } }>\n >();\n for (const [graphPath, graphEntries] of Object.entries(graphs)) {\n const normalized = graphPath\n .replace(/^\\.\\//, '')\n .replace(/\\.[^/.]+$/, '');\n normalizedGraphs.set(normalized, graphEntries);\n }\n\n for (const [filePath, entries] of Object.entries(workflows)) {\n result[filePath] = {};\n // Normalize the manifest file path for lookup\n const normalizedFilePath = filePath\n .replace(/^\\.\\//, '')\n .replace(/\\.[^/.]+$/, '');\n\n const graphEntries =\n graphs[filePath] || normalizedGraphs.get(normalizedFilePath);\n\n for (const [name, data] of Object.entries(entries)) {\n result[filePath][name] = {\n workflowId: data.workflowId,\n graph: graphEntries?.[name]?.graph || { nodes: [], edges: [] },\n };\n }\n }\n return result;\n }\n\n private convertClassesManifest(\n classes: WorkflowManifest['classes']\n ): Record<string, Record<string, { classId: string }>> {\n const result: Record<string, Record<string, { classId: string }>> = {};\n if (!classes) return result;\n\n for (const [filePath, entries] of Object.entries(classes)) {\n result[filePath] = {};\n for (const [name, data] of Object.entries(entries)) {\n result[filePath][name] = { classId: data.classId };\n }\n }\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-builder.js","sourceRoot":"","sources":["../src/base-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,uBAAuB,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EACL,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC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EAAE,EAAE,EAAE;iBAC/D,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,sBAAsB,CAC5B,OAAoC;QAEpC,MAAM,MAAM,GAAwD,EAAE,CAAC;QACvE,IAAI,CAAC,OAAO;YAAE,OAAO,MAAM,CAAC;QAE5B,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1D,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;YACtB,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnD,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;YACrD,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { mkdir, readFile, realpath, rename, writeFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { basename, dirname, join, relative, resolve } from 'node:path';\nimport { promisify } from 'node:util';\nimport { WorkflowBuildError } from '@workflow/errors';\nimport { pluralize } from '@workflow/utils';\nimport chalk from 'chalk';\nimport enhancedResolveOriginal from 'enhanced-resolve';\nimport * as esbuild from 'esbuild';\nimport { findUp } from 'find-up';\nimport { glob } from 'tinyglobby';\nimport {\n applySwcTransform,\n type WorkflowManifest,\n} from './apply-swc-transform.js';\nimport { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';\nimport { getEsbuildTsconfigOptions } from './esbuild-tsconfig.js';\nimport { getImportPath } from './module-specifier.js';\nimport { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';\nimport { createPseudoPackagePlugin } from './pseudo-package-esbuild-plugin.js';\nimport { createSwcPlugin } from './swc-esbuild-plugin.js';\nimport { detectWorkflowPatterns } from './transform-utils.js';\nimport type { SourcemapMode, WorkflowConfig } from './types.js';\nimport { extractWorkflowGraphs } from './workflows-extractor.js';\n\nconst enhancedResolve = promisify(enhancedResolveOriginal);\nconst require = createRequire(import.meta.url);\n\n/**\n * Legacy opt-in for source maps on the final workflow wrapper + webhook\n * bundles (which default to off, unlike the step/interim workflow bundles\n * that default to inline). Superseded by the `sourcemap` config option and\n * the `WORKFLOW_SOURCEMAP` environment variable; kept for back-compat.\n */\nconst EMIT_SOURCEMAPS_FOR_DEBUGGING =\n process.env.WORKFLOW_EMIT_SOURCEMAPS_FOR_DEBUGGING === '1';\n\nconst VALID_SOURCEMAP_STRINGS = new Set([\n 'inline',\n 'linked',\n 'external',\n 'both',\n]);\n\n/**\n * Parse the value of the `WORKFLOW_SOURCEMAP` environment variable into a\n * `SourcemapMode`. Returns `undefined` if the env var is unset, empty, or\n * unrecognized (a warning is emitted for unrecognized values).\n */\nfunction parseSourcemapEnv(\n value: string | undefined\n): SourcemapMode | undefined {\n if (value === undefined || value === '') return undefined;\n switch (value) {\n case '0':\n case 'false':\n return false;\n case '1':\n case 'true':\n return true;\n default:\n if (VALID_SOURCEMAP_STRINGS.has(value)) {\n return value as SourcemapMode;\n }\n console.warn(\n `Ignoring unrecognized WORKFLOW_SOURCEMAP=${value}. ` +\n `Expected one of: true, false, 0, 1, inline, linked, external, both.`\n );\n return undefined;\n }\n}\n\n/**\n * Normalize an array of file paths by appending the `realpath()` of each entry\n * (to handle symlinks, e.g. pnpm/workspace layouts) and deduplicating.\n */\nasync function withRealpaths(entries: string[]): Promise<string[]> {\n return Array.from(\n new Set(\n (\n await Promise.all(\n entries.map(async (entry) => {\n const resolved = await realpath(entry).catch(() => undefined);\n return resolved ? [entry, resolved] : [entry];\n })\n )\n ).flat()\n )\n );\n}\n\nexport interface DiscoveredEntries {\n discoveredSteps: Set<string>;\n discoveredWorkflows: Set<string>;\n discoveredSerdeFiles: Set<string>;\n}\n\n/**\n * Base class for workflow builders. Provides common build logic for transforming\n * workflow source files into deployable bundles using esbuild and SWC.\n *\n * Subclasses must implement the build() method to define builder-specific logic.\n */\nexport abstract class BaseBuilder {\n protected config: WorkflowConfig;\n\n /**\n * Tracks which external packages have already been warned about\n * to avoid duplicate warnings across multiple discoverEntries() calls.\n */\n private warnedExternalPackages = new Set<string>();\n\n constructor(config: WorkflowConfig) {\n this.config = config;\n }\n\n protected get transformProjectRoot(): string {\n return this.config.projectRoot || this.config.workingDir;\n }\n\n /**\n * Whether informational BaseBuilder logs should be printed.\n * Subclasses can override this to silence progress logs while keeping warnings/errors.\n */\n protected get shouldLogBaseBuilderInfo(): boolean {\n return true;\n }\n\n protected logBaseBuilderInfo(...args: unknown[]): void {\n if (this.shouldLogBaseBuilderInfo) {\n console.log(...args);\n }\n }\n\n private logCreateWorkflowsBundleInfo(...args: unknown[]): void {\n if (!this.config.suppressCreateWorkflowsBundleLogs) {\n this.logBaseBuilderInfo(...args);\n }\n }\n\n private logCreateWebhookBundleInfo(...args: unknown[]): void {\n if (!this.config.suppressCreateWebhookBundleLogs) {\n this.logBaseBuilderInfo(...args);\n }\n }\n\n private logCreateManifestInfo(...args: unknown[]): void {\n if (!this.config.suppressCreateManifestLogs) {\n this.logBaseBuilderInfo(...args);\n }\n }\n\n /**\n * When outputting CJS, esbuild replaces `import.meta` with an empty object,\n * making `import.meta.url` (and `import.meta.resolve`) undefined. This method\n * returns banner code and `define` entries that polyfill them using CJS\n * equivalents (`__filename`, `require.resolve`) so user code (e.g. Prisma)\n * that relies on `import.meta.url` works correctly in bundled CJS output.\n */\n private getCjsImportMetaPolyfill(format: string): {\n banner: string;\n define: Record<string, string>;\n } {\n if (format !== 'cjs') return { banner: '', define: {} };\n return {\n banner:\n 'var __import_meta_url = typeof __filename !== \"undefined\" ? require(\"url\").pathToFileURL(__filename).href : undefined;\\n' +\n 'var __import_meta_resolve = typeof require !== \"undefined\" && typeof __filename !== \"undefined\" ' +\n '? (s) => require(\"url\").pathToFileURL(require.resolve(s)).href : undefined;\\n',\n define: {\n 'import.meta.url': '__import_meta_url',\n 'import.meta.resolve': '__import_meta_resolve',\n },\n };\n }\n\n /**\n * When outputting fully-bundled ESM, CJS dependencies that call require()\n * for Node.js builtins (e.g. debug → require('tty')) break because esbuild's\n * CJS-to-ESM __require shim doesn't have access to a real require function.\n * This banner provides one via createRequire so bundled CJS code works in ESM.\n */\n private getEsmRequireBanner(format: string): string {\n if (format !== 'esm') return '';\n return 'import { createRequire as __createRequire } from \"node:module\";\\nvar require = __createRequire(import.meta.url);\\n';\n }\n\n /**\n * Performs the complete build process for workflows.\n * Subclasses must implement this to define their specific build steps.\n */\n abstract build(): Promise<void>;\n\n /**\n * Finds tsconfig.json/jsconfig.json for the project.\n * Used by esbuild to properly resolve module imports during bundling.\n */\n protected async findTsConfigPath(): Promise<string | undefined> {\n const cwd = this.config.workingDir || process.cwd();\n return findUp(['tsconfig.json', 'jsconfig.json'], { cwd });\n }\n\n /**\n * Discovers all source files in the configured directories.\n * Searches for TypeScript and JavaScript files while excluding common build\n * and dependency directories.\n */\n protected async getInputFiles(): Promise<string[]> {\n const ignore = [\n '**/node_modules/**',\n '**/.git/**',\n '**/.next/**',\n '**/.nuxt/**',\n '**/.output/**',\n '**/.vercel/**',\n '**/.workflow-data/**',\n '**/.workflow-vitest/**',\n '**/.well-known/workflow/**',\n '**/.svelte-kit/**',\n '**/.turbo/**',\n '**/.cache/**',\n '**/.yarn/**',\n '**/.pnpm-store/**',\n ];\n\n // Use relative patterns with `cwd` per directory so that `dot: true`\n // applies consistently to both the search pattern *and* the ignore\n // patterns. When absolute patterns are used with tinyglobby, the `**`\n // in ignore patterns does not match dot-prefixed path segments.\n const results = await Promise.all(\n this.config.dirs.map((dir) => {\n const cwd = resolve(this.config.workingDir, dir);\n return glob(['**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}'], {\n cwd,\n ignore,\n absolute: true,\n dot: true,\n });\n })\n );\n\n return results.flat();\n }\n\n /**\n * Caches discovered workflow entries by input array reference.\n * Uses WeakMap to allow garbage collection when input arrays are no longer referenced.\n * This cache is invalidated automatically when the inputs array reference changes\n * (e.g., when files are added/removed during watch mode).\n */\n private discoveredEntries: WeakMap<string[], DiscoveredEntries> =\n new WeakMap();\n\n /**\n * Pseudo-packages that should not be checked for workflow patterns.\n */\n private static readonly PSEUDO_PACKAGES = new Set([\n 'server-only',\n 'client-only',\n ]);\n\n /**\n * Checks each package in externalPackages for workflow patterns and emits\n * warnings if any contain \"use step\", \"use workflow\" directives, or\n * serialization classes. These patterns will not be transformed by the\n * workflow compiler when the package is externalized.\n */\n private async warnAboutExternalWorkflowPackages(): Promise<void> {\n const externalPackages = this.config.externalPackages;\n if (!externalPackages?.length) return;\n\n for (const pkg of externalPackages) {\n if (BaseBuilder.PSEUDO_PACKAGES.has(pkg)) continue;\n if (this.warnedExternalPackages.has(pkg)) continue;\n\n if (\n pkg.startsWith('.') ||\n pkg.startsWith('/') ||\n pkg.startsWith('$') ||\n pkg.includes('*') ||\n pkg.includes(':')\n ) {\n continue;\n }\n\n try {\n // Check package.json dependencies for @workflow/serde (fast path)\n let hasWorkflowSerdeDep = false;\n try {\n const pkgJsonPath = require.resolve(`${pkg}/package.json`, {\n paths: [this.config.workingDir],\n });\n const pkgJsonSource = await readFile(pkgJsonPath, 'utf-8');\n const pkgJson = JSON.parse(pkgJsonSource) as {\n dependencies?: unknown;\n peerDependencies?: unknown;\n };\n const dependencies =\n typeof pkgJson.dependencies === 'object' &&\n pkgJson.dependencies !== null &&\n !Array.isArray(pkgJson.dependencies)\n ? (pkgJson.dependencies as Record<string, unknown>)\n : {};\n const peerDependencies =\n typeof pkgJson.peerDependencies === 'object' &&\n pkgJson.peerDependencies !== null &&\n !Array.isArray(pkgJson.peerDependencies)\n ? (pkgJson.peerDependencies as Record<string, unknown>)\n : {};\n hasWorkflowSerdeDep =\n Object.hasOwn(dependencies, '@workflow/serde') ||\n Object.hasOwn(peerDependencies, '@workflow/serde');\n } catch {\n // package.json not resolvable - continue to source check\n }\n\n // Check source patterns (thorough path).\n // Note: require.resolve only inspects the package's main entry point.\n // If workflow constructs live in sub-paths (e.g. `my-pkg/workflows`),\n // they won't be detected here. The @workflow/serde dep check above\n // partially covers serde cases. This is acceptable as a best-effort\n // heuristic — the primary fix is auto-removal in withWorkflow().\n let hasUseStep = false;\n let hasUseWorkflow = false;\n let hasSerde = hasWorkflowSerdeDep;\n try {\n const entryPath = require.resolve(pkg, {\n paths: [this.config.workingDir],\n });\n const source = await readFile(entryPath, 'utf-8');\n const patterns = detectWorkflowPatterns(source);\n hasUseStep = patterns.hasUseStep;\n hasUseWorkflow = patterns.hasUseWorkflow;\n if (!hasSerde) {\n hasSerde = patterns.hasSerde;\n }\n } catch {\n // Entry file not resolvable or not readable - use what we have\n }\n\n if (!hasUseStep && !hasUseWorkflow && !hasSerde) continue;\n\n // Build a specific description of what was found\n const issues: string[] = [];\n if (hasUseWorkflow) issues.push('\"use workflow\" functions');\n if (hasUseStep) issues.push('\"use step\" functions');\n if (hasSerde) issues.push('serialization classes');\n\n this.warnedExternalPackages.add(pkg);\n\n console.warn(\n `\\n${chalk.yellow('⚠')} Warning: ${chalk.bold(`\"${pkg}\"`)} is listed in ${chalk.bold('externalPackages')} (${chalk.bold('serverExternalPackages')} in Next.js) but contains workflow code (${issues.join(', ')}).` +\n `\\n This code will ${chalk.bold('not')} be transformed by the workflow compiler, which can cause runtime failures.` +\n `\\n Remove ${chalk.bold(`\"${pkg}\"`)} from ${chalk.bold('externalPackages')} (${chalk.bold('serverExternalPackages')} in Next.js) to fix this.\\n`\n );\n } catch {\n // Best-effort: if anything goes wrong, skip this package silently\n }\n }\n }\n\n protected async discoverEntries(\n inputs: string[],\n outdir: string,\n tsconfigPath?: string\n ): Promise<DiscoveredEntries> {\n const previousResult = this.discoveredEntries.get(inputs);\n\n if (previousResult) {\n return previousResult;\n }\n const state: DiscoveredEntries = {\n discoveredSteps: new Set(),\n discoveredWorkflows: new Set(),\n discoveredSerdeFiles: new Set(),\n };\n\n const discoverStart = Date.now();\n\n // Resolve the SDK runtime entry point so that the discovery pass\n // traces through it and discovers serde classes (like `Run`) that\n // live inside SDK packages. Without this, files like `run.js` are\n // only discovered when user code happens to import them.\n // This is resolved here (rather than in callers) so that the original\n // `inputs` array reference is preserved for WeakMap caching — callers\n // like createWorkflowsBundle and createStepsBundle can share the same\n // cache entry when they pass the same inputFiles array.\n const resolvedWorkflowRuntime = await enhancedResolve(\n outdir,\n 'workflow/runtime'\n ).catch(() => undefined);\n const entryPoints = resolvedWorkflowRuntime\n ? [...inputs, resolvedWorkflowRuntime]\n : inputs;\n\n const effectiveTsconfigPath =\n tsconfigPath ?? (await this.findTsConfigPath());\n const esbuildTsconfigOptions = await getEsbuildTsconfigOptions(\n effectiveTsconfigPath\n );\n try {\n await esbuild.build({\n treeShaking: true,\n entryPoints,\n plugins: [\n createDiscoverEntriesPlugin(state, this.transformProjectRoot),\n ],\n platform: 'node',\n write: false,\n outdir,\n bundle: true,\n sourcemap: false,\n absWorkingDir: this.config.workingDir,\n logLevel: 'silent',\n ...esbuildTsconfigOptions,\n // External packages that should not be bundled during discovery\n external: this.config.externalPackages || [],\n });\n } catch (_) {}\n\n this.logBaseBuilderInfo(\n `Discovering workflow directives`,\n `${Date.now() - discoverStart}ms`\n );\n\n // Warn about external packages that contain workflow code\n await this.warnAboutExternalWorkflowPackages();\n\n this.discoveredEntries.set(inputs, state);\n return state;\n }\n\n /**\n * Writes debug information to a JSON file for troubleshooting build issues.\n * Uses atomic write (temp file + rename) to prevent race conditions when\n * multiple builds run concurrently.\n */\n private async writeDebugFile(\n outfile: string,\n debugData: object,\n merge?: boolean\n ): Promise<void> {\n const prefix = this.config.debugFilePrefix || '';\n const targetPath = `${dirname(outfile)}/${prefix}${basename(outfile)}.debug.json`;\n let existing = {};\n\n try {\n if (merge) {\n try {\n const content = await readFile(targetPath, 'utf8');\n existing = JSON.parse(content);\n } catch (e) {\n // File doesn't exist yet or is corrupted - start fresh.\n // Don't log error for ENOENT (file not found) as that's expected on first run.\n if ((e as NodeJS.ErrnoException).code !== 'ENOENT') {\n console.warn('Error reading debug file, starting fresh:', e);\n }\n }\n }\n\n const mergedData = JSON.stringify(\n {\n ...existing,\n ...debugData,\n },\n null,\n 2\n );\n\n // Write atomically: write to temp file, then rename.\n // rename() is atomic on POSIX systems and provides best-effort atomicity on Windows.\n // Prevents race conditions where concurrent builds read partially-written files.\n const tempPath = `${targetPath}.${randomUUID()}.tmp`;\n await writeFile(tempPath, mergedData);\n await rename(tempPath, targetPath);\n } catch (error: unknown) {\n console.warn('Failed to write debug file:', error);\n }\n }\n\n /**\n * Logs and optionally throws on esbuild errors and warnings.\n * @param throwOnError - If true, throws an error when esbuild errors are present\n */\n private logEsbuildMessages(\n result: { errors?: any[]; warnings?: any[] },\n phase: string,\n throwOnError = true,\n options?: {\n suppressWarnings?: boolean;\n }\n ): void {\n if (result.errors && result.errors.length > 0) {\n console.error(`❌ esbuild errors in ${phase}:`);\n const errorMessages: string[] = [];\n for (const error of result.errors) {\n console.error(` ${error.text}`);\n errorMessages.push(error.text);\n if (error.location) {\n const location = ` at ${error.location.file}:${error.location.line}:${error.location.column}`;\n console.error(location);\n errorMessages.push(location);\n }\n }\n\n if (throwOnError) {\n throw new WorkflowBuildError(\n `Build failed during ${phase}:\\n${errorMessages.join('\\n')}`,\n {\n hint: `Review the esbuild errors above — they come from the ${phase} bundle. Fix the offending source files and re-run the build.`,\n }\n );\n }\n }\n\n if (\n !options?.suppressWarnings &&\n result.warnings &&\n result.warnings.length > 0\n ) {\n console.warn(`! esbuild warnings in ${phase}:`);\n for (const warning of result.warnings) {\n console.warn(` ${warning.text}`);\n if (warning.location) {\n console.warn(\n ` at ${warning.location.file}:${warning.location.line}:${warning.location.column}`\n );\n }\n }\n }\n }\n\n /**\n * Converts an absolute file path to a normalized relative path for the manifest.\n */\n private getRelativeFilepath(absolutePath: string): string {\n const normalizedFile = absolutePath.replace(/\\\\/g, '/');\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n let relativePath = relative(normalizedWorkingDir, normalizedFile).replace(\n /\\\\/g,\n '/'\n );\n // Handle files discovered outside the working directory\n if (relativePath.startsWith('../')) {\n relativePath = relativePath\n .split('/')\n .filter((part) => part !== '..')\n .join('/');\n }\n return relativePath;\n }\n\n /**\n * Creates a bundle for workflow step functions.\n * Steps have full Node.js runtime access and handle side effects, API calls, etc.\n *\n * @param externalizeNonSteps - If true, only bundles step entry points and externalizes other code\n * @param bundleTransitiveLocalStepDependencies - If true, also bundles project-local files imported by step entries for direct runtime loading\n * @returns Build context (for watch mode) and the collected workflow manifest\n */\n protected async createStepsBundle({\n inputFiles,\n format = 'esm',\n outfile,\n externalizeNonSteps,\n bundleTransitiveLocalStepDependencies,\n rewriteTsExtensions,\n tsconfigPath,\n discoveredEntries,\n skipEsmRequireBanner = false,\n }: {\n tsconfigPath?: string;\n inputFiles: string[];\n outfile: string;\n format?: 'cjs' | 'esm';\n externalizeNonSteps?: boolean;\n bundleTransitiveLocalStepDependencies?: boolean;\n rewriteTsExtensions?: boolean;\n discoveredEntries?: DiscoveredEntries;\n /**\n * When true, skip the `createRequire` banner on the steps bundle.\n * Used by `createCombinedBundle` with `bundleFinalOutput: true` where\n * the outer esbuild pass provides its own banner, preventing the\n * `__createRequire` identifier from being declared twice after inlining.\n */\n skipEsmRequireBanner?: boolean;\n }): Promise<{\n context: esbuild.BuildContext | undefined;\n manifest: WorkflowManifest;\n }> {\n const stepsBundleStart = Date.now();\n const workflowManifest: WorkflowManifest = {};\n const builtInSteps = 'workflow/internal/builtins';\n\n const resolvedBuiltInSteps = await enhancedResolve(\n dirname(outfile),\n 'workflow/internal/builtins'\n ).catch((err) => {\n throw new WorkflowBuildError(\n `Failed to resolve built-in steps sources.\\n\\nCaused by: ${String(err)}`,\n {\n hint: 'run `pnpm install workflow` to resolve this issue.',\n cause: err,\n }\n );\n });\n\n // Discovery of workflow/step/serde entries. The SDK runtime entry point\n // (workflow/runtime) is resolved inside discoverEntries() itself so that\n // callers can pass the original inputFiles reference and benefit from\n // WeakMap caching across createWorkflowsBundle / createStepsBundle calls.\n const discovered =\n discoveredEntries ??\n (await this.discoverEntries(inputFiles, dirname(outfile), tsconfigPath));\n const stepFiles = [...discovered.discoveredSteps].sort();\n const workflowFiles = [...discovered.discoveredWorkflows].sort();\n const serdeFiles = [...discovered.discoveredSerdeFiles].sort();\n\n // Include serde files that aren't already step files for cross-context class registration.\n // Classes need to be registered in the step bundle so they can be deserialized\n // when receiving data from workflows and serialized when returning data to workflows.\n const stepFilesSet = new Set(stepFiles);\n const serdeOnlyFiles = serdeFiles.filter((f) => !stepFilesSet.has(f));\n\n // log the step files for debugging\n await this.writeDebugFile(outfile, {\n stepFiles,\n workflowFiles,\n serdeOnlyFiles,\n });\n\n // Helper to create import statement from file path\n // For workspace/node_modules packages, uses the package name so esbuild\n // will resolve through package.json exports with the appropriate conditions\n const createImport = (file: string) => {\n const normalizedWorkspaceRoot = this.config.workingDir\n .replace(/\\\\/g, '/')\n .replace(/\\/$/, '');\n const normalizedWorkspaceFile = file.replace(/\\\\/g, '/');\n // Only use relative source paths for workspace symlinks (files\n // outside node_modules in a packages/*/src/ directory). For tarball-\n // installed packages (files inside node_modules/), fall through to\n // getImportPath which returns package specifiers — this allows the\n // SWC plugin's externalizeNonSteps to work correctly.\n const isWorkspaceSourceBackedPackageFile =\n normalizedWorkspaceFile.includes('/packages/') &&\n normalizedWorkspaceFile.includes('/src/') &&\n !normalizedWorkspaceFile.includes('/node_modules/') &&\n !(\n normalizedWorkspaceFile === normalizedWorkspaceRoot ||\n normalizedWorkspaceFile.startsWith(`${normalizedWorkspaceRoot}/`)\n );\n const isSourceBackedPackageFile = isWorkspaceSourceBackedPackageFile;\n\n if (isSourceBackedPackageFile) {\n let relativePath = relative(\n normalizedWorkspaceRoot,\n normalizedWorkspaceFile\n ).replace(/\\\\/g, '/');\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `import '${relativePath}';`;\n }\n\n const { importPath, isPackage } = getImportPath(\n file,\n this.config.workingDir\n );\n\n if (isPackage) {\n // Use package name - esbuild will resolve via package.json exports\n return `import '${importPath}';`;\n }\n\n // Local app file - use relative path\n // Normalize both paths to forward slashes before calling relative()\n // This is critical on Windows where relative() can produce unexpected results with mixed path formats\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n const normalizedFile = file.replace(/\\\\/g, '/');\n // Calculate relative path from working directory to the file\n let relativePath = relative(normalizedWorkingDir, normalizedFile).replace(\n /\\\\/g,\n '/'\n );\n // Ensure relative paths start with ./ so esbuild resolves them correctly.\n // Paths like \".output/...\" are not valid relative specifiers and must\n // become \"./.output/...\".\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `import '${relativePath}';`;\n };\n\n // Create a virtual entry that imports all files. All step definitions\n // will get registered thanks to the swc transform.\n const stepImports = stepFiles.map(createImport).join('\\n');\n\n // Include serde-only files for class registration side effects\n const serdeImports = serdeOnlyFiles.map(createImport).join('\\n');\n\n const entryContent = `\n // Built in steps\n import '${builtInSteps}';\n // User steps\n ${stepImports}\n // Serde files for cross-context class registration\n ${serdeImports}\n // Sentinel export so bundlers (rollup) don't tree-shake this module\n // when it's imported as a side-effect-only dependency.\n export const __steps_registered = true;`;\n\n // Bundle with esbuild and our custom SWC plugin\n const entriesToBundle = externalizeNonSteps\n ? [\n ...stepFiles,\n ...serdeFiles,\n ...(resolvedBuiltInSteps ? [resolvedBuiltInSteps] : []),\n ]\n : undefined;\n const normalizedEntriesToBundle = entriesToBundle\n ? await withRealpaths(entriesToBundle)\n : undefined;\n const normalizedSideEffectEntries = await withRealpaths([\n ...stepFiles,\n ...serdeOnlyFiles,\n ...(resolvedBuiltInSteps ? [resolvedBuiltInSteps] : []),\n ]);\n const esbuildTsconfigOptions =\n await getEsbuildTsconfigOptions(tsconfigPath);\n const { banner: importMetaBanner, define: importMetaDefine } =\n this.getCjsImportMetaPolyfill(format);\n const esmRequireBanner = skipEsmRequireBanner\n ? ''\n : this.getEsmRequireBanner(format);\n\n const esbuildCtx = await esbuild.context({\n banner: {\n js: `// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n${importMetaBanner}${esmRequireBanner}`,\n },\n stdin: {\n contents: entryContent,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n outfile,\n absWorkingDir: this.config.workingDir,\n bundle: true,\n format,\n platform: 'node',\n conditions: ['node'],\n target: 'es2022',\n write: true,\n treeShaking: true,\n keepNames: true,\n minify: false,\n jsx: 'preserve',\n logLevel: 'error',\n // Use tsconfig for path alias resolution.\n // For symlinked configs this uses tsconfigRaw to preserve cwd-relative aliases.\n ...esbuildTsconfigOptions,\n define: importMetaDefine,\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n // Inline source maps for better stack traces in step execution.\n // Steps execute in Node.js context and inline sourcemaps ensure we get\n // meaningful stack traces with proper file names and line numbers when errors\n // occur in deeply nested function calls across multiple files.\n sourcemap: this.resolveSourcemap('inline'),\n plugins: [\n // Handle pseudo-packages like 'server-only' and 'client-only' by providing\n // empty modules. Must run first to intercept these before other resolution.\n createPseudoPackagePlugin(),\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: normalizedEntriesToBundle,\n outdir: outfile ? dirname(outfile) : undefined,\n projectRoot: this.transformProjectRoot,\n workflowManifest,\n bundleTransitiveLocalStepDependencies,\n rewriteTsExtensions,\n sideEffectEntries: normalizedSideEffectEntries,\n }),\n ],\n // Plugin should catch most things, but this lets users hard override\n // if the plugin misses anything that should be externalized\n external: ['bun', 'bun:*', ...(this.config.externalPackages || [])],\n });\n\n const stepsResult = await esbuildCtx.rebuild();\n\n this.logEsbuildMessages(stepsResult, 'steps bundle creation');\n this.logBaseBuilderInfo(\n 'Created steps bundle',\n `${Date.now() - stepsBundleStart}ms`\n );\n\n // Handle workflow-only files that may have been tree-shaken from the bundle.\n // These files have no steps, so esbuild removes them, but we still need their\n // workflow metadata for the manifest. Transform them separately.\n const workflowOnlyFiles = workflowFiles.filter(\n (f) => !stepFiles.includes(f)\n );\n await Promise.all(\n workflowOnlyFiles.map(async (workflowFile) => {\n try {\n const source = await readFile(workflowFile, 'utf8');\n const relativeFilepath = this.getRelativeFilepath(workflowFile);\n const { workflowManifest: fileManifest } = await applySwcTransform(\n relativeFilepath,\n source,\n 'workflow',\n workflowFile,\n this.transformProjectRoot\n );\n if (fileManifest.workflows) {\n workflowManifest.workflows = Object.assign(\n workflowManifest.workflows || {},\n fileManifest.workflows\n );\n }\n if (fileManifest.classes) {\n workflowManifest.classes = Object.assign(\n workflowManifest.classes || {},\n fileManifest.classes\n );\n }\n } catch (error) {\n // Log warning but continue - don't fail build for workflow-only file issues\n console.warn(\n `Warning: Failed to extract workflow metadata from ${workflowFile}:`,\n error instanceof Error ? error.message : String(error)\n );\n }\n })\n );\n\n // Create .gitignore in .swc directory\n await this.createSwcGitignore();\n\n if (this.config.watch) {\n return { context: esbuildCtx, manifest: workflowManifest };\n }\n await esbuildCtx.dispose();\n return { context: undefined, manifest: workflowManifest };\n }\n\n /**\n * Creates a bundle for workflow orchestration functions.\n * Workflows run in a sandboxed VM and coordinate step execution.\n *\n * @param bundleFinalOutput - If false, skips the final bundling step (used by Next.js)\n */\n protected async createWorkflowsBundle({\n inputFiles,\n format = 'esm',\n outfile,\n bundleFinalOutput = true,\n keepInterimBundleContext = this.config.watch,\n tsconfigPath,\n discoveredEntries,\n }: {\n tsconfigPath?: string;\n inputFiles: string[];\n outfile: string;\n format?: 'cjs' | 'esm';\n bundleFinalOutput?: boolean;\n keepInterimBundleContext?: boolean;\n discoveredEntries?: DiscoveredEntries;\n }): Promise<{\n manifest: WorkflowManifest;\n interimBundleCtx?: esbuild.BuildContext;\n bundleFinal?: (interimBundleResult: string) => Promise<void>;\n /** The raw workflow VM code (before wrapping with entrypoint) */\n interimBundleText?: string;\n }> {\n const discovered =\n discoveredEntries ??\n (await this.discoverEntries(inputFiles, dirname(outfile), tsconfigPath));\n const workflowFiles = [...discovered.discoveredWorkflows].sort();\n const serdeFiles = [...discovered.discoveredSerdeFiles].sort();\n\n // Include serde files that aren't already workflow files for cross-context class registration.\n // Classes need to be registered in the workflow bundle so they can be deserialized\n // when receiving data from steps or when serializing data to send to steps.\n const workflowFilesSet = new Set(workflowFiles);\n const serdeOnlyFiles = serdeFiles.filter((f) => !workflowFilesSet.has(f));\n\n // log the workflow files for debugging\n await this.writeDebugFile(outfile, { workflowFiles, serdeOnlyFiles });\n\n // Helper to create import statement from file path\n // For packages, uses the package name so esbuild will resolve through\n // package.json exports with conditions: ['workflow']\n const createImport = (file: string) => {\n const { importPath, isPackage } = getImportPath(\n file,\n this.config.workingDir\n );\n\n if (isPackage) {\n // Use package name - esbuild will resolve via package.json exports\n // and apply the 'workflow' condition\n return `import '${importPath}';`;\n }\n\n // Local app file - use relative path\n // Normalize both paths to forward slashes before calling relative()\n // This is critical on Windows where relative() can produce unexpected results with mixed path formats\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n const normalizedFile = file.replace(/\\\\/g, '/');\n // Calculate relative path from working directory to the file\n let relativePath = relative(normalizedWorkingDir, normalizedFile).replace(\n /\\\\/g,\n '/'\n );\n // Ensure relative paths start with ./ so esbuild resolves them correctly.\n // Paths like \".output/...\" are not valid relative specifiers and must\n // become \"./.output/...\".\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `import '${relativePath}';`;\n };\n\n // Create a virtual entry that imports all workflow files\n // The SWC plugin in workflow mode emits `globalThis.__private_workflows.set(workflowId, fn)`\n // calls directly, so we just need to import the files (Map is initialized via banner)\n const workflowImports = workflowFiles.map(createImport).join('\\n');\n\n // Include serde-only files for class registration side effects\n const serdeImports = serdeOnlyFiles.map(createImport).join('\\n');\n\n const imports = serdeImports\n ? `${workflowImports}\\n// Serde files for cross-context class registration\\n${serdeImports}`\n : workflowImports;\n\n const bundleStartTime = Date.now();\n const workflowManifest: WorkflowManifest = {};\n const esbuildTsconfigOptions =\n await getEsbuildTsconfigOptions(tsconfigPath);\n const normalizedWorkflowSideEffectEntries = await withRealpaths([\n ...workflowFiles,\n ...serdeOnlyFiles,\n ]);\n\n // Bundle with esbuild and our custom SWC plugin in workflow mode.\n // this bundle will be run inside a vm isolate\n const interimBundleCtx = await esbuild.context({\n stdin: {\n contents: imports,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n bundle: true,\n absWorkingDir: this.config.workingDir,\n format: 'cjs', // Runs inside the VM which expects cjs\n platform: 'neutral', // The platform is neither node nor browser\n mainFields: ['module', 'main'], // To support npm style imports\n conditions: ['workflow'], // Allow packages to export 'workflow' compliant versions\n target: 'es2022',\n write: false,\n treeShaking: true,\n keepNames: true,\n minify: false,\n // Initialize the workflow registry at the very top of the bundle\n // This must be in banner (not the virtual entry) because esbuild's bundling\n // can reorder code, and the .set() calls need the Map to exist first\n banner: {\n js: 'globalThis.__private_workflows = new Map();',\n },\n // Inline source maps for better stack traces in workflow VM execution.\n // This intermediate bundle is executed via runInContext() in a VM, so we need\n // inline source maps to get meaningful stack traces instead of \"evalmachine.<anonymous>\".\n sourcemap: this.resolveSourcemap('inline'),\n // Use tsconfig for path alias resolution.\n // For symlinked configs this uses tsconfigRaw to preserve cwd-relative aliases.\n ...esbuildTsconfigOptions,\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n plugins: [\n // Handle pseudo-packages like 'server-only' and 'client-only' by providing\n // empty modules. Must run first to intercept these before other resolution.\n createPseudoPackagePlugin(),\n createSwcPlugin({\n mode: 'workflow',\n projectRoot: this.transformProjectRoot,\n workflowManifest,\n sideEffectEntries: normalizedWorkflowSideEffectEntries,\n }),\n // This plugin must run after the swc plugin to ensure dead code elimination\n // happens first, preventing false positives on Node.js imports in unused code paths\n createNodeModuleErrorPlugin(),\n ],\n // NOTE: We intentionally do NOT use the external option here for workflow bundles.\n // When packages are marked external with format: 'cjs', esbuild generates require() calls.\n // However, the workflow VM (vm.runInContext) does not have require() defined - it only\n // provides module.exports and exports. External packages would fail at runtime with:\n // ReferenceError: require is not defined\n // Instead, we bundle everything and rely on:\n // - createPseudoPackagePlugin() to handle server-only/client-only with empty modules\n // - createNodeModuleErrorPlugin() to catch Node.js builtin imports at build time\n });\n let shouldDisposeInterimBundleCtx = !keepInterimBundleContext;\n try {\n const interimBundle = await interimBundleCtx.rebuild();\n\n this.logEsbuildMessages(\n interimBundle,\n 'intermediate workflow bundle',\n true,\n {\n suppressWarnings: this.config.suppressCreateWorkflowsBundleWarnings,\n }\n );\n this.logCreateWorkflowsBundleInfo(\n 'Created intermediate workflow bundle',\n `${Date.now() - bundleStartTime}ms`\n );\n\n if (this.config.workflowManifestPath) {\n const resolvedPath = resolve(\n process.cwd(),\n this.config.workflowManifestPath\n );\n let prefix = '';\n\n if (resolvedPath.endsWith('.cjs')) {\n prefix = 'module.exports = ';\n } else if (\n resolvedPath.endsWith('.js') ||\n resolvedPath.endsWith('.mjs')\n ) {\n prefix = 'export default ';\n }\n\n await mkdir(dirname(resolvedPath), { recursive: true });\n await writeFile(\n resolvedPath,\n prefix + JSON.stringify(workflowManifest, null, 2)\n );\n }\n\n // Create .gitignore in .swc directory\n await this.createSwcGitignore();\n\n if (\n !interimBundle.outputFiles ||\n interimBundle.outputFiles.length === 0\n ) {\n throw new WorkflowBuildError('No output files generated from esbuild', {\n hint: 'This usually indicates a misconfigured entry point or an empty workflow directory. Check that your workflow files contain a `\"use workflow\"` or `\"use step\"` directive.',\n });\n }\n\n // Serde compliance warnings: check if workflow bundle has Node.js imports\n // alongside serde-registered classes (these will fail at runtime in the sandbox)\n if (\n workflowManifest.classes &&\n Object.keys(workflowManifest.classes).length > 0\n ) {\n const { analyzeSerdeCompliance } = await import('./serde-checker.js');\n const bundleText = interimBundle.outputFiles[0].text;\n const serdeResult = analyzeSerdeCompliance({\n sourceCode: '',\n workflowCode: bundleText,\n manifest: workflowManifest,\n });\n // De-dupe warnings: group identical issues across classes\n const issuesToClasses = new Map<string, Set<string>>();\n for (const cls of serdeResult.classes) {\n if (!cls.compliant) {\n for (const issue of cls.issues) {\n let affectedClasses = issuesToClasses.get(issue);\n if (!affectedClasses) {\n affectedClasses = new Set<string>();\n issuesToClasses.set(issue, affectedClasses);\n }\n affectedClasses.add(cls.className);\n }\n }\n }\n for (const [issue, affectedClasses] of issuesToClasses) {\n const classNames = [...affectedClasses];\n const classLabel =\n classNames.length === 1\n ? `class \"${classNames[0]}\"`\n : `classes ${classNames.map((name) => `\"${name}\"`).join(', ')}`;\n console.warn(\n chalk.yellow(`⚠ Serde warning for ${classLabel}: `) + issue\n );\n }\n }\n\n const bundleFinal = async (interimBundle: string) => {\n const workflowBundleCode = interimBundle;\n\n const workflowFunctionCode = `// biome-ignore-all lint: generated file\n/* eslint-disable */\nimport { workflowEntrypoint } from 'workflow/runtime';\n\nconst workflowCode = \\`${workflowBundleCode.replace(/[\\\\`$]/g, '\\\\$&')}\\`;\n\nexport const POST = workflowEntrypoint(workflowCode);`;\n\n // we skip the final bundling step for Next.js so it can bundle itself\n if (!bundleFinalOutput) {\n if (!outfile) {\n throw new Error(`Invariant: missing outfile for workflow bundle`);\n }\n // Ensure the output directory exists\n const outputDir = dirname(outfile);\n await mkdir(outputDir, { recursive: true });\n\n // Atomic write: write to temp file then rename to prevent\n // file watchers from reading partial file during write\n const tempPath = `${outfile}.${randomUUID()}.tmp`;\n await writeFile(tempPath, workflowFunctionCode);\n await rename(tempPath, outfile);\n return;\n }\n\n const bundleStartTime = Date.now();\n\n // Now bundle this so we can resolve the @workflow/core dependency\n // we could remove this if we do nft tracing or similar instead\n const finalEsmRequireBanner = this.getEsmRequireBanner(format);\n const finalWorkflowResult = await esbuild.build({\n banner: {\n js: `// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n${finalEsmRequireBanner}`,\n },\n stdin: {\n contents: workflowFunctionCode,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n outfile,\n // Source maps for the final workflow bundle wrapper (not important since this code\n // doesn't run in the VM - only the intermediate bundle sourcemap is relevant)\n sourcemap: this.resolveSourcemap(EMIT_SOURCEMAPS_FOR_DEBUGGING),\n absWorkingDir: this.config.workingDir,\n bundle: true,\n format,\n platform: 'node',\n target: 'es2022',\n write: true,\n keepNames: true,\n minify: false,\n external: ['@aws-sdk/credential-provider-web-identity'],\n });\n\n this.logEsbuildMessages(\n finalWorkflowResult,\n 'final workflow bundle',\n true,\n {\n suppressWarnings: this.config.suppressCreateWorkflowsBundleWarnings,\n }\n );\n this.logCreateWorkflowsBundleInfo(\n 'Created final workflow bundle',\n `${Date.now() - bundleStartTime}ms`\n );\n };\n const interimBundleText = interimBundle.outputFiles[0].text;\n await bundleFinal(interimBundleText);\n\n if (keepInterimBundleContext) {\n shouldDisposeInterimBundleCtx = false;\n return {\n manifest: workflowManifest,\n interimBundleCtx,\n bundleFinal,\n interimBundleText,\n };\n }\n return { manifest: workflowManifest, interimBundleText };\n } catch (error) {\n shouldDisposeInterimBundleCtx = true;\n throw error;\n } finally {\n if (shouldDisposeInterimBundleCtx) {\n try {\n await interimBundleCtx.dispose();\n } catch (disposeError) {\n console.warn(\n 'Warning: Failed to dispose workflow bundle context',\n disposeError\n );\n }\n }\n }\n }\n\n /**\n * V2: Creates a combined bundle that includes both step registrations and\n * workflow orchestration in a single route. The combined entrypoint executes\n * steps inline when possible, reducing function invocations and queue overhead.\n *\n * This method reuses createStepsBundle (for step registrations) and\n * createWorkflowsBundle (for workflow VM code), then combines them into\n * a single route file using workflowEntrypoint().\n */\n protected async createCombinedBundle({\n inputFiles,\n stepsOutfile,\n flowOutfile,\n format = 'esm',\n bundleFinalOutput = true,\n tsconfigPath,\n externalizeNonSteps,\n bundleTransitiveLocalStepDependencies,\n discoveredEntries,\n }: {\n inputFiles: string[];\n /** Output path for the step registrations bundle (side effects only) */\n stepsOutfile: string;\n /** Output path for the combined route file */\n flowOutfile: string;\n format?: 'cjs' | 'esm';\n bundleFinalOutput?: boolean;\n tsconfigPath?: string;\n externalizeNonSteps?: boolean;\n bundleTransitiveLocalStepDependencies?: boolean;\n discoveredEntries?: DiscoveredEntries;\n }): Promise<{\n manifest: WorkflowManifest;\n stepsContext?: esbuild.BuildContext;\n interimBundleCtx?: esbuild.BuildContext;\n bundleFinal?: (interimBundleResult: string) => Promise<void>;\n }> {\n // 1. Build step registrations bundle (used as separate file for\n // bundleFinalOutput: false, or read back for inline content when true)\n const { context: stepsContext, manifest: stepsManifest } =\n await this.createStepsBundle({\n inputFiles,\n outfile: stepsOutfile,\n // When bundleFinalOutput is true, use ESM for the steps bundle\n // regardless of the final output format. The final esbuild pass\n // converts everything to the target format. Using CJS here causes\n // a module.exports collision: the steps bundle's top-level\n // module.exports overwrites the combined route's module.exports\n // when esbuild inlines the steps without a __commonJS wrapper.\n format: bundleFinalOutput ? 'esm' : format,\n externalizeNonSteps,\n bundleTransitiveLocalStepDependencies,\n tsconfigPath,\n discoveredEntries,\n // Skip the createRequire banner here — when bundleFinalOutput is true\n // the outer esbuild pass will inline this bundle and add its own\n // banner. Emitting it twice declares __createRequire twice.\n skipEsmRequireBanner: bundleFinalOutput,\n });\n\n // 2. Build workflow VM code\n const tempWorkflowOutfile = `${flowOutfile}.__wf_tmp.js`;\n const workflowsResult = await this.createWorkflowsBundle({\n inputFiles,\n outfile: tempWorkflowOutfile,\n format,\n bundleFinalOutput: false,\n tsconfigPath,\n discoveredEntries,\n });\n\n const workflowVMCode = workflowsResult.interimBundleText;\n if (!workflowVMCode) {\n throw new Error('createWorkflowsBundle did not return interimBundleText');\n }\n\n // Clean up the wrapper file\n try {\n const { unlink } = await import('node:fs/promises');\n await unlink(tempWorkflowOutfile);\n } catch {\n // Ignore cleanup errors\n }\n\n // 3. Generate combined route file\n const stepsRelativePath = './' + basename(stepsOutfile).replace(/\\\\/g, '/');\n const escapedVMCode = workflowVMCode.replace(/[\\\\`$]/g, '\\\\$&');\n\n const combinedFunctionCode = `// biome-ignore-all lint: generated file\n/* eslint-disable */\nimport { __steps_registered } from '${stepsRelativePath}';\nimport { workflowEntrypoint } from 'workflow/runtime';\n\n// Prevent rollup from tree-shaking the steps side-effect import\nvoid __steps_registered;\n\nconst workflowCode = \\`${escapedVMCode}\\`;\n\nexport const POST = workflowEntrypoint(workflowCode);`;\n\n if (!bundleFinalOutput) {\n // Write directly (Next.js will bundle)\n const tempPath = `${flowOutfile}.${randomUUID()}.tmp`;\n await writeFile(tempPath, combinedFunctionCode);\n await rename(tempPath, flowOutfile);\n } else {\n // Bundle the combined code for standalone use\n const bundleStartTime = Date.now();\n const { banner: importMetaBanner, define: importMetaDefine } =\n this.getCjsImportMetaPolyfill(format);\n // ESM banner provides `require` via createRequire(import.meta.url) so\n // CJS dependencies that call require() for Node.js builtins keep working\n // in the ESM output produced by bundleFinalOutput: true.\n const finalEsmRequireBanner = this.getEsmRequireBanner(format);\n const finalResult = await esbuild.build({\n banner: {\n js: `// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n${importMetaBanner}${finalEsmRequireBanner}`,\n },\n stdin: {\n contents: combinedFunctionCode,\n resolveDir: dirname(flowOutfile),\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n outfile: flowOutfile,\n absWorkingDir: this.config.workingDir,\n bundle: true,\n format,\n platform: 'node',\n target: 'es2022',\n write: true,\n keepNames: true,\n minify: false,\n define: importMetaDefine,\n external: ['@aws-sdk/credential-provider-web-identity'],\n });\n this.logEsbuildMessages(finalResult, 'combined bundle', true);\n this.logBaseBuilderInfo(\n 'Created combined bundle',\n `${Date.now() - bundleStartTime}ms`\n );\n }\n\n // Merge manifests\n const manifest: WorkflowManifest = {\n ...stepsManifest,\n workflows: {\n ...stepsManifest.workflows,\n ...workflowsResult.manifest.workflows,\n },\n classes: {\n ...stepsManifest.classes,\n ...workflowsResult.manifest.classes,\n },\n };\n\n // Create a custom bundleFinal for watch mode that uses workflowEntrypoint\n const combinedBundleFinal = async (interimBundleText: string) => {\n const escaped = interimBundleText.replace(/[\\\\`$]/g, '\\\\$&');\n const code = `// biome-ignore-all lint: generated file\n/* eslint-disable */\nimport { __steps_registered } from '${stepsRelativePath}';\nimport { workflowEntrypoint } from 'workflow/runtime';\n\nvoid __steps_registered;\n\nconst workflowCode = \\`${escaped}\\`;\n\nexport const POST = workflowEntrypoint(workflowCode);`;\n\n const outputDir = dirname(flowOutfile);\n await mkdir(outputDir, { recursive: true });\n const tempPath = `${flowOutfile}.${randomUUID()}.tmp`;\n await writeFile(tempPath, code);\n await rename(tempPath, flowOutfile);\n };\n\n if (this.config.watch) {\n return {\n manifest,\n stepsContext,\n interimBundleCtx: workflowsResult.interimBundleCtx,\n bundleFinal: combinedBundleFinal,\n };\n }\n\n return { manifest };\n }\n\n /**\n * Creates a client library bundle for workflow execution.\n * The client library allows importing and calling workflows from application code.\n * Only generated if clientBundlePath is specified in config.\n */\n protected async createClientLibrary(): Promise<void> {\n if (!this.config.clientBundlePath) {\n // Silently exit since no client bundle was requested\n return;\n }\n\n this.logBaseBuilderInfo(\n 'Generating a client library at',\n this.config.clientBundlePath\n );\n this.logBaseBuilderInfo(\n 'NOTE: The recommended way to use workflow with a framework like NextJS is using the loader/plugin with webpack/turbobpack/rollup'\n );\n\n // Ensure we have the directory for the client bundle\n const outputDir = dirname(this.config.clientBundlePath);\n await mkdir(outputDir, { recursive: true });\n\n const inputFiles = await this.getInputFiles();\n\n // Discover serde files from the input files' dependency tree for cross-context class registration.\n // Classes need to be registered in the client bundle so they can be serialized\n // when passing data to workflows via start() and deserialized when receiving workflow results.\n const { discoveredSerdeFiles } = await this.discoverEntries(\n inputFiles,\n outputDir\n );\n\n // Identify serde files that aren't in the inputFiles (deduplicated)\n const inputFilesNormalized = new Set(\n inputFiles.map((f) => f.replace(/\\\\/g, '/'))\n );\n const serdeOnlyFiles = [...discoveredSerdeFiles].filter(\n (f) => !inputFilesNormalized.has(f)\n );\n\n // Re-exports for input files (user's workflow/step definitions).\n // These must use valid relative specifiers because some frameworks pass\n // generated files like \".output/server/index.mjs\" as input files.\n const reexports = inputFiles\n .map((file) => {\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n let relativePath = relative(normalizedWorkingDir, file).replace(\n /\\\\/g,\n '/'\n );\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `export * from '${relativePath}';`;\n })\n .join('\\n');\n\n // Side-effect imports for serde files not in inputFiles (for class registration)\n const serdeImports = serdeOnlyFiles\n .map((file) => {\n const normalizedWorkingDir = this.config.workingDir.replace(/\\\\/g, '/');\n let relativePath = relative(normalizedWorkingDir, file).replace(\n /\\\\/g,\n '/'\n );\n if (!relativePath.startsWith('./') && !relativePath.startsWith('../')) {\n relativePath = `./${relativePath}`;\n }\n return `import '${relativePath}';`;\n })\n .join('\\n');\n\n // Combine: serde imports (for registration side effects) + re-exports\n const entryContent = serdeImports\n ? `// Serde files for cross-context class registration\\n${serdeImports}\\n${reexports}`\n : reexports;\n\n // Bundle with esbuild and our custom SWC plugin\n const normalizedClientSideEffectEntries = await withRealpaths([\n ...inputFiles,\n ...serdeOnlyFiles,\n ]);\n const clientResult = await esbuild.build({\n banner: {\n js: '// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n',\n },\n stdin: {\n contents: entryContent,\n resolveDir: this.config.workingDir,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n outfile: this.config.clientBundlePath,\n bundle: true,\n format: 'esm',\n platform: 'node',\n jsx: 'preserve',\n target: 'es2022',\n write: true,\n treeShaking: true,\n external: ['@workflow/core'],\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n plugins: [\n createSwcPlugin({\n mode: 'step',\n projectRoot: this.transformProjectRoot,\n sideEffectEntries: normalizedClientSideEffectEntries,\n }),\n ],\n });\n\n this.logEsbuildMessages(clientResult, 'client library bundle');\n\n // Create .gitignore in .swc directory\n await this.createSwcGitignore();\n }\n\n /**\n * Creates a webhook handler bundle for resuming workflows via HTTP callbacks.\n *\n * @param bundle - If true, bundles dependencies (needed for Build Output API)\n */\n protected async createWebhookBundle({\n outfile,\n bundle = false,\n }: {\n outfile: string;\n bundle?: boolean;\n }): Promise<void> {\n this.logCreateWebhookBundleInfo('Creating webhook route');\n await mkdir(dirname(outfile), { recursive: true });\n\n // Create a static route that calls resumeWebhook\n // This route works for both Next.js and Vercel Build Output API\n // Bundled Build Output API webhook functions need world.ts statically\n // present so getWorldLazy() can use the global getWorld registration\n // instead of falling back to a missing sibling import(\"./world.js\").\n const routeContent = `${bundle ? \"import 'workflow/runtime';\\n\" : ''}import { resumeWebhook } from 'workflow/api';\n\nasync function handler(request) {\n const url = new URL(request.url);\n // Extract token from pathname: /.well-known/workflow/v1/webhook/{token}\n const pathParts = url.pathname.split('/');\n const token = decodeURIComponent(pathParts[pathParts.length - 1]);\n\n if (!token) {\n return new Response('Missing token', { status: 400 });\n }\n\n try {\n const response = await resumeWebhook(token, request);\n return response;\n } catch (error) {\n // TODO: differentiate between invalid token and other errors\n console.error('Error during resumeWebhook', error);\n return new Response(null, { status: 404 });\n }\n}\n\nexport const GET = handler;\nexport const POST = handler;\nexport const PUT = handler;\nexport const PATCH = handler;\nexport const DELETE = handler;\nexport const HEAD = handler;\nexport const OPTIONS = handler;`;\n\n if (!bundle) {\n // For Next.js, just write the unbundled file\n await writeFile(outfile, routeContent);\n return;\n }\n\n // For Build Output API, bundle with esbuild to resolve imports\n\n const webhookEsmRequireBanner = this.getEsmRequireBanner('esm');\n const webhookBundleStart = Date.now();\n const result = await esbuild.build({\n banner: {\n js: `// biome-ignore-all lint: generated file\\n/* eslint-disable */\\n${webhookEsmRequireBanner}`,\n },\n stdin: {\n contents: routeContent,\n resolveDir: this.config.workingDir,\n sourcefile: 'webhook-route.js',\n loader: 'js',\n },\n outfile,\n absWorkingDir: this.config.workingDir,\n bundle: true,\n jsx: 'preserve',\n format: 'esm',\n platform: 'node',\n conditions: ['import', 'module', 'node', 'default'],\n target: 'es2022',\n write: true,\n treeShaking: true,\n keepNames: true,\n minify: false,\n resolveExtensions: [\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ],\n sourcemap: this.resolveSourcemap(EMIT_SOURCEMAPS_FOR_DEBUGGING),\n mainFields: ['module', 'main'],\n // Don't externalize anything - bundle everything including workflow packages\n external: [],\n });\n\n this.logEsbuildMessages(result, 'webhook bundle creation');\n this.logCreateWebhookBundleInfo(\n 'Created webhook bundle',\n `${Date.now() - webhookBundleStart}ms`\n );\n }\n\n /**\n * Creates a package.json file with the specified module type.\n */\n protected async createPackageJson(\n dir: string,\n type: 'commonjs' | 'module'\n ): Promise<void> {\n const packageJson = { type };\n await writeFile(\n join(dir, 'package.json'),\n JSON.stringify(packageJson, null, 2)\n );\n }\n\n /**\n * Creates a .vc-config.json file for Vercel Build Output API functions.\n */\n protected async createVcConfig(\n dir: string,\n config: {\n runtime?: string;\n handler?: string;\n launcherType?: string;\n architecture?: string;\n shouldAddHelpers?: boolean;\n shouldAddSourcemapSupport?: boolean;\n maxDuration?: number | 'max';\n experimentalTriggers?: Array<{\n type: 'queue/v2beta';\n topic: string;\n consumer: string;\n maxDeliveries?: number;\n retryAfterSeconds?: number;\n initialDelaySeconds?: number;\n }>;\n }\n ): Promise<void> {\n const vcConfig = {\n runtime: config.runtime ?? 'nodejs22.x',\n handler: config.handler ?? 'index.mjs',\n launcherType: config.launcherType ?? 'Nodejs',\n architecture: config.architecture ?? 'arm64',\n shouldAddHelpers: config.shouldAddHelpers ?? true,\n ...(config.maxDuration !== undefined && {\n maxDuration: config.maxDuration,\n }),\n ...(config.shouldAddSourcemapSupport !== undefined && {\n shouldAddSourcemapSupport: config.shouldAddSourcemapSupport,\n }),\n ...(config.experimentalTriggers && {\n experimentalTriggers: config.experimentalTriggers,\n }),\n };\n\n await writeFile(\n join(dir, '.vc-config.json'),\n JSON.stringify(vcConfig, null, 2)\n );\n }\n\n /**\n * Resolves a path relative to the working directory.\n */\n protected resolvePath(path: string): string {\n return resolve(this.config.workingDir, path);\n }\n\n /**\n * Ensures the directory for a file path exists, creating it if necessary.\n */\n protected async ensureDirectory(filePath: string): Promise<void> {\n await mkdir(dirname(filePath), { recursive: true });\n }\n\n private async createSwcGitignore(): Promise<void> {\n try {\n await writeFile(\n join(this.config.workingDir, '.swc', '.gitignore'),\n '*\\n'\n );\n } catch {\n // We're intentionally silently ignoring this error - creating .gitignore isn't critical\n }\n }\n\n /**\n * Whether the manifest should be exposed as a public HTTP route.\n * Controlled by the `WORKFLOW_PUBLIC_MANIFEST` environment variable.\n */\n protected get shouldExposePublicManifest(): boolean {\n return process.env.WORKFLOW_PUBLIC_MANIFEST === '1';\n }\n\n /**\n * Resolves the workflow manifest diagnostics path, when this builder should\n * emit one.\n */\n protected getDiagnosticsManifestPath(): string | undefined {\n if (this.config.diagnosticsDir) {\n return resolve(\n this.config.workingDir,\n this.config.diagnosticsDir,\n 'workflows-manifest.json'\n );\n }\n\n if (this.config.buildTarget === 'vercel-build-output-api') {\n return this.resolvePath(\n '.vercel/output/diagnostics/workflows-manifest.json'\n );\n }\n }\n\n /**\n * Resolve the effective source map mode for a given call site. Precedence:\n * explicit `sourcemap` config > `WORKFLOW_SOURCEMAP` env var > the call\n * site's default. Returned value is passed directly to esbuild's\n * `sourcemap` option.\n */\n protected resolveSourcemap(defaultMode: SourcemapMode): SourcemapMode {\n if (this.config.sourcemap !== undefined) return this.config.sourcemap;\n const envMode = parseSourcemapEnv(process.env.WORKFLOW_SOURCEMAP);\n if (envMode !== undefined) return envMode;\n return defaultMode;\n }\n\n /**\n * Whether the resolved source map mode emits any source maps at all.\n * Used by consumers like the Vercel builder to decide whether to include\n * the source-map-support runtime shim in generated functions.\n */\n protected get sourcemapsEnabled(): boolean {\n return this.resolveSourcemap(true) !== false;\n }\n\n /**\n * Creates a manifest JSON file containing step/workflow/class metadata\n * and graph data for visualization.\n *\n * @returns The manifest JSON string, or undefined if manifest creation failed.\n */\n protected async createManifest({\n workflowBundlePath,\n manifestDir,\n manifest,\n }: {\n workflowBundlePath: string;\n manifestDir: string;\n manifest: WorkflowManifest;\n }): Promise<string | undefined> {\n const buildStart = Date.now();\n this.logCreateManifestInfo('Creating manifest...');\n\n try {\n const workflowGraphs = await extractWorkflowGraphs(workflowBundlePath);\n\n const steps = this.convertStepsManifest(manifest.steps);\n const workflows = this.convertWorkflowsManifest(\n manifest.workflows,\n workflowGraphs\n );\n const classes = this.convertClassesManifest(manifest.classes);\n\n const output = { version: '1.0.0', steps, workflows, classes };\n const manifestJson = JSON.stringify(output, null, 2);\n\n await mkdir(manifestDir, { recursive: true });\n await writeFile(join(manifestDir, 'manifest.json'), manifestJson);\n\n const diagnosticsManifestPath = this.getDiagnosticsManifestPath();\n if (diagnosticsManifestPath) {\n await this.ensureDirectory(diagnosticsManifestPath);\n await writeFile(diagnosticsManifestPath, manifestJson);\n }\n\n const stepCount = Object.values(steps).reduce(\n (acc, s) => acc + Object.keys(s).length,\n 0\n );\n const workflowCount = Object.values(workflows).reduce(\n (acc, w) => acc + Object.keys(w).length,\n 0\n );\n const classCount = Object.values(classes).reduce(\n (acc, c) => acc + Object.keys(c).length,\n 0\n );\n\n this.logCreateManifestInfo(\n `Created manifest with ${stepCount} ${pluralize('step', 'steps', stepCount)}, ${workflowCount} ${pluralize('workflow', 'workflows', workflowCount)}, and ${classCount} ${pluralize('class', 'classes', classCount)}`,\n `${Date.now() - buildStart}ms`\n );\n\n return manifestJson;\n } catch (error) {\n console.warn(\n 'Failed to create manifest:',\n error instanceof Error ? error.message : String(error)\n );\n return undefined;\n }\n }\n\n private convertStepsManifest(\n steps: WorkflowManifest['steps']\n ): Record<string, Record<string, { stepId: string }>> {\n const result: Record<string, Record<string, { stepId: string }>> = {};\n if (!steps) return result;\n\n for (const [filePath, entries] of Object.entries(steps)) {\n result[filePath] = {};\n for (const [name, data] of Object.entries(entries)) {\n result[filePath][name] = { stepId: data.stepId };\n }\n }\n return result;\n }\n\n private convertWorkflowsManifest(\n workflows: WorkflowManifest['workflows'],\n graphs: Record<\n string,\n Record<string, { graph: { nodes: any[]; edges: any[] } }>\n >\n ): Record<\n string,\n Record<\n string,\n { workflowId: string; graph: { nodes: any[]; edges: any[] } }\n >\n > {\n const result: Record<\n string,\n Record<\n string,\n { workflowId: string; graph: { nodes: any[]; edges: any[] } }\n >\n > = {};\n if (!workflows) return result;\n\n // Build a normalized lookup for graphs since the graph extractor uses\n // paths from workflowId (e.g. \"./workflows/hello-agent\") while the\n // manifest uses source file paths (e.g. \"workflows/hello-agent.ts\").\n // Normalize by stripping leading \"./\" and file extensions.\n const normalizedGraphs = new Map<\n string,\n Record<string, { graph: { nodes: any[]; edges: any[] } }>\n >();\n for (const [graphPath, graphEntries] of Object.entries(graphs)) {\n const normalized = graphPath\n .replace(/^\\.\\//, '')\n .replace(/\\.[^/.]+$/, '');\n normalizedGraphs.set(normalized, graphEntries);\n }\n\n for (const [filePath, entries] of Object.entries(workflows)) {\n result[filePath] = {};\n // Normalize the manifest file path for lookup\n const normalizedFilePath = filePath\n .replace(/^\\.\\//, '')\n .replace(/\\.[^/.]+$/, '');\n\n const graphEntries =\n graphs[filePath] || normalizedGraphs.get(normalizedFilePath);\n\n for (const [name, data] of Object.entries(entries)) {\n result[filePath][name] = {\n workflowId: data.workflowId,\n graph: graphEntries?.[name]?.graph || { nodes: [], edges: [] },\n };\n }\n }\n return result;\n }\n\n private convertClassesManifest(\n classes: WorkflowManifest['classes']\n ): Record<string, Record<string, { classId: string }>> {\n const result: Record<string, Record<string, { classId: string }>> = {};\n if (!classes) return result;\n\n for (const [filePath, entries] of Object.entries(classes)) {\n result[filePath] = {};\n for (const [name, data] of Object.entries(entries)) {\n result[filePath][name] = { classId: data.classId };\n }\n }\n return result;\n }\n}\n"]}
|
package/dist/config-helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WorkflowConfig } from './types.js';
|
|
1
|
+
import type { SourcemapMode, WorkflowConfig } from './types.js';
|
|
2
2
|
export interface DecoratorOptions {
|
|
3
3
|
decorators: boolean;
|
|
4
4
|
legacyDecorator: boolean;
|
|
@@ -40,5 +40,6 @@ export declare function createBaseBuilderConfig(options: {
|
|
|
40
40
|
watch?: boolean;
|
|
41
41
|
externalPackages?: string[];
|
|
42
42
|
runtime?: string;
|
|
43
|
+
sourcemap?: SourcemapMode;
|
|
43
44
|
}): Omit<WorkflowConfig, 'buildTarget'>;
|
|
44
45
|
//# sourceMappingURL=config-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-helpers.d.ts","sourceRoot":"","sources":["../src/config-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"config-helpers.d.ts","sourceRoot":"","sources":["../src/config-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAsB,+BAA+B,CACnD,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAgC3B;AAED;;;;;;GAMG;AACH,wBAAsB,+BAA+B,CACnD,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,gBAAgB,CAAC,CAG3B;AAED;;;GAGG;AACH,wBAAsB,6CAA6C,CACjE,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,8BAA8B,CAAC,CAMzC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAatC"}
|
package/dist/config-helpers.js
CHANGED
|
@@ -72,6 +72,7 @@ export function createBaseBuilderConfig(options) {
|
|
|
72
72
|
webhookBundlePath: '', // Not used by base builder methods
|
|
73
73
|
externalPackages: options.externalPackages,
|
|
74
74
|
runtime: options.runtime,
|
|
75
|
+
sourcemap: options.sourcemap,
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
//# sourceMappingURL=config-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-helpers.js","sourceRoot":"","sources":["../src/config-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,YAAgC;IAEhC,MAAM,cAAc,GAAqB;QACvC,UAAU,EAAE,KAAK;QACjB,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,KAAK;KACzB,CAAC;IAEF,IAA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G,MAAM,MAAM,CAAC,CAAC,eAAe,EAAE,eAAe,CAAC,EAAE;QAClE,GAAG;KACJ,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,+BAA+B,CAAC,UAAU,CAAC,CAAC;IAClE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAQvC;IACC,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC;QACnC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,eAAe,EAAE,EAAE,EAAE,mCAAmC;QACxD,mBAAmB,EAAE,EAAE,EAAE,mCAAmC;QAC5D,iBAAiB,EAAE,EAAE,EAAE,mCAAmC;QAC1D,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { findUp } from 'find-up';\nimport JSON5 from 'json5';\nimport type { SourcemapMode, WorkflowConfig } from './types.js';\n\nexport interface DecoratorOptions {\n decorators: boolean;\n legacyDecorator: boolean;\n decoratorMetadata: boolean;\n}\n\nexport interface DecoratorOptionsWithConfigPath {\n options: DecoratorOptions;\n configPath: string | undefined;\n}\n\n/**\n * Reads tsconfig.json and extracts decorator-related compiler options.\n * Returns decorator options based on experimentalDecorators and emitDecoratorMetadata settings.\n *\n * @param tsconfigPath - Path to tsconfig.json or jsconfig.json\n * @returns DecoratorOptions with settings based on tsconfig compilerOptions\n */\nexport async function getDecoratorOptionsFromTsConfig(\n tsconfigPath: string | undefined\n): Promise<DecoratorOptions> {\n const defaultOptions: DecoratorOptions = {\n decorators: false,\n legacyDecorator: false,\n decoratorMetadata: false,\n };\n\n if (!tsconfigPath) {\n return defaultOptions;\n }\n\n try {\n const content = await readFile(tsconfigPath, 'utf-8');\n const tsconfig: { compilerOptions?: Record<string, unknown> } =\n JSON5.parse(content);\n const compilerOptions = tsconfig.compilerOptions || {};\n\n // Match Next.js behavior: enable decorators only when experimentalDecorators is true\n const experimentalDecorators =\n compilerOptions.experimentalDecorators === true;\n const emitDecoratorMetadata =\n compilerOptions.emitDecoratorMetadata === true;\n\n return {\n decorators: experimentalDecorators,\n legacyDecorator: experimentalDecorators,\n decoratorMetadata: experimentalDecorators && emitDecoratorMetadata,\n };\n } catch {\n // If we can't read or parse the tsconfig, return defaults\n return defaultOptions;\n }\n}\n\n/**\n * Finds tsconfig.json in the given directory (or ancestors) and extracts decorator options.\n * Combines tsconfig discovery with decorator option extraction for convenience.\n *\n * @param cwd - Directory to start searching for tsconfig.json\n * @returns DecoratorOptions with settings based on tsconfig compilerOptions\n */\nexport async function getDecoratorOptionsForDirectory(\n cwd: string\n): Promise<DecoratorOptions> {\n const { options } = await getDecoratorOptionsForDirectoryWithConfigPath(cwd);\n return options;\n}\n\n/**\n * Finds tsconfig.json/jsconfig.json in the given directory tree and returns\n * both decorator options and the config path used to derive them.\n */\nexport async function getDecoratorOptionsForDirectoryWithConfigPath(\n cwd: string\n): Promise<DecoratorOptionsWithConfigPath> {\n const configPath = await findUp(['tsconfig.json', 'jsconfig.json'], {\n cwd,\n });\n const options = await getDecoratorOptionsFromTsConfig(configPath);\n return { options, configPath };\n}\n\n/**\n * Creates a partial configuration for builders that don't use bundle paths directly.\n * Used by framework integrations like Nitro where the builder computes paths internally.\n */\nexport function createBaseBuilderConfig(options: {\n workingDir: string;\n projectRoot?: string;\n dirs?: string[];\n watch?: boolean;\n externalPackages?: string[];\n runtime?: string;\n sourcemap?: SourcemapMode;\n}): Omit<WorkflowConfig, 'buildTarget'> {\n return {\n dirs: options.dirs ?? ['workflows'],\n projectRoot: options.projectRoot,\n workingDir: options.workingDir,\n watch: options.watch,\n stepsBundlePath: '', // Not used by base builder methods\n workflowsBundlePath: '', // Not used by base builder methods\n webhookBundlePath: '', // Not used by base builder methods\n externalPackages: options.externalPackages,\n runtime: options.runtime,\n sourcemap: options.sourcemap,\n };\n}\n"]}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Queue trigger configuration for workflow
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
export declare const STEP_QUEUE_TRIGGER: {
|
|
6
|
-
type: "queue/v2beta";
|
|
7
|
-
topic: string;
|
|
8
|
-
consumer: string;
|
|
9
|
-
retryAfterSeconds: number;
|
|
10
|
-
initialDelaySeconds: number;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Queue trigger configuration for workflow orchestration.
|
|
14
|
-
* Workflows are queued to the __wkf_workflow_* topic.
|
|
2
|
+
* Queue trigger configuration for the workflow handler.
|
|
3
|
+
* Handles both workflow orchestration and step execution on the same route.
|
|
4
|
+
* Background steps are queued back to __wkf_workflow_* with a stepId.
|
|
15
5
|
*/
|
|
16
6
|
export declare const WORKFLOW_QUEUE_TRIGGER: {
|
|
17
7
|
type: "queue/v2beta";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;CAMlC,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Queue trigger configuration for workflow
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
export const STEP_QUEUE_TRIGGER = {
|
|
6
|
-
type: 'queue/v2beta',
|
|
7
|
-
topic: '__wkf_step_*',
|
|
8
|
-
consumer: 'default',
|
|
9
|
-
retryAfterSeconds: 5, // Delay between retries (default: 60)
|
|
10
|
-
initialDelaySeconds: 0, // Initial delay before first delivery (default: 0)
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Queue trigger configuration for workflow orchestration.
|
|
14
|
-
* Workflows are queued to the __wkf_workflow_* topic.
|
|
2
|
+
* Queue trigger configuration for the workflow handler.
|
|
3
|
+
* Handles both workflow orchestration and step execution on the same route.
|
|
4
|
+
* Background steps are queued back to __wkf_workflow_* with a stepId.
|
|
15
5
|
*/
|
|
16
6
|
export const WORKFLOW_QUEUE_TRIGGER = {
|
|
17
7
|
type: 'queue/v2beta',
|