@workflow/builders 5.0.0-beta.4 → 5.0.0-beta.5

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.
Files changed (55) hide show
  1. package/dist/base-builder.d.ts +69 -2
  2. package/dist/base-builder.d.ts.map +1 -1
  3. package/dist/base-builder.js +368 -19
  4. package/dist/base-builder.js.map +1 -1
  5. package/dist/config-helpers.d.ts +2 -1
  6. package/dist/config-helpers.d.ts.map +1 -1
  7. package/dist/config-helpers.js +1 -0
  8. package/dist/config-helpers.js.map +1 -1
  9. package/dist/constants.d.ts +3 -13
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/constants.js +3 -13
  12. package/dist/constants.js.map +1 -1
  13. package/dist/discover-entries-esbuild-plugin.d.ts.map +1 -1
  14. package/dist/discover-entries-esbuild-plugin.js +16 -1
  15. package/dist/discover-entries-esbuild-plugin.js.map +1 -1
  16. package/dist/external-package-warning.test.d.ts +2 -0
  17. package/dist/external-package-warning.test.d.ts.map +1 -0
  18. package/dist/external-package-warning.test.js +219 -0
  19. package/dist/external-package-warning.test.js.map +1 -0
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/module-specifier.d.ts.map +1 -1
  25. package/dist/module-specifier.js +47 -9
  26. package/dist/module-specifier.js.map +1 -1
  27. package/dist/module-specifier.test.js +20 -0
  28. package/dist/module-specifier.test.js.map +1 -1
  29. package/dist/node-module-esbuild-plugin.d.ts.map +1 -1
  30. package/dist/node-module-esbuild-plugin.js +72 -22
  31. package/dist/node-module-esbuild-plugin.js.map +1 -1
  32. package/dist/node-module-esbuild-plugin.test.js +96 -0
  33. package/dist/node-module-esbuild-plugin.test.js.map +1 -1
  34. package/dist/resolve-sourcemap.test.d.ts +2 -0
  35. package/dist/resolve-sourcemap.test.d.ts.map +1 -0
  36. package/dist/resolve-sourcemap.test.js +126 -0
  37. package/dist/resolve-sourcemap.test.js.map +1 -0
  38. package/dist/standalone.d.ts +0 -3
  39. package/dist/standalone.d.ts.map +1 -1
  40. package/dist/standalone.js +10 -39
  41. package/dist/standalone.js.map +1 -1
  42. package/dist/swc-esbuild-plugin.d.ts +9 -0
  43. package/dist/swc-esbuild-plugin.d.ts.map +1 -1
  44. package/dist/swc-esbuild-plugin.js +63 -8
  45. package/dist/swc-esbuild-plugin.js.map +1 -1
  46. package/dist/swc-esbuild-plugin.test.js +279 -3
  47. package/dist/swc-esbuild-plugin.test.js.map +1 -1
  48. package/dist/types.d.ts +29 -0
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/types.js.map +1 -1
  51. package/dist/vercel-build-output-api.d.ts +0 -2
  52. package/dist/vercel-build-output-api.d.ts.map +1 -1
  53. package/dist/vercel-build-output-api.js +24 -55
  54. package/dist/vercel-build-output-api.js.map +1 -1
  55. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"swc-esbuild-plugin.test.js","sourceRoot":"","sources":["../src/swc-esbuild-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,qBAAqB,EAAE,EAAE,CAAC,EAAE,EAAE;CAC/B,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAA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,OAAO,CAAC,YAAY,CAAC;YACnC,aAAa,EAAE,OAAO,CAAC,WAAW;YAClC,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,eAAe,CAAC;oBACd,IAAI,EAAE,UAAU;oBAChB,gBAAgB,EAAE,EAAE;iBACrB,CAAC;aACH;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,qBAAqB,CAAC,CAAC,oBAAoB,CAChD,iDAAiD,EACjD,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EACzC,UAAU,EACV,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,CACpB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n mkdirSync,\n mkdtempSync,\n realpathSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport * as esbuild from 'esbuild';\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\nconst { applySwcTransformMock } = vi.hoisted(() => ({\n applySwcTransformMock: vi.fn(),\n}));\n\nvi.mock('./apply-swc-transform.js', () => ({\n applySwcTransform: applySwcTransformMock,\n}));\n\nimport { createSwcPlugin } from './swc-esbuild-plugin.js';\n\nconst realTmpdir = realpathSync(tmpdir());\n\nfunction writeFile(path: string, contents = ''): void {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, contents, 'utf-8');\n}\n\ndescribe('createSwcPlugin externalizeNonSteps', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'workflow-swc-plugin-'));\n applySwcTransformMock.mockReset();\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n });\n\n afterEach(() => {\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n it.each([\n { inputExt: '.ts', outputExt: '.js' },\n { inputExt: '.tsx', outputExt: '.js' },\n { inputExt: '.mts', outputExt: '.mjs' },\n { inputExt: '.cts', outputExt: '.cjs' },\n ])('rewrites externalized $inputExt imports to $outputExt when rewriteTsExtensions is enabled', async ({\n inputExt,\n outputExt,\n }) => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(join(srcDir, `dep${inputExt}`), 'export const dep = {};');\n writeFile(stepFile, `import { dep } from './dep';\\nconsole.log(dep);`);\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n rewriteTsExtensions: true,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain(`/dep${outputExt}`);\n expect(output).not.toContain(`/dep${inputExt}`);\n });\n\n it('rewrites path-aliased imports to relative paths', async () => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const libDir = join(srcDir, 'lib');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(join(libDir, 'config.ts'), 'export const config = {};');\n writeFile(\n stepFile,\n `import { config } from '@/lib/config';\\nconsole.log(config);`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n alias: { '@': srcDir },\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n rewriteTsExtensions: true,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain('/lib/config.js');\n expect(output).not.toContain('@/lib/config');\n });\n\n it('does not relativize Node.js builtin imports', async () => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(\n stepFile,\n `import { createHash } from 'crypto';\\nimport { join } from 'node:path';\\nconsole.log(createHash, join);`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // Builtins should remain as bare specifiers, not relativized paths\n expect(output).toMatch(/from\\s+[\"']crypto[\"']/);\n expect(output).toMatch(/from\\s+[\"']node:path[\"']/);\n expect(output).not.toMatch(/from\\s+[\"']\\..*crypto[\"']/);\n expect(output).not.toMatch(/from\\s+[\"']\\..*node:path[\"']/);\n });\n\n it('does not externalize aliased imports that resolve into node_modules', async () => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n const nodeModulesDir = join(testRoot, 'node_modules', 'some-pkg');\n\n writeFile(join(nodeModulesDir, 'index.js'), 'export const pkg = \"hello\";');\n writeFile(stepFile, `import { pkg } from '@pkg';\\nconsole.log(pkg);`);\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n alias: { '@pkg': join(nodeModulesDir, 'index.js') },\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // Should be bundled (inlined), not externalized as a relative node_modules path\n expect(output).toContain('hello');\n expect(output).not.toMatch(/from\\s+[\"'].*node_modules/);\n });\n\n it.each([\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n ])('preserves externalized %s extensions by default', async (inputExt) => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(join(srcDir, `dep${inputExt}`), 'export const dep = {};');\n writeFile(stepFile, `import { dep } from './dep';\\nconsole.log(dep);`);\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain(`/dep${inputExt}`);\n });\n});\n\ndescribe('createSwcPlugin sideEffectEntries', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'workflow-swc-plugin-'));\n applySwcTransformMock.mockReset();\n });\n\n afterEach(() => {\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n /**\n * Helper: creates a fake node_modules package with `\"sideEffects\": false`\n * in its package.json and a single entry file that exports a side-effectful\n * registration call (simulating what the SWC transform produces).\n */\n function createSideEffectsFalsePackage(\n packageName: string,\n entryCode: string\n ): string {\n const pkgDir = join(testRoot, 'node_modules', packageName);\n writeFile(\n join(pkgDir, 'package.json'),\n JSON.stringify({\n name: packageName,\n version: '1.0.0',\n sideEffects: false,\n main: 'index.js',\n })\n );\n const entryPath = join(pkgDir, 'index.js');\n writeFile(entryPath, entryCode);\n return entryPath;\n }\n\n it('preserves bare imports of sideEffectEntries packages when bundling without entriesToBundle', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"my-pkg\");';\n const entryPath = createSideEffectsFalsePackage(\n 'my-side-effect-pkg',\n sideEffectCode\n );\n\n // SWC mock: return the code unchanged (the side effects are already there)\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'my-side-effect-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // The registration code should be present in the bundle\n expect(output).toContain('__registered');\n });\n\n it('drops bare imports when sideEffectEntries is NOT provided for sideEffects:false packages', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"my-pkg\");';\n createSideEffectsFalsePackage('my-dropped-pkg', sideEffectCode);\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'my-dropped-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // Without sideEffectEntries, esbuild drops the bare import\n expect(output).not.toContain('__registered');\n });\n\n it('produces no warnings for sideEffectEntries packages', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"warned-pkg\");';\n const entryPath = createSideEffectsFalsePackage(\n 'my-warned-pkg',\n sideEffectCode\n );\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'my-warned-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n // No \"ignored-bare-import\" warnings should be produced\n const sideEffectWarnings = result.warnings.filter(\n (w) => w.id === 'ignored-bare-import'\n );\n expect(sideEffectWarnings).toHaveLength(0);\n });\n\n it('preserves bare imports with entriesToBundle and sideEffectEntries together', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"bundled-pkg\");';\n const entryPath = createSideEffectsFalsePackage(\n 'my-bundled-pkg',\n sideEffectCode\n );\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const outdir = join(testRoot, 'out');\n const stepFile = join(testRoot, 'src', 'step.ts');\n writeFile(\n stepFile,\n `import 'my-bundled-pkg';\\nexport const POST = () => {};`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile, entryPath],\n outdir,\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // The registration code should be bundled in\n expect(output).toContain('__registered');\n });\n\n it('preserves bare imports for local files with sideEffects:false in their parent package.json', async () => {\n // Simulate a workspace package with sideEffects: false\n const pkgDir = join(testRoot, 'packages', 'shared');\n writeFile(\n join(pkgDir, 'package.json'),\n JSON.stringify({\n name: '@myorg/shared',\n version: '1.0.0',\n sideEffects: false,\n main: 'index.js',\n })\n );\n const sharedEntry = join(pkgDir, 'index.js');\n writeFile(sharedEntry, 'globalThis.__sharedRegistered = true;');\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n // Use a relative import to the local file (like the virtual entry does for local files)\n const result = await esbuild.build({\n stdin: {\n contents: `import './packages/shared/index.js';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n sideEffectEntries: [sharedEntry],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain('__sharedRegistered');\n });\n\n it('does not override sideEffects for non-entry modules', async () => {\n // Create two packages - one is a side-effect entry, one is not\n const sideEffectCode = 'globalThis.__entryRegistered = true;';\n const entryPath = createSideEffectsFalsePackage(\n 'entry-pkg',\n sideEffectCode\n );\n\n const nonEntryCode = 'globalThis.__nonEntryRegistered = true;';\n createSideEffectsFalsePackage('non-entry-pkg', nonEntryCode);\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'entry-pkg';\\nimport 'non-entry-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n // Only entry-pkg is listed, non-entry-pkg is not\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // entry-pkg should be preserved\n expect(output).toContain('__entryRegistered');\n // non-entry-pkg should be dropped (sideEffects: false is respected)\n expect(output).not.toContain('__nonEntryRegistered');\n });\n});\n\ndescribe('createSwcPlugin projectRoot', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'workflow-swc-plugin-'));\n applySwcTransformMock.mockReset();\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n });\n\n afterEach(() => {\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n function setupFixture() {\n const appRoot = join(testRoot, 'apps', 'chat');\n const packageRoot = join(testRoot, 'packages', 'vade');\n const workflowFile = join(\n packageRoot,\n 'src',\n 'internal',\n 'message',\n 'workflow',\n 'handle-message.ts'\n );\n\n writeFile(\n workflowFile,\n `export async function handleMessageWorkflow(message) {\n \"use workflow\";\n\n return message;\n}\n`\n );\n\n return {\n appRoot,\n packageRoot,\n workflowFile,\n };\n }\n\n it('passes the explicit projectRoot through to applySwcTransform', async () => {\n const fixture = setupFixture();\n\n const result = await esbuild.build({\n entryPoints: [fixture.workflowFile],\n absWorkingDir: fixture.packageRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n projectRoot: fixture.appRoot,\n workflowManifest: {},\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n expect(applySwcTransformMock).toHaveBeenCalledWith(\n 'src/internal/message/workflow/handle-message.ts',\n expect.stringContaining('\"use workflow\"'),\n 'workflow',\n fixture.workflowFile,\n fixture.appRoot\n );\n });\n\n it('defaults the transform projectRoot to absWorkingDir', async () => {\n const fixture = setupFixture();\n\n const result = await esbuild.build({\n entryPoints: [fixture.workflowFile],\n absWorkingDir: fixture.packageRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n workflowManifest: {},\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n expect(applySwcTransformMock).toHaveBeenCalledWith(\n 'src/internal/message/workflow/handle-message.ts',\n expect.stringContaining('\"use workflow\"'),\n 'workflow',\n fixture.workflowFile,\n fixture.packageRoot\n );\n });\n});\n"]}
1
+ {"version":3,"file":"swc-esbuild-plugin.test.js","sourceRoot":"","sources":["../src/swc-esbuild-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,qBAAqB,EAAE,EAAE,CAAC,EAAE,EAAE;CAC/B,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,CAAC;IACzC,iBAAiB,EAAE,qBAAqB;CACzC,CAAC,CAAC,CAAC;AAEJ,OAAO,EACL,2BAA2B,EAC3B,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;AAE1C,SAAS,SAAS,CAAC,IAAY,EAAE,QAAQ,GAAG,EAAE;IAC5C,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,Q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,OAAO,CAAC,WAAW,CACpB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n mkdirSync,\n mkdtempSync,\n realpathSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport * as esbuild from 'esbuild';\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\nconst { applySwcTransformMock } = vi.hoisted(() => ({\n applySwcTransformMock: vi.fn(),\n}));\n\nvi.mock('./apply-swc-transform.js', () => ({\n applySwcTransform: applySwcTransformMock,\n}));\n\nimport {\n createDiscoverEntriesPlugin,\n importParents,\n} from './discover-entries-esbuild-plugin.js';\nimport { createSwcPlugin } from './swc-esbuild-plugin.js';\n\nconst realTmpdir = realpathSync(tmpdir());\n\nfunction writeFile(path: string, contents = ''): void {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, contents, 'utf-8');\n}\n\ndescribe('createSwcPlugin externalizeNonSteps', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'workflow-swc-plugin-'));\n importParents.clear();\n applySwcTransformMock.mockReset();\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n });\n\n afterEach(() => {\n importParents.clear();\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n it.each([\n { inputExt: '.ts', outputExt: '.js' },\n { inputExt: '.tsx', outputExt: '.js' },\n { inputExt: '.mts', outputExt: '.mjs' },\n { inputExt: '.cts', outputExt: '.cjs' },\n ])('rewrites externalized $inputExt imports to $outputExt when rewriteTsExtensions is enabled', async ({\n inputExt,\n outputExt,\n }) => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(join(srcDir, `dep${inputExt}`), 'export const dep = {};');\n writeFile(stepFile, `import { dep } from './dep';\\nconsole.log(dep);`);\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n rewriteTsExtensions: true,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain(`/dep${outputExt}`);\n expect(output).not.toContain(`/dep${inputExt}`);\n });\n\n it('bundles path-aliased project-local imports inline', async () => {\n // Aliased project-local files must be bundled inline (not externalized\n // as relative paths) because their source on disk may contain further\n // alias imports that Node's ESM loader cannot resolve at runtime.\n // See packages/builders/src/swc-esbuild-plugin.ts for full reasoning.\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const libDir = join(srcDir, 'lib');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(\n join(libDir, 'config.ts'),\n 'export const config = { value: \"hello-from-config\" };'\n );\n writeFile(\n stepFile,\n `import { config } from '@/lib/config';\\nconsole.log(config);`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n alias: { '@': srcDir },\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n rewriteTsExtensions: true,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // The aliased helper should be bundled inline (its content is in the\n // output), not externalized as a relative path or left as a bare alias.\n expect(output).toContain('hello-from-config');\n expect(output).not.toContain('@/lib/config');\n expect(output).not.toMatch(/from\\s+[\"'][^\"']*\\/lib\\/config\\.(js|ts)[\"']/);\n });\n\n it('bundles transitive aliased imports inside aliased helpers (Mux self-referencing package regression)', async () => {\n // Regression test for https://github.com/muxinc/ai/pull/193.\n //\n // A package self-references its own subpath via tsconfig `paths` (e.g.\n // `@my-pkg/lib/foo` → `src/lib/foo.ts`). A step file imports a helper\n // via the alias, and that helper imports another helper via the alias.\n //\n // Previously the helpers were externalized as relative paths, but their\n // source on disk still contained `import \"@my-pkg/lib/...\"`. At runtime,\n // Node's ESM loader didn't know about tsconfig paths, fell through to\n // the package's `exports` map, and threw `Package subpath ... is not\n // defined by \"exports\"`.\n //\n // With the fix, aliased project-local files are bundled inline, so\n // their alias imports are resolved at build time.\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const libDir = join(srcDir, 'lib');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(\n join(libDir, 'providers.ts'),\n 'export const providerName = \"anthropic\";'\n );\n writeFile(\n join(libDir, 'client-factory.ts'),\n // Helper uses the same alias to reach a sibling — this is the case\n // that broke the Mux build with workflow >= 4.2.0-beta.78.\n `import { providerName } from '@my-pkg/lib/providers';\nexport const client = { provider: providerName };`\n );\n writeFile(\n stepFile,\n `import { client } from '@my-pkg/lib/client-factory';\\nconsole.log(client);`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n alias: { '@my-pkg': srcDir },\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n rewriteTsExtensions: true,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // Both helpers should be bundled inline — no aliased specifiers should\n // leak into the output, where Node's ESM loader would choke on them.\n expect(output).toContain('anthropic');\n expect(output).not.toContain('@my-pkg/lib/providers');\n expect(output).not.toContain('@my-pkg/lib/client-factory');\n });\n\n it('does not relativize Node.js builtin imports', async () => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(\n stepFile,\n `import { createHash } from 'crypto';\\nimport { join } from 'node:path';\\nconsole.log(createHash, join);`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // Builtins should remain as bare specifiers, not relativized paths\n expect(output).toMatch(/from\\s+[\"']crypto[\"']/);\n expect(output).toMatch(/from\\s+[\"']node:path[\"']/);\n expect(output).not.toMatch(/from\\s+[\"']\\..*crypto[\"']/);\n expect(output).not.toMatch(/from\\s+[\"']\\..*node:path[\"']/);\n });\n\n it('does not externalize aliased imports that resolve into node_modules', async () => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n const nodeModulesDir = join(testRoot, 'node_modules', 'some-pkg');\n\n writeFile(join(nodeModulesDir, 'index.js'), 'export const pkg = \"hello\";');\n writeFile(stepFile, `import { pkg } from '@pkg';\\nconsole.log(pkg);`);\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n alias: { '@pkg': join(nodeModulesDir, 'index.js') },\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // Should be bundled (inlined), not externalized as a relative node_modules path\n expect(output).toContain('hello');\n expect(output).not.toMatch(/from\\s+[\"'].*node_modules/);\n });\n\n it('externalizes nested bare package imports that only resolve from a bundled package', async () => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n const parentPkgDir = join(testRoot, 'node_modules', 'parent-pkg');\n const parentPkgIndex = join(parentPkgDir, 'index.js');\n const nativePkgDir = join(parentPkgDir, 'node_modules', 'optional-native');\n\n writeFile(\n join(parentPkgDir, 'package.json'),\n JSON.stringify({ name: 'parent-pkg', main: 'index.js' })\n );\n writeFile(\n parentPkgIndex,\n `const native = require('optional-native');\\nexports.value = native.value;`\n );\n writeFile(\n join(nativePkgDir, 'package.json'),\n JSON.stringify({ name: 'optional-native', main: 'binding.node' })\n );\n writeFile(join(nativePkgDir, 'binding.node'), '');\n writeFile(\n stepFile,\n `import { value } from 'parent-pkg';\\nconsole.log(value);`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile, parentPkgIndex],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain('optional-native');\n expect(output).not.toContain('binding.node');\n });\n\n it.each([\n '.ts',\n '.tsx',\n '.mts',\n '.cts',\n ])('preserves externalized %s extensions by default', async (inputExt) => {\n const outdir = join(testRoot, 'out');\n const srcDir = join(testRoot, 'src');\n const stepFile = join(srcDir, 'step.ts');\n\n writeFile(join(srcDir, `dep${inputExt}`), 'export const dep = {};');\n writeFile(stepFile, `import { dep } from './dep';\\nconsole.log(dep);`);\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain(`/dep${inputExt}`);\n });\n\n it('bundles transitive local TypeScript dependencies with extensionless imports', async () => {\n const outdir = join(testRoot, 'out');\n const stepFile = join(testRoot, 'server', 'workflows', 'my-workflow.ts');\n const constantsFile = join(testRoot, 'shared', 'constants.ts');\n const helpersFile = join(testRoot, 'shared', 'helpers.ts');\n\n writeFile(helpersFile, `export const HELPER_VALUE = \"from-helper\";`);\n writeFile(\n constantsFile,\n `import { HELPER_VALUE } from './helpers';\\nexport const CATEGORIES = [HELPER_VALUE];`\n );\n writeFile(\n stepFile,\n `import { CATEGORIES } from '../../shared/constants';\\nexport async function myStep() {\\n 'use step';\\n return CATEGORIES[0];\\n}`\n );\n\n const state = {\n discoveredSteps: new Set<string>(),\n discoveredWorkflows: new Set<string>(),\n discoveredSerdeFiles: new Set<string>(),\n };\n await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],\n plugins: [createDiscoverEntriesPlugin(state, testRoot)],\n });\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n bundleTransitiveLocalStepDependencies: true,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain('from-helper');\n expect(output).not.toMatch(/from\\s+[\"'][^\"']*shared\\/constants/);\n expect(output).not.toMatch(/from\\s+[\"'][^\"']*shared\\/helpers/);\n });\n\n it('externalizes transitive local TypeScript dependencies by default', async () => {\n const outdir = join(testRoot, 'out');\n const stepFile = join(testRoot, 'server', 'workflows', 'my-workflow.ts');\n const constantsFile = join(testRoot, 'shared', 'constants.ts');\n const helpersFile = join(testRoot, 'shared', 'helpers.ts');\n\n writeFile(helpersFile, `export const HELPER_VALUE = \"from-helper\";`);\n writeFile(\n constantsFile,\n `import { HELPER_VALUE } from './helpers';\\nexport const CATEGORIES = [HELPER_VALUE];`\n );\n writeFile(\n stepFile,\n `import { CATEGORIES } from '../../shared/constants';\\nexport async function myStep() {\\n 'use step';\\n return CATEGORIES[0];\\n}`\n );\n\n const state = {\n discoveredSteps: new Set<string>(),\n discoveredWorkflows: new Set<string>(),\n discoveredSerdeFiles: new Set<string>(),\n };\n await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],\n plugins: [createDiscoverEntriesPlugin(state, testRoot)],\n });\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).not.toContain('from-helper');\n expect(output).toMatch(/from\\s+[\"'][^\"']*shared\\/constants\\.ts[\"']/);\n });\n\n it('keeps ordinary package dependencies external when reachable from a bundled step', async () => {\n const outdir = join(testRoot, 'out');\n const stepFile = join(testRoot, 'server', 'workflows', 'my-workflow.ts');\n const pkgDir = join(testRoot, 'node_modules', 'plain-pkg');\n const pkgIndex = join(pkgDir, 'index.js');\n\n writeFile(\n join(pkgDir, 'package.json'),\n JSON.stringify({ name: 'plain-pkg', main: 'index.js' })\n );\n writeFile(pkgIndex, `export const value = \"from-package\";`);\n writeFile(\n stepFile,\n `import { value } from 'plain-pkg';\\nexport async function myStep() {\\n 'use step';\\n return value;\\n}`\n );\n\n const state = {\n discoveredSteps: new Set<string>(),\n discoveredWorkflows: new Set<string>(),\n discoveredSerdeFiles: new Set<string>(),\n };\n await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [createDiscoverEntriesPlugin(state, testRoot)],\n });\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile],\n outdir,\n bundleTransitiveLocalStepDependencies: true,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toMatch(/from\\s+[\"']plain-pkg[\"']/);\n expect(output).not.toContain('from-package');\n });\n\n it('bundles package parents when they lead to discovered workflow-related entries', async () => {\n const outdir = join(testRoot, 'out');\n const stepFile = join(testRoot, 'server', 'workflows', 'my-workflow.ts');\n const pkgDir = join(testRoot, 'node_modules', 'workflow-pkg');\n const pkgIndex = join(pkgDir, 'index.js');\n const pkgSerde = join(pkgDir, 'serde.js');\n\n writeFile(\n join(pkgDir, 'package.json'),\n JSON.stringify({ name: 'workflow-pkg', main: 'index.js' })\n );\n writeFile(pkgSerde, `export const value = \"from-serde\";`);\n writeFile(pkgIndex, `export { value } from './serde.js';`);\n writeFile(\n stepFile,\n `import { value } from 'workflow-pkg';\\nexport async function myStep() {\\n 'use step';\\n return value;\\n}`\n );\n\n const state = {\n discoveredSteps: new Set<string>(),\n discoveredWorkflows: new Set<string>(),\n discoveredSerdeFiles: new Set<string>(),\n };\n await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [createDiscoverEntriesPlugin(state, testRoot)],\n });\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile, pkgSerde],\n outdir,\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain('from-serde');\n expect(output).not.toMatch(/from\\s+[\"']workflow-pkg[\"']/);\n });\n});\n\ndescribe('createSwcPlugin sideEffectEntries', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'workflow-swc-plugin-'));\n applySwcTransformMock.mockReset();\n });\n\n afterEach(() => {\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n /**\n * Helper: creates a fake node_modules package with `\"sideEffects\": false`\n * in its package.json and a single entry file that exports a side-effectful\n * registration call (simulating what the SWC transform produces).\n */\n function createSideEffectsFalsePackage(\n packageName: string,\n entryCode: string\n ): string {\n const pkgDir = join(testRoot, 'node_modules', packageName);\n writeFile(\n join(pkgDir, 'package.json'),\n JSON.stringify({\n name: packageName,\n version: '1.0.0',\n sideEffects: false,\n main: 'index.js',\n })\n );\n const entryPath = join(pkgDir, 'index.js');\n writeFile(entryPath, entryCode);\n return entryPath;\n }\n\n it('preserves bare imports of sideEffectEntries packages when bundling without entriesToBundle', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"my-pkg\");';\n const entryPath = createSideEffectsFalsePackage(\n 'my-side-effect-pkg',\n sideEffectCode\n );\n\n // SWC mock: return the code unchanged (the side effects are already there)\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'my-side-effect-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // The registration code should be present in the bundle\n expect(output).toContain('__registered');\n });\n\n it('drops bare imports when sideEffectEntries is NOT provided for sideEffects:false packages', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"my-pkg\");';\n createSideEffectsFalsePackage('my-dropped-pkg', sideEffectCode);\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'my-dropped-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // Without sideEffectEntries, esbuild drops the bare import\n expect(output).not.toContain('__registered');\n });\n\n it('produces no warnings for sideEffectEntries packages', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"warned-pkg\");';\n const entryPath = createSideEffectsFalsePackage(\n 'my-warned-pkg',\n sideEffectCode\n );\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'my-warned-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n // No \"ignored-bare-import\" warnings should be produced\n const sideEffectWarnings = result.warnings.filter(\n (w) => w.id === 'ignored-bare-import'\n );\n expect(sideEffectWarnings).toHaveLength(0);\n });\n\n it('preserves bare imports with entriesToBundle and sideEffectEntries together', async () => {\n const sideEffectCode =\n 'globalThis.__registered = globalThis.__registered || [];\\nglobalThis.__registered.push(\"bundled-pkg\");';\n const entryPath = createSideEffectsFalsePackage(\n 'my-bundled-pkg',\n sideEffectCode\n );\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const outdir = join(testRoot, 'out');\n const stepFile = join(testRoot, 'src', 'step.ts');\n writeFile(\n stepFile,\n `import 'my-bundled-pkg';\\nexport const POST = () => {};`\n );\n\n const result = await esbuild.build({\n entryPoints: [stepFile],\n absWorkingDir: testRoot,\n outdir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'step',\n entriesToBundle: [stepFile, entryPath],\n outdir,\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // The registration code should be bundled in\n expect(output).toContain('__registered');\n });\n\n it('preserves bare imports for local files with sideEffects:false in their parent package.json', async () => {\n // Simulate a workspace package with sideEffects: false\n const pkgDir = join(testRoot, 'packages', 'shared');\n writeFile(\n join(pkgDir, 'package.json'),\n JSON.stringify({\n name: '@myorg/shared',\n version: '1.0.0',\n sideEffects: false,\n main: 'index.js',\n })\n );\n const sharedEntry = join(pkgDir, 'index.js');\n writeFile(sharedEntry, 'globalThis.__sharedRegistered = true;');\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n // Use a relative import to the local file (like the virtual entry does for local files)\n const result = await esbuild.build({\n stdin: {\n contents: `import './packages/shared/index.js';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n sideEffectEntries: [sharedEntry],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n expect(output).toContain('__sharedRegistered');\n });\n\n it('does not override sideEffects for non-entry modules', async () => {\n // Create two packages - one is a side-effect entry, one is not\n const sideEffectCode = 'globalThis.__entryRegistered = true;';\n const entryPath = createSideEffectsFalsePackage(\n 'entry-pkg',\n sideEffectCode\n );\n\n const nonEntryCode = 'globalThis.__nonEntryRegistered = true;';\n createSideEffectsFalsePackage('non-entry-pkg', nonEntryCode);\n\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n\n const result = await esbuild.build({\n stdin: {\n contents: `import 'entry-pkg';\\nimport 'non-entry-pkg';`,\n resolveDir: testRoot,\n sourcefile: 'virtual-entry.js',\n loader: 'js',\n },\n absWorkingDir: testRoot,\n bundle: true,\n format: 'cjs',\n platform: 'node',\n write: false,\n treeShaking: true,\n logLevel: 'silent',\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n // Only entry-pkg is listed, non-entry-pkg is not\n sideEffectEntries: [entryPath],\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n const output = result.outputFiles[0].text;\n // entry-pkg should be preserved\n expect(output).toContain('__entryRegistered');\n // non-entry-pkg should be dropped (sideEffects: false is respected)\n expect(output).not.toContain('__nonEntryRegistered');\n });\n});\n\ndescribe('createSwcPlugin projectRoot', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'workflow-swc-plugin-'));\n applySwcTransformMock.mockReset();\n applySwcTransformMock.mockImplementation(\n async (_filename: string, source: string) => ({\n code: source,\n workflowManifest: {},\n })\n );\n });\n\n afterEach(() => {\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n function setupFixture() {\n const appRoot = join(testRoot, 'apps', 'chat');\n const packageRoot = join(testRoot, 'packages', 'vade');\n const workflowFile = join(\n packageRoot,\n 'src',\n 'internal',\n 'message',\n 'workflow',\n 'handle-message.ts'\n );\n\n writeFile(\n workflowFile,\n `export async function handleMessageWorkflow(message) {\n \"use workflow\";\n\n return message;\n}\n`\n );\n\n return {\n appRoot,\n packageRoot,\n workflowFile,\n };\n }\n\n it('passes the explicit projectRoot through to applySwcTransform', async () => {\n const fixture = setupFixture();\n\n const result = await esbuild.build({\n entryPoints: [fixture.workflowFile],\n absWorkingDir: fixture.packageRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n projectRoot: fixture.appRoot,\n workflowManifest: {},\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n expect(applySwcTransformMock).toHaveBeenCalledWith(\n 'src/internal/message/workflow/handle-message.ts',\n expect.stringContaining('\"use workflow\"'),\n 'workflow',\n fixture.workflowFile,\n fixture.appRoot\n );\n });\n\n it('defaults the transform projectRoot to absWorkingDir', async () => {\n const fixture = setupFixture();\n\n const result = await esbuild.build({\n entryPoints: [fixture.workflowFile],\n absWorkingDir: fixture.packageRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [\n createSwcPlugin({\n mode: 'workflow',\n workflowManifest: {},\n }),\n ],\n });\n\n expect(result.errors).toHaveLength(0);\n expect(applySwcTransformMock).toHaveBeenCalledWith(\n 'src/internal/message/workflow/handle-message.ts',\n expect.stringContaining('\"use workflow\"'),\n 'workflow',\n fixture.workflowFile,\n fixture.packageRoot\n );\n });\n});\n"]}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,16 @@
1
1
  export declare const validBuildTargets: readonly ["standalone", "vercel-build-output-api", "next", "nest", "sveltekit", "astro"];
2
2
  export type BuildTarget = (typeof validBuildTargets)[number];
3
+ /**
4
+ * Source map emission mode for generated workflow bundles. Matches esbuild's
5
+ * `sourcemap` option vocabulary:
6
+ *
7
+ * - `true` / `'linked'`: write a separate `.map` file and add a `sourceMappingURL` comment
8
+ * - `'inline'`: emit a base64-encoded source map at the end of the bundle
9
+ * - `'external'`: write a separate `.map` file without the comment
10
+ * - `'both'`: emit both inline and external source maps
11
+ * - `false`: omit source maps entirely
12
+ */
13
+ export type SourcemapMode = boolean | 'inline' | 'linked' | 'external' | 'both';
3
14
  /**
4
15
  * Common configuration options shared across all builder types.
5
16
  */
@@ -23,6 +34,24 @@ interface BaseWorkflowConfig {
23
34
  suppressCreateWebhookBundleLogs?: boolean;
24
35
  suppressCreateManifestLogs?: boolean;
25
36
  runtime?: string;
37
+ /**
38
+ * Controls how source maps are emitted for workflow bundles. Accepts the
39
+ * same values as esbuild's `sourcemap` option.
40
+ *
41
+ * Default is `'inline'` for the step bundle and intermediate workflow
42
+ * bundle (gives readable stack traces for step errors and workflow VM
43
+ * errors). Setting `false` omits source maps entirely, which produces
44
+ * smaller bundles — useful for staying under the Vercel 250MB function
45
+ * limit — at the cost of stack traces that reference generated code.
46
+ *
47
+ * `'external'` and `'linked'` write a separate `.map` file; use these
48
+ * when you want to ship source maps to observability tooling but keep
49
+ * them out of the function bundle.
50
+ *
51
+ * Can also be set via the `WORKFLOW_SOURCEMAP` environment variable;
52
+ * config wins over env var, env var wins over the default.
53
+ */
54
+ sourcemap?: SourcemapMode;
26
55
  }
27
56
  /**
28
57
  * Configuration for standalone (CLI-based) builds.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,0FAOpB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D;;GAEG;AACH,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAG9B,eAAe,CAAC,EAAE,MAAM,CAAC;IAIzB,cAAc,CAAC,EA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;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,uBAAuB,GACvB,UAAU,GACV,UAAU,GACV,eAAe,GACf,WAAW,CAAC;AAEhB,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,IAAI,WAAW,CAEvB"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,YAAY;IACZ,yBAAyB;IACzB,MAAM;IACN,MAAM;IACN,WAAW;IACX,OAAO;CACC,CAAC;AAgIX,MAAM,UAAU,kBAAkB,CAChC,MAA0B;IAE1B,OAAO,CAAC,CAAC,MAAM,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAqB,CAAC,CAAC;AACvE,CAAC","sourcesContent":["export const validBuildTargets = [\n 'standalone',\n 'vercel-build-output-api',\n 'next',\n 'nest',\n 'sveltekit',\n 'astro',\n] as const;\nexport type BuildTarget = (typeof validBuildTargets)[number];\n\n/**\n * Common configuration options shared across all builder types.\n */\ninterface BaseWorkflowConfig {\n watch?: boolean;\n dirs: string[];\n workingDir: string;\n /**\n * Project root used for package and workspace module-specifier resolution\n * during SWC transforms. Defaults to `workingDir`.\n */\n projectRoot?: string;\n\n // Optionally generate a client library for workflow execution. The preferred\n // method of using workflow is to use a loader within a framework (like\n // NextJS) that resolves client bindings on the fly.\n clientBundlePath?: string;\n\n externalPackages?: string[];\n\n workflowManifestPath?: string;\n\n // Optional prefix for debug files (e.g., \"_\" for Astro to ignore them)\n debugFilePrefix?: string;\n\n // Optional directory where diagnostics artifacts should be written.\n // The workflow manifest is written to workflows-manifest.json inside this dir.\n diagnosticsDir?: string;\n\n // Optional framework output directory, used by builders that mirror framework\n // artifact locations.\n distDir?: string;\n\n // Suppress informational logs emitted by createWorkflowsBundle()\n // (e.g. intermediate/final workflow bundle timing logs).\n suppressCreateWorkflowsBundleLogs?: boolean;\n\n // Suppress esbuild warnings emitted by createWorkflowsBundle().\n suppressCreateWorkflowsBundleWarnings?: boolean;\n\n // Suppress informational logs emitted by createWebhookBundle().\n suppressCreateWebhookBundleLogs?: boolean;\n\n // Suppress informational logs emitted by createManifest().\n suppressCreateManifestLogs?: boolean;\n\n // Node.js runtime version for Vercel Functions (e.g., \"nodejs22.x\", \"nodejs24.x\")\n runtime?: string;\n}\n\n/**\n * Configuration for standalone (CLI-based) builds.\n */\nexport interface StandaloneConfig extends BaseWorkflowConfig {\n buildTarget: 'standalone';\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for Vercel Build Output API builds.\n */\nexport interface VercelBuildOutputConfig extends BaseWorkflowConfig {\n buildTarget: 'vercel-build-output-api';\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for Next.js builds.\n */\nexport interface NextConfig extends BaseWorkflowConfig {\n buildTarget: 'next';\n // Next.js builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for SvelteKit builds.\n */\nexport interface SvelteKitConfig extends BaseWorkflowConfig {\n buildTarget: 'sveltekit';\n // SvelteKit builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for Astro builds.\n */\nexport interface AstroConfig extends BaseWorkflowConfig {\n buildTarget: 'astro';\n // Astro builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for NestJS builds.\n */\nexport interface NestConfig extends BaseWorkflowConfig {\n buildTarget: 'nest';\n // NestJS builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Discriminated union of all builder configuration types.\n */\nexport type WorkflowConfig =\n | StandaloneConfig\n | VercelBuildOutputConfig\n | NextConfig\n | NestConfig\n | SvelteKitConfig\n | AstroConfig;\n\nexport function isValidBuildTarget(\n target: string | undefined\n): target is BuildTarget {\n return !!target && validBuildTargets.includes(target as BuildTarget);\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,YAAY;IACZ,yBAAyB;IACzB,MAAM;IACN,MAAM;IACN,WAAW;IACX,OAAO;CACC,CAAC;AA+JX,MAAM,UAAU,kBAAkB,CAChC,MAA0B;IAE1B,OAAO,CAAC,CAAC,MAAM,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAqB,CAAC,CAAC;AACvE,CAAC","sourcesContent":["export const validBuildTargets = [\n 'standalone',\n 'vercel-build-output-api',\n 'next',\n 'nest',\n 'sveltekit',\n 'astro',\n] as const;\nexport type BuildTarget = (typeof validBuildTargets)[number];\n\n/**\n * Source map emission mode for generated workflow bundles. Matches esbuild's\n * `sourcemap` option vocabulary:\n *\n * - `true` / `'linked'`: write a separate `.map` file and add a `sourceMappingURL` comment\n * - `'inline'`: emit a base64-encoded source map at the end of the bundle\n * - `'external'`: write a separate `.map` file without the comment\n * - `'both'`: emit both inline and external source maps\n * - `false`: omit source maps entirely\n */\nexport type SourcemapMode = boolean | 'inline' | 'linked' | 'external' | 'both';\n\n/**\n * Common configuration options shared across all builder types.\n */\ninterface BaseWorkflowConfig {\n watch?: boolean;\n dirs: string[];\n workingDir: string;\n /**\n * Project root used for package and workspace module-specifier resolution\n * during SWC transforms. Defaults to `workingDir`.\n */\n projectRoot?: string;\n\n // Optionally generate a client library for workflow execution. The preferred\n // method of using workflow is to use a loader within a framework (like\n // NextJS) that resolves client bindings on the fly.\n clientBundlePath?: string;\n\n externalPackages?: string[];\n\n workflowManifestPath?: string;\n\n // Optional prefix for debug files (e.g., \"_\" for Astro to ignore them)\n debugFilePrefix?: string;\n\n // Optional directory where diagnostics artifacts should be written.\n // The workflow manifest is written to workflows-manifest.json inside this dir.\n diagnosticsDir?: string;\n\n // Optional framework output directory, used by builders that mirror framework\n // artifact locations.\n distDir?: string;\n\n // Suppress informational logs emitted by createWorkflowsBundle()\n // (e.g. intermediate/final workflow bundle timing logs).\n suppressCreateWorkflowsBundleLogs?: boolean;\n\n // Suppress esbuild warnings emitted by createWorkflowsBundle().\n suppressCreateWorkflowsBundleWarnings?: boolean;\n\n // Suppress informational logs emitted by createWebhookBundle().\n suppressCreateWebhookBundleLogs?: boolean;\n\n // Suppress informational logs emitted by createManifest().\n suppressCreateManifestLogs?: boolean;\n\n // Node.js runtime version for Vercel Functions (e.g., \"nodejs22.x\", \"nodejs24.x\")\n runtime?: string;\n\n /**\n * Controls how source maps are emitted for workflow bundles. Accepts the\n * same values as esbuild's `sourcemap` option.\n *\n * Default is `'inline'` for the step bundle and intermediate workflow\n * bundle (gives readable stack traces for step errors and workflow VM\n * errors). Setting `false` omits source maps entirely, which produces\n * smaller bundles — useful for staying under the Vercel 250MB function\n * limit — at the cost of stack traces that reference generated code.\n *\n * `'external'` and `'linked'` write a separate `.map` file; use these\n * when you want to ship source maps to observability tooling but keep\n * them out of the function bundle.\n *\n * Can also be set via the `WORKFLOW_SOURCEMAP` environment variable;\n * config wins over env var, env var wins over the default.\n */\n sourcemap?: SourcemapMode;\n}\n\n/**\n * Configuration for standalone (CLI-based) builds.\n */\nexport interface StandaloneConfig extends BaseWorkflowConfig {\n buildTarget: 'standalone';\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for Vercel Build Output API builds.\n */\nexport interface VercelBuildOutputConfig extends BaseWorkflowConfig {\n buildTarget: 'vercel-build-output-api';\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for Next.js builds.\n */\nexport interface NextConfig extends BaseWorkflowConfig {\n buildTarget: 'next';\n // Next.js builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for SvelteKit builds.\n */\nexport interface SvelteKitConfig extends BaseWorkflowConfig {\n buildTarget: 'sveltekit';\n // SvelteKit builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for Astro builds.\n */\nexport interface AstroConfig extends BaseWorkflowConfig {\n buildTarget: 'astro';\n // Astro builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Configuration for NestJS builds.\n */\nexport interface NestConfig extends BaseWorkflowConfig {\n buildTarget: 'nest';\n // NestJS builder computes paths dynamically, so these are not used\n stepsBundlePath: string;\n workflowsBundlePath: string;\n webhookBundlePath: string;\n}\n\n/**\n * Discriminated union of all builder configuration types.\n */\nexport type WorkflowConfig =\n | StandaloneConfig\n | VercelBuildOutputConfig\n | NextConfig\n | NestConfig\n | SvelteKitConfig\n | AstroConfig;\n\nexport function isValidBuildTarget(\n target: string | undefined\n): target is BuildTarget {\n return !!target && validBuildTargets.includes(target as BuildTarget);\n}\n"]}
@@ -1,8 +1,6 @@
1
1
  import { BaseBuilder } from './base-builder.js';
2
2
  export declare class VercelBuildOutputAPIBuilder extends BaseBuilder {
3
3
  build(): Promise<void>;
4
- private buildStepsFunction;
5
- private buildWorkflowsFunction;
6
4
  private buildWebhookFunction;
7
5
  private createBuildOutputConfig;
8
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vercel-build-output-api.d.ts","sourceRoot":"","sources":["../src/vercel-build-output-api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,qBAAa,2BAA4B,SAAQ,WAAW;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAuDd,kBAAkB;YAiClB,sBAAsB;YA+BtB,oBAAoB;YAyBpB,uBAAuB;CA0BtC"}
1
+ {"version":3,"file":"vercel-build-output-api.d.ts","sourceRoot":"","sources":["../src/vercel-build-output-api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,qBAAa,2BAA4B,SAAQ,WAAW;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAmEd,oBAAoB;YAyBpB,uBAAuB;CAuBtC"}
@@ -1,7 +1,7 @@
1
1
  import { copyFile, mkdir, writeFile } from 'node:fs/promises';
2
2
  import { join, resolve } from 'node:path';
3
3
  import { BaseBuilder } from './base-builder.js';
4
- import { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
4
+ import { WORKFLOW_QUEUE_TRIGGER } from './constants.js';
5
5
  export class VercelBuildOutputAPIBuilder extends BaseBuilder {
6
6
  async build() {
7
7
  const outputDir = resolve(this.config.workingDir, '.vercel/output');
@@ -11,21 +11,31 @@ export class VercelBuildOutputAPIBuilder extends BaseBuilder {
11
11
  await mkdir(workflowGeneratedDir, { recursive: true });
12
12
  const inputFiles = await this.getInputFiles();
13
13
  const tsconfigPath = await this.findTsConfigPath();
14
- const options = {
14
+ // Create combined bundle in flow.func/
15
+ console.log('Creating Vercel Build Output API combined function');
16
+ const workflowsFuncDir = join(workflowGeneratedDir, 'flow.func');
17
+ await mkdir(workflowsFuncDir, { recursive: true });
18
+ const { manifest } = await this.createCombinedBundle({
15
19
  inputFiles,
16
- workflowGeneratedDir,
20
+ stepsOutfile: join(workflowsFuncDir, '__step_registrations.mjs'),
21
+ flowOutfile: join(workflowsFuncDir, 'index.mjs'),
17
22
  tsconfigPath,
18
- };
19
- const stepsManifest = await this.buildStepsFunction(options);
20
- const workflowsManifest = await this.buildWorkflowsFunction(options);
21
- await this.buildWebhookFunction(options);
23
+ bundleFinalOutput: true,
24
+ });
25
+ // Create package.json and .vc-config.json for combined function
26
+ await this.createPackageJson(workflowsFuncDir, 'module');
27
+ await this.createVcConfig(workflowsFuncDir, {
28
+ handler: 'index.mjs',
29
+ // Skip the source-map-support runtime shim when sourcemaps are
30
+ // disabled — it's a meaningful chunk of the function bundle and
31
+ // serves no purpose without maps.
32
+ shouldAddSourcemapSupport: this.sourcemapsEnabled,
33
+ maxDuration: 'max',
34
+ experimentalTriggers: [WORKFLOW_QUEUE_TRIGGER],
35
+ runtime: this.config.runtime,
36
+ });
37
+ await this.buildWebhookFunction({ workflowGeneratedDir });
22
38
  await this.createBuildOutputConfig(outputDir);
23
- // Merge manifests from both bundles
24
- const manifest = {
25
- steps: { ...stepsManifest.steps, ...workflowsManifest.steps },
26
- workflows: { ...stepsManifest.workflows, ...workflowsManifest.workflows },
27
- classes: { ...stepsManifest.classes, ...workflowsManifest.classes },
28
- };
29
39
  // Generate unified manifest
30
40
  const workflowBundlePath = join(workflowGeneratedDir, 'flow.func/index.mjs');
31
41
  const manifestJson = await this.createManifest({
@@ -42,46 +52,6 @@ export class VercelBuildOutputAPIBuilder extends BaseBuilder {
42
52
  }
43
53
  await this.createClientLibrary();
44
54
  }
45
- async buildStepsFunction({ inputFiles, workflowGeneratedDir, tsconfigPath, }) {
46
- console.log('Creating Vercel Build Output API steps function');
47
- const stepsFuncDir = join(workflowGeneratedDir, 'step.func');
48
- await mkdir(stepsFuncDir, { recursive: true });
49
- // Create steps bundle
50
- const { manifest } = await this.createStepsBundle({
51
- inputFiles,
52
- outfile: join(stepsFuncDir, 'index.mjs'),
53
- tsconfigPath,
54
- });
55
- // Create package.json and .vc-config.json for steps function
56
- await this.createPackageJson(stepsFuncDir, 'module');
57
- await this.createVcConfig(stepsFuncDir, {
58
- handler: 'index.mjs',
59
- shouldAddSourcemapSupport: true,
60
- maxDuration: 'max',
61
- experimentalTriggers: [STEP_QUEUE_TRIGGER],
62
- runtime: this.config.runtime,
63
- });
64
- return manifest;
65
- }
66
- async buildWorkflowsFunction({ inputFiles, workflowGeneratedDir, tsconfigPath, }) {
67
- console.log('Creating Vercel Build Output API workflows function');
68
- const workflowsFuncDir = join(workflowGeneratedDir, 'flow.func');
69
- await mkdir(workflowsFuncDir, { recursive: true });
70
- const { manifest } = await this.createWorkflowsBundle({
71
- outfile: join(workflowsFuncDir, 'index.mjs'),
72
- inputFiles,
73
- tsconfigPath,
74
- });
75
- // Create package.json and .vc-config.json for workflows function
76
- await this.createPackageJson(workflowsFuncDir, 'module');
77
- await this.createVcConfig(workflowsFuncDir, {
78
- handler: 'index.mjs',
79
- maxDuration: 'max',
80
- experimentalTriggers: [WORKFLOW_QUEUE_TRIGGER],
81
- runtime: this.config.runtime,
82
- });
83
- return manifest;
84
- }
85
55
  async buildWebhookFunction({ workflowGeneratedDir, bundle = true, }) {
86
56
  console.log('Creating Vercel Build Output API webhook function');
87
57
  const webhookFuncDir = join(workflowGeneratedDir, 'webhook/[token].func');
@@ -111,8 +81,7 @@ export class VercelBuildOutputAPIBuilder extends BaseBuilder {
111
81
  };
112
82
  await writeFile(join(outputDir, 'config.json'), JSON.stringify(buildOutputConfig, null, 2));
113
83
  console.log(`Build Output API created at ${outputDir}`);
114
- console.log('Steps function available at /.well-known/workflow/v1/step');
115
- console.log('Workflows function available at /.well-known/workflow/v1/flow');
84
+ console.log('Combined function available at /.well-known/workflow/v1/flow');
116
85
  console.log('Webhook function available at /.well-known/workflow/v1/webhook/[token]');
117
86
  }
118
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vercel-build-output-api.js","sourceRoot":"","sources":["../src/vercel-build-output-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE5E,MAAM,OAAO,2BAA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oDAAoD;SAC7D,CAAC,CAAC;QAEH,+DAA+D;QAC/D,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QACvD,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE;YACxC,OAAO,EAAE,WAAW;YACpB,gBAAgB,EAAE,KAAK;YACvB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;SAC7B,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,uBAAuB,CAAC,SAAiB;QACrD,0CAA0C;QAC1C,MAAM,iBAAiB,GAAG;YACxB,OAAO,EAAE,CAAC;YACV,MAAM,EAAE;gBACN;oBACE,GAAG,EAAE,0DAA0D;oBAC/D,IAAI,EAAE,0CAA0C;iBACjD;aACF;SACF,CAAC;QAEF,MAAM,SAAS,CACb,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EAC9B,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAC3C,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,+BAA+B,SAAS,EAAE,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CACT,+DAA+D,CAChE,CAAC;QACF,OAAO,CAAC,GAAG,CACT,wEAAwE,CACzE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { copyFile, mkdir, writeFile } from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport { BaseBuilder } from './base-builder.js';\nimport { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';\n\nexport class VercelBuildOutputAPIBuilder extends BaseBuilder {\n async build(): Promise<void> {\n const outputDir = resolve(this.config.workingDir, '.vercel/output');\n const functionsDir = join(outputDir, 'functions');\n const workflowGeneratedDir = join(functionsDir, '.well-known/workflow/v1');\n\n // Ensure output directories exist\n await mkdir(workflowGeneratedDir, { recursive: true });\n\n const inputFiles = await this.getInputFiles();\n const tsconfigPath = await this.findTsConfigPath();\n const options = {\n inputFiles,\n workflowGeneratedDir,\n tsconfigPath,\n };\n const stepsManifest = await this.buildStepsFunction(options);\n const workflowsManifest = await this.buildWorkflowsFunction(options);\n await this.buildWebhookFunction(options);\n await this.createBuildOutputConfig(outputDir);\n\n // Merge manifests from both bundles\n const manifest = {\n steps: { ...stepsManifest.steps, ...workflowsManifest.steps },\n workflows: { ...stepsManifest.workflows, ...workflowsManifest.workflows },\n classes: { ...stepsManifest.classes, ...workflowsManifest.classes },\n };\n\n // Generate unified manifest\n const workflowBundlePath = join(\n workflowGeneratedDir,\n 'flow.func/index.mjs'\n );\n const manifestJson = await this.createManifest({\n workflowBundlePath,\n manifestDir: workflowGeneratedDir,\n manifest,\n });\n\n // Expose manifest as a static file when WORKFLOW_PUBLIC_MANIFEST=1.\n // Vercel Build Output API serves static files from .vercel/output/static/\n if (this.shouldExposePublicManifest && manifestJson) {\n const staticManifestDir = join(\n outputDir,\n 'static/.well-known/workflow/v1'\n );\n await mkdir(staticManifestDir, { recursive: true });\n await copyFile(\n join(workflowGeneratedDir, 'manifest.json'),\n join(staticManifestDir, 'manifest.json')\n );\n }\n\n await this.createClientLibrary();\n }\n\n private async buildStepsFunction({\n inputFiles,\n workflowGeneratedDir,\n tsconfigPath,\n }: {\n inputFiles: string[];\n workflowGeneratedDir: string;\n tsconfigPath?: string;\n }) {\n console.log('Creating Vercel Build Output API steps function');\n const stepsFuncDir = join(workflowGeneratedDir, 'step.func');\n await mkdir(stepsFuncDir, { recursive: true });\n\n // Create steps bundle\n const { manifest } = await this.createStepsBundle({\n inputFiles,\n outfile: join(stepsFuncDir, 'index.mjs'),\n tsconfigPath,\n });\n\n // Create package.json and .vc-config.json for steps function\n await this.createPackageJson(stepsFuncDir, 'module');\n await this.createVcConfig(stepsFuncDir, {\n handler: 'index.mjs',\n shouldAddSourcemapSupport: true,\n maxDuration: 'max',\n experimentalTriggers: [STEP_QUEUE_TRIGGER],\n runtime: this.config.runtime,\n });\n\n return manifest;\n }\n\n private async buildWorkflowsFunction({\n inputFiles,\n workflowGeneratedDir,\n tsconfigPath,\n }: {\n inputFiles: string[];\n workflowGeneratedDir: string;\n tsconfigPath?: string;\n }) {\n console.log('Creating Vercel Build Output API workflows function');\n const workflowsFuncDir = join(workflowGeneratedDir, 'flow.func');\n await mkdir(workflowsFuncDir, { recursive: true });\n\n const { manifest } = await this.createWorkflowsBundle({\n outfile: join(workflowsFuncDir, 'index.mjs'),\n inputFiles,\n tsconfigPath,\n });\n\n // Create package.json and .vc-config.json for workflows function\n await this.createPackageJson(workflowsFuncDir, 'module');\n await this.createVcConfig(workflowsFuncDir, {\n handler: 'index.mjs',\n maxDuration: 'max',\n experimentalTriggers: [WORKFLOW_QUEUE_TRIGGER],\n runtime: this.config.runtime,\n });\n\n return manifest;\n }\n\n private async buildWebhookFunction({\n workflowGeneratedDir,\n bundle = true,\n }: {\n workflowGeneratedDir: string;\n bundle?: boolean;\n }): Promise<void> {\n console.log('Creating Vercel Build Output API webhook function');\n const webhookFuncDir = join(workflowGeneratedDir, 'webhook/[token].func');\n\n // Bundle the webhook route with dependencies resolved\n await this.createWebhookBundle({\n outfile: join(webhookFuncDir, 'index.mjs'),\n bundle, // Build Output API needs bundling (except in tests)\n });\n\n // Create package.json and .vc-config.json for webhook function\n await this.createPackageJson(webhookFuncDir, 'module');\n await this.createVcConfig(webhookFuncDir, {\n handler: 'index.mjs',\n shouldAddHelpers: false,\n runtime: this.config.runtime,\n });\n }\n\n private async createBuildOutputConfig(outputDir: string): Promise<void> {\n // Create config.json for Build Output API\n const buildOutputConfig = {\n version: 3,\n routes: [\n {\n src: '^\\\\/\\\\.well-known\\\\/workflow\\\\/v1\\\\/webhook\\\\/([^\\\\/]+)$',\n dest: '/.well-known/workflow/v1/webhook/[token]',\n },\n ],\n };\n\n await writeFile(\n join(outputDir, 'config.json'),\n JSON.stringify(buildOutputConfig, null, 2)\n );\n\n console.log(`Build Output API created at ${outputDir}`);\n console.log('Steps function available at /.well-known/workflow/v1/step');\n console.log(\n 'Workflows function available at /.well-known/workflow/v1/flow'\n );\n console.log(\n 'Webhook function available at /.well-known/workflow/v1/webhook/[token]'\n );\n }\n}\n"]}
1
+ {"version":3,"file":"vercel-build-output-api.js","sourceRoot":"","sources":["../src/vercel-build-output-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,OAAO,2BAA4B,SAAQ,WAAW;IAC1D,KAAK,CAAC,KAAK;QACT,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;QACpE,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAClD,MAAM,oBAAoB,GAAG,IAAI,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAC;QAE3E,kCAAkC;QAClC,MAAM,KAAK,CAAC,oBAAoB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACnD,uCAAuC;QACvC,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;QAClE,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;QACjE,MAAM,KAAK,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnD,MAAM,EAAE,QAAQ,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OAAO,CAAC,GAAG,CACT,wEAAwE,CACzE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { copyFile, mkdir, writeFile } from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport { BaseBuilder } from './base-builder.js';\nimport { WORKFLOW_QUEUE_TRIGGER } from './constants.js';\n\nexport class VercelBuildOutputAPIBuilder extends BaseBuilder {\n async build(): Promise<void> {\n const outputDir = resolve(this.config.workingDir, '.vercel/output');\n const functionsDir = join(outputDir, 'functions');\n const workflowGeneratedDir = join(functionsDir, '.well-known/workflow/v1');\n\n // Ensure output directories exist\n await mkdir(workflowGeneratedDir, { recursive: true });\n\n const inputFiles = await this.getInputFiles();\n const tsconfigPath = await this.findTsConfigPath();\n // Create combined bundle in flow.func/\n console.log('Creating Vercel Build Output API combined function');\n const workflowsFuncDir = join(workflowGeneratedDir, 'flow.func');\n await mkdir(workflowsFuncDir, { recursive: true });\n\n const { manifest } = await this.createCombinedBundle({\n inputFiles,\n stepsOutfile: join(workflowsFuncDir, '__step_registrations.mjs'),\n flowOutfile: join(workflowsFuncDir, 'index.mjs'),\n tsconfigPath,\n bundleFinalOutput: true,\n });\n\n // Create package.json and .vc-config.json for combined function\n await this.createPackageJson(workflowsFuncDir, 'module');\n await this.createVcConfig(workflowsFuncDir, {\n handler: 'index.mjs',\n // Skip the source-map-support runtime shim when sourcemaps are\n // disabled — it's a meaningful chunk of the function bundle and\n // serves no purpose without maps.\n shouldAddSourcemapSupport: this.sourcemapsEnabled,\n maxDuration: 'max',\n experimentalTriggers: [WORKFLOW_QUEUE_TRIGGER],\n runtime: this.config.runtime,\n });\n\n await this.buildWebhookFunction({ workflowGeneratedDir });\n await this.createBuildOutputConfig(outputDir);\n\n // Generate unified manifest\n const workflowBundlePath = join(\n workflowGeneratedDir,\n 'flow.func/index.mjs'\n );\n const manifestJson = await this.createManifest({\n workflowBundlePath,\n manifestDir: workflowGeneratedDir,\n manifest,\n });\n\n // Expose manifest as a static file when WORKFLOW_PUBLIC_MANIFEST=1.\n // Vercel Build Output API serves static files from .vercel/output/static/\n if (this.shouldExposePublicManifest && manifestJson) {\n const staticManifestDir = join(\n outputDir,\n 'static/.well-known/workflow/v1'\n );\n await mkdir(staticManifestDir, { recursive: true });\n await copyFile(\n join(workflowGeneratedDir, 'manifest.json'),\n join(staticManifestDir, 'manifest.json')\n );\n }\n\n await this.createClientLibrary();\n }\n\n private async buildWebhookFunction({\n workflowGeneratedDir,\n bundle = true,\n }: {\n workflowGeneratedDir: string;\n bundle?: boolean;\n }): Promise<void> {\n console.log('Creating Vercel Build Output API webhook function');\n const webhookFuncDir = join(workflowGeneratedDir, 'webhook/[token].func');\n\n // Bundle the webhook route with dependencies resolved\n await this.createWebhookBundle({\n outfile: join(webhookFuncDir, 'index.mjs'),\n bundle, // Build Output API needs bundling (except in tests)\n });\n\n // Create package.json and .vc-config.json for webhook function\n await this.createPackageJson(webhookFuncDir, 'module');\n await this.createVcConfig(webhookFuncDir, {\n handler: 'index.mjs',\n shouldAddHelpers: false,\n runtime: this.config.runtime,\n });\n }\n\n private async createBuildOutputConfig(outputDir: string): Promise<void> {\n // Create config.json for Build Output API\n const buildOutputConfig = {\n version: 3,\n routes: [\n {\n src: '^\\\\/\\\\.well-known\\\\/workflow\\\\/v1\\\\/webhook\\\\/([^\\\\/]+)$',\n dest: '/.well-known/workflow/v1/webhook/[token]',\n },\n ],\n };\n\n await writeFile(\n join(outputDir, 'config.json'),\n JSON.stringify(buildOutputConfig, null, 2)\n );\n\n console.log(`Build Output API created at ${outputDir}`);\n console.log('Combined function available at /.well-known/workflow/v1/flow');\n console.log(\n 'Webhook function available at /.well-known/workflow/v1/webhook/[token]'\n );\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow/builders",
3
- "version": "5.0.0-beta.4",
3
+ "version": "5.0.0-beta.5",
4
4
  "description": "Shared builder infrastructure for Workflow SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,10 +40,10 @@
40
40
  "find-up": "7.0.0",
41
41
  "json5": "2.2.3",
42
42
  "tinyglobby": "0.2.15",
43
- "@workflow/core": "5.0.0-beta.4",
44
- "@workflow/errors": "5.0.0-beta.1",
45
- "@workflow/utils": "5.0.0-beta.1",
46
- "@workflow/swc-plugin": "5.0.0-beta.3"
43
+ "@workflow/core": "5.0.0-beta.5",
44
+ "@workflow/errors": "5.0.0-beta.2",
45
+ "@workflow/utils": "5.0.0-beta.2",
46
+ "@workflow/swc-plugin": "5.0.0-beta.4"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc",