@workflow/builders 5.0.0-beta.3 → 5.0.0-beta.30
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/apply-swc-transform.d.ts +7 -2
- package/dist/apply-swc-transform.d.ts.map +1 -1
- package/dist/apply-swc-transform.js +10 -4
- package/dist/base-builder-logging.test.d.ts +2 -0
- package/dist/base-builder-logging.test.d.ts.map +1 -0
- package/dist/base-builder-logging.test.js +99 -0
- package/dist/base-builder.d.ts +127 -13
- package/dist/base-builder.d.ts.map +1 -1
- package/dist/base-builder.js +812 -102
- package/dist/build-queue.js +1 -1
- package/dist/config-helpers.d.ts +4 -1
- package/dist/config-helpers.d.ts.map +1 -1
- package/dist/config-helpers.js +63 -1
- package/dist/config-helpers.test.d.ts +2 -0
- package/dist/config-helpers.test.d.ts.map +1 -0
- package/dist/config-helpers.test.js +17 -0
- package/dist/constants.d.ts +31 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +71 -19
- package/dist/constants.test.d.ts +2 -0
- package/dist/constants.test.d.ts.map +1 -0
- package/dist/constants.test.js +40 -0
- package/dist/discover-entries-esbuild-plugin.d.ts +3 -1
- package/dist/discover-entries-esbuild-plugin.d.ts.map +1 -1
- package/dist/discover-entries-esbuild-plugin.js +24 -4
- package/dist/discover-entries-esbuild-plugin.test.js +1 -1
- package/dist/esbuild-tsconfig.js +1 -1
- package/dist/esbuild-tsconfig.test.js +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/fast-discovery.d.ts +20 -0
- package/dist/fast-discovery.d.ts.map +1 -0
- package/dist/fast-discovery.js +774 -0
- package/dist/fast-discovery.test.d.ts +2 -0
- package/dist/fast-discovery.test.d.ts.map +1 -0
- package/dist/fast-discovery.test.js +336 -0
- package/dist/get-input-files.test.js +34 -2
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/module-specifier.d.ts +20 -2
- package/dist/module-specifier.d.ts.map +1 -1
- package/dist/module-specifier.js +92 -17
- package/dist/module-specifier.test.js +45 -3
- package/dist/node-compat-banner.d.ts +15 -0
- package/dist/node-compat-banner.d.ts.map +1 -0
- package/dist/node-compat-banner.js +15 -0
- package/dist/node-module-esbuild-plugin.d.ts.map +1 -1
- package/dist/node-module-esbuild-plugin.js +73 -23
- package/dist/node-module-esbuild-plugin.test.js +97 -1
- package/dist/optional-otel-api.d.ts +14 -0
- package/dist/optional-otel-api.d.ts.map +1 -0
- package/dist/optional-otel-api.js +14 -0
- package/dist/optional-pg-native-alias.d.ts +2 -0
- package/dist/optional-pg-native-alias.d.ts.map +1 -0
- package/dist/optional-pg-native-alias.js +3 -0
- package/dist/optional-pg-native.d.ts +3 -0
- package/dist/optional-pg-native.d.ts.map +1 -0
- package/dist/optional-pg-native.js +3 -0
- package/dist/optional-typescript-alias.d.ts +2 -0
- package/dist/optional-typescript-alias.d.ts.map +1 -0
- package/dist/optional-typescript-alias.js +3 -0
- package/dist/optional-typescript.d.ts +3 -0
- package/dist/optional-typescript.d.ts.map +1 -0
- package/dist/optional-typescript.js +9 -0
- package/dist/pseudo-package-esbuild-plugin.js +1 -1
- package/dist/pseudo-package-esbuild-plugin.test.js +1 -1
- package/dist/request-converter.js +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 +194 -0
- package/dist/serde-checker.js +1 -1
- package/dist/standalone.d.ts +0 -3
- package/dist/standalone.d.ts.map +1 -1
- package/dist/standalone.js +12 -41
- package/dist/step-source-registration.test.d.ts +2 -0
- package/dist/step-source-registration.test.d.ts.map +1 -0
- package/dist/step-source-registration.test.js +82 -0
- package/dist/swc-esbuild-plugin.d.ts +10 -0
- package/dist/swc-esbuild-plugin.d.ts.map +1 -1
- package/dist/swc-esbuild-plugin.js +116 -14
- package/dist/swc-esbuild-plugin.test.js +370 -6
- package/dist/transform-utils.d.ts.map +1 -1
- package/dist/transform-utils.js +45 -6
- package/dist/transform-utils.test.js +78 -6
- package/dist/types.d.ts +38 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +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 +31 -59
- package/dist/workflow-alias.js +1 -1
- package/dist/workflow-alias.test.js +1 -1
- package/dist/workflows-extractor.js +8 -3
- package/dist/workflows-extractor.test.d.ts +2 -0
- package/dist/workflows-extractor.test.d.ts.map +1 -0
- package/dist/workflows-extractor.test.js +70 -0
- package/dist/world-target.d.ts +20 -0
- package/dist/world-target.d.ts.map +1 -0
- package/dist/world-target.js +74 -0
- package/dist/world-target.test.d.ts +2 -0
- package/dist/world-target.test.d.ts.map +1 -0
- package/dist/world-target.test.js +106 -0
- package/package.json +9 -7
- package/dist/apply-swc-transform.js.map +0 -1
- package/dist/base-builder.js.map +0 -1
- package/dist/build-queue.js.map +0 -1
- package/dist/config-helpers.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/discover-entries-esbuild-plugin.js.map +0 -1
- package/dist/discover-entries-esbuild-plugin.test.js.map +0 -1
- package/dist/esbuild-tsconfig.js.map +0 -1
- package/dist/esbuild-tsconfig.test.js.map +0 -1
- package/dist/get-input-files.test.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/module-specifier.js.map +0 -1
- package/dist/module-specifier.test.js.map +0 -1
- package/dist/node-module-esbuild-plugin.js.map +0 -1
- package/dist/node-module-esbuild-plugin.test.js.map +0 -1
- package/dist/pseudo-package-esbuild-plugin.js.map +0 -1
- package/dist/pseudo-package-esbuild-plugin.test.js.map +0 -1
- package/dist/request-converter.js.map +0 -1
- package/dist/serde-checker.js.map +0 -1
- package/dist/standalone.js.map +0 -1
- package/dist/swc-esbuild-plugin.js.map +0 -1
- package/dist/swc-esbuild-plugin.test.js.map +0 -1
- package/dist/transform-utils.js.map +0 -1
- package/dist/transform-utils.test.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/vercel-build-output-api.js.map +0 -1
- package/dist/workflow-alias.js.map +0 -1
- package/dist/workflow-alias.test.js.map +0 -1
- package/dist/workflows-extractor.js.map +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync, } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { ensureWorkflowTargetWorldEnv, getWorldImport, isWorkflowTargetWorldPath, normalizeWorkflowTargetWorldImport, resolveWorkflowCoreRuntimeAlias, resolveWorkflowTargetWorldAlias, WORKFLOW_CORE_RUNTIME_MODULE, WORKFLOW_WORLD_TARGET_MODULE, } from './world-target.js';
|
|
6
|
+
describe('workflow world target', () => {
|
|
7
|
+
it('normalizes built-in aliases to package specifiers', () => {
|
|
8
|
+
expect(normalizeWorkflowTargetWorldImport('local')).toBe('@workflow/world-local');
|
|
9
|
+
expect(normalizeWorkflowTargetWorldImport('vercel')).toBe('@workflow/world-vercel');
|
|
10
|
+
expect(normalizeWorkflowTargetWorldImport('@workflow/world-postgres')).toBe('@workflow/world-postgres');
|
|
11
|
+
});
|
|
12
|
+
it('defaults to local outside Vercel', () => {
|
|
13
|
+
expect(getWorldImport({})).toBe('@workflow/world-local');
|
|
14
|
+
});
|
|
15
|
+
it('defaults to Vercel when deployed on Vercel', () => {
|
|
16
|
+
expect(getWorldImport({
|
|
17
|
+
VERCEL_DEPLOYMENT_ID: 'dpl_123',
|
|
18
|
+
})).toBe('@workflow/world-vercel');
|
|
19
|
+
});
|
|
20
|
+
it('writes the normalized target back to the env object', () => {
|
|
21
|
+
const env = { WORKFLOW_TARGET_WORLD: 'local' };
|
|
22
|
+
expect(ensureWorkflowTargetWorldEnv(env)).toBe('@workflow/world-local');
|
|
23
|
+
expect(env.WORKFLOW_TARGET_WORLD).toBe('@workflow/world-local');
|
|
24
|
+
});
|
|
25
|
+
it('resolves package aliases to concrete module paths', () => {
|
|
26
|
+
const testDir = mkdtempSync(join(tmpdir(), 'workflow-world-target-'));
|
|
27
|
+
const packageDir = join(testDir, 'node_modules/@workflow/world-custom');
|
|
28
|
+
mkdirSync(packageDir, { recursive: true });
|
|
29
|
+
writeFileSync(join(packageDir, 'package.json'), JSON.stringify({
|
|
30
|
+
name: '@workflow/world-custom',
|
|
31
|
+
type: 'module',
|
|
32
|
+
exports: './index.js',
|
|
33
|
+
}));
|
|
34
|
+
writeFileSync(join(packageDir, 'index.js'), 'export function createWorld() {}');
|
|
35
|
+
const alias = resolveWorkflowTargetWorldAlias({
|
|
36
|
+
workingDir: testDir,
|
|
37
|
+
targetWorld: '@workflow/world-custom',
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
expect(alias.replace(/\\/g, '/')).toMatch(/node_modules\/@workflow\/world-custom\/index\.js$/);
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
rmSync(testDir, { recursive: true, force: true });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
it('resolves relative module files from the working directory', () => {
|
|
47
|
+
const testDir = mkdtempSync(join(tmpdir(), 'workflow-world-target-'));
|
|
48
|
+
const worldFile = join(testDir, 'my-world.ts');
|
|
49
|
+
writeFileSync(worldFile, 'export function createWorld() {}');
|
|
50
|
+
const alias = resolveWorkflowTargetWorldAlias({
|
|
51
|
+
workingDir: testDir,
|
|
52
|
+
targetWorld: './my-world.ts',
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
expect(alias).toBe(realpathSync(worldFile));
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
rmSync(testDir, { recursive: true, force: true });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
it('detects path-like target worlds', () => {
|
|
62
|
+
expect(isWorkflowTargetWorldPath('./my-world.ts')).toBe(true);
|
|
63
|
+
expect(isWorkflowTargetWorldPath('../my-world.ts')).toBe(true);
|
|
64
|
+
expect(isWorkflowTargetWorldPath('/tmp/my-world.ts')).toBe(true);
|
|
65
|
+
expect(isWorkflowTargetWorldPath('C:\\repo\\my-world.ts')).toBe(true);
|
|
66
|
+
expect(isWorkflowTargetWorldPath('@workflow/world-postgres')).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
it('keeps unresolved custom aliases externalizable', () => {
|
|
69
|
+
expect(resolveWorkflowTargetWorldAlias({
|
|
70
|
+
workingDir: process.cwd(),
|
|
71
|
+
targetWorld: '@workflow/world-custom',
|
|
72
|
+
})).toBe('@workflow/world-custom');
|
|
73
|
+
});
|
|
74
|
+
it('resolves built-in worlds from the builder package when the app omits them', () => {
|
|
75
|
+
const testDir = mkdtempSync(join(tmpdir(), 'workflow-world-target-'));
|
|
76
|
+
try {
|
|
77
|
+
const alias = resolveWorkflowTargetWorldAlias({
|
|
78
|
+
workingDir: testDir,
|
|
79
|
+
targetWorld: '@workflow/world-local',
|
|
80
|
+
});
|
|
81
|
+
expect(alias.replace(/\\/g, '/')).toMatch(/packages\/world-local\/dist\/index\.js$/);
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
rmSync(testDir, { recursive: true, force: true });
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
it('uses the core target module as the alias key', () => {
|
|
88
|
+
expect(WORKFLOW_WORLD_TARGET_MODULE).toBe('@workflow/core/runtime/world-target');
|
|
89
|
+
});
|
|
90
|
+
it('resolves the core runtime module from the builder package when the app omits it', () => {
|
|
91
|
+
const testDir = mkdtempSync(join(tmpdir(), 'workflow-world-target-'));
|
|
92
|
+
try {
|
|
93
|
+
const alias = resolveWorkflowCoreRuntimeAlias({
|
|
94
|
+
workingDir: testDir,
|
|
95
|
+
});
|
|
96
|
+
expect(alias.replace(/\\/g, '/')).toMatch(/packages\/core\/dist\/runtime\.js$/);
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
rmSync(testDir, { recursive: true, force: true });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
it('uses the core runtime module as the runtime alias key', () => {
|
|
103
|
+
expect(WORKFLOW_CORE_RUNTIME_MODULE).toBe('@workflow/core/runtime');
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ybGQtdGFyZ2V0LnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvd29ybGQtdGFyZ2V0LnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLFNBQVMsRUFDVCxXQUFXLEVBQ1gsWUFBWSxFQUNaLE1BQU0sRUFDTixhQUFhLEdBQ2QsTUFBTSxTQUFTLENBQUM7QUFDakIsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUNqQyxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBQ2pDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLEVBQUUsRUFBRSxNQUFNLFFBQVEsQ0FBQztBQUM5QyxPQUFPLEVBQ0wsNEJBQTRCLEVBQzVCLGNBQWMsRUFDZCx5QkFBeUIsRUFDekIsa0NBQWtDLEVBQ2xDLCtCQUErQixFQUMvQiwrQkFBK0IsRUFDL0IsNEJBQTRCLEVBQzVCLDRCQUE0QixHQUM3QixNQUFNLG1CQUFtQixDQUFDO0FBRTNCLFFBQVEsQ0FBQyx1QkFBdUIsRUFBRSxHQUFHLEVBQUU7SUFDckMsRUFBRSxDQUFDLG1EQUFtRCxFQUFFLEdBQUcsRUFBRTtRQUMzRCxNQUFNLENBQUMsa0NBQWtDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQ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SBydW50aW1lIG1vZHVsZSBhcyB0aGUgcnVudGltZSBhbGlhcyBrZXknLCAoKSA9PiB7XG4gICAgZXhwZWN0KFdPUktGTE9XX0NPUkVfUlVOVElNRV9NT0RVTEUpLnRvQmUoJ0B3b3JrZmxvdy9jb3JlL3J1bnRpbWUnKTtcbiAgfSk7XG59KTtcbiJdfQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workflow/builders",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.30",
|
|
4
4
|
"description": "Shared builder infrastructure for Workflow SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,14 +36,16 @@
|
|
|
36
36
|
"builtin-modules": "5.0.0",
|
|
37
37
|
"chalk": "5.6.2",
|
|
38
38
|
"enhanced-resolve": "5.19.0",
|
|
39
|
-
"esbuild": "^0.
|
|
39
|
+
"esbuild": "^0.28.1",
|
|
40
40
|
"find-up": "7.0.0",
|
|
41
41
|
"json5": "2.2.3",
|
|
42
|
-
"tinyglobby": "0.2.
|
|
43
|
-
"@workflow/core": "5.0.0-beta.
|
|
44
|
-
"@workflow/errors": "5.0.0-beta.
|
|
45
|
-
"@workflow/
|
|
46
|
-
"@workflow/
|
|
42
|
+
"tinyglobby": "0.2.17",
|
|
43
|
+
"@workflow/core": "5.0.0-beta.30",
|
|
44
|
+
"@workflow/errors": "5.0.0-beta.10",
|
|
45
|
+
"@workflow/world-local": "5.0.0-beta.26",
|
|
46
|
+
"@workflow/world-vercel": "5.0.0-beta.26",
|
|
47
|
+
"@workflow/utils": "5.0.0-beta.6",
|
|
48
|
+
"@workflow/swc-plugin": "5.0.0-beta.5"
|
|
47
49
|
},
|
|
48
50
|
"scripts": {
|
|
49
51
|
"build": "tsc",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apply-swc-transform.js","sourceRoot":"","sources":["../src/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CAAC,SAAS;YACb,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,OAAO,EAAE,UAAU;iBACpB;gBACD,eAAe,EAAE,gBAAgB,CAAC,eAAe;gBACjD,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB;aACtD;SACF;QACD,sDAAsD;QACtD,qDAAqD;QACrD,4CAA4C;QAC5C,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAC5C,wCAAwC,CACzC,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAChC,oBAAoB,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CACd,CAAC;IAEtB,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,gBAAgB,EAAE,eAAe,IAAI,EAAE;KACxC,CAAC;AACJ,CAAC","sourcesContent":["import { createRequire } from 'node:module';\nimport { dirname, isAbsolute, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { transform } from '@swc/core';\nimport { getDecoratorOptionsForDirectory } from './config-helpers.js';\nimport { resolveModuleSpecifier } from './module-specifier.js';\n\nconst require = createRequire(import.meta.url);\n\n// Cache decorator options per directory - tsconfig doesn't change during a build\nconst decoratorOptionsCache = new Map<\n string,\n ReturnType<typeof getDecoratorOptionsForDirectory>\n>();\n\nfunction getDecoratorOptions(projectRoot?: string) {\n const cwd = projectRoot ?? process.cwd();\n let cached = decoratorOptionsCache.get(cwd);\n if (!cached) {\n cached = getDecoratorOptionsForDirectory(cwd);\n decoratorOptionsCache.set(cwd, cached);\n }\n return cached;\n}\n\nexport type WorkflowManifest = {\n steps?: {\n [relativeFileName: string]: {\n [functionName: string]: {\n stepId: string;\n };\n };\n };\n workflows?: {\n [relativeFileName: string]: {\n [functionName: string]: {\n workflowId: string;\n };\n };\n };\n classes?: {\n [relativeFileName: string]: {\n [className: string]: {\n classId: string;\n };\n };\n };\n};\n\nexport async function applySwcTransform(\n filename: string,\n source: string,\n mode: 'workflow' | 'step' | 'detect' | false,\n /**\n * Optional absolute path to the file being transformed.\n * Used for module specifier resolution when filename is relative.\n * If not provided, filename is joined with process.cwd().\n */\n absolutePath?: string,\n /**\n * Optional project root used for module specifier resolution.\n * Defaults to process.cwd() for backwards compatibility.\n */\n projectRoot?: string\n): Promise<{\n code: string;\n workflowManifest: WorkflowManifest;\n}> {\n const resolvedProjectRoot = projectRoot ?? process.cwd();\n const decoratorOptions = await getDecoratorOptions(resolvedProjectRoot);\n\n const swcPluginPath = require.resolve('@workflow/swc-plugin', {\n paths: [dirname(fileURLToPath(import.meta.url))],\n });\n\n // Determine if this is a TypeScript file\n const isTypeScript =\n filename.endsWith('.ts') ||\n filename.endsWith('.tsx') ||\n filename.endsWith('.mts') ||\n filename.endsWith('.cts');\n\n // Resolve module specifier for packages (node_modules or workspace packages)\n const absoluteFilename = absolutePath\n ? absolutePath\n : isAbsolute(filename)\n ? filename\n : join(resolvedProjectRoot, filename);\n const { moduleSpecifier } = resolveModuleSpecifier(\n absoluteFilename,\n resolvedProjectRoot\n );\n\n // Transform with SWC to support syntax esbuild doesn't\n const result = await transform(source, {\n filename,\n swcrc: false,\n jsc: {\n parser: {\n ...(isTypeScript\n ? {\n syntax: 'typescript',\n tsx: filename.endsWith('.tsx'),\n decorators: decoratorOptions.decorators,\n }\n : {\n syntax: 'ecmascript',\n jsx: filename.endsWith('.jsx'),\n decorators: decoratorOptions.decorators,\n }),\n },\n target: 'es2022',\n experimental: mode\n ? {\n plugins: [[swcPluginPath, { mode, moduleSpecifier }]],\n }\n : undefined,\n transform: {\n react: {\n runtime: 'preserve',\n },\n legacyDecorator: decoratorOptions.legacyDecorator,\n decoratorMetadata: decoratorOptions.decoratorMetadata,\n },\n },\n // TODO: investigate proper source map support as they\n // won't even be used in Node.js by default unless we\n // intercept errors and apply them ourselves\n sourceMaps: false,\n minify: false,\n });\n\n const workflowCommentMatch = result.code.match(\n /\\/\\*\\*__internal_workflows({.*?})\\*\\//s\n );\n\n const parsedWorkflows = JSON.parse(\n workflowCommentMatch?.[1] || '{}'\n ) as WorkflowManifest;\n\n return {\n code: result.code,\n workflowManifest: parsedWorkflows || {},\n };\n}\n"]}
|
package/dist/base-builder.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,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,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"]}
|
package/dist/build-queue.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-queue.js","sourceRoot":"","sources":["../src/build-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAE9B,OAAO,CAAC,IAAyB,EAAiB,EAAE;QAClD,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACrC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Creates a build queue that serializes async tasks to prevent race conditions.\n *\n * When rapid file changes trigger multiple builds, this ensures they run\n * sequentially rather than concurrently, avoiding issues like:\n * - Partial file reads during writes\n * - Corrupted merge operations\n * - Duplicate/conflicting builds\n *\n * @example\n * const enqueue = createBuildQueue();\n *\n * // These will run sequentially, not concurrently\n * enqueue(() => builder.build());\n * enqueue(() => builder.build());\n */\nexport function createBuildQueue() {\n let queue = Promise.resolve();\n\n return (task: () => Promise<void>): Promise<void> => {\n queue = queue.then(task).catch((err) => {\n console.error(err);\n });\n return queue;\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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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BAAuB,CAAC,OAOvC;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;KACzB,CAAC;AACJ,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { findUp } from 'find-up';\nimport JSON5 from 'json5';\nimport type { 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}): 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 };\n}\n"]}
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,cAAuB;IAC7B,KAAK,EAAE,cAAc;IACrB,QAAQ,EAAE,SAAS;IACnB,iBAAiB,EAAE,CAAC,EAAE,sCAAsC;IAC5D,mBAAmB,EAAE,CAAC,EAAE,mDAAmD;CAC5E,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,cAAuB;IAC7B,KAAK,EAAE,kBAAkB;IACzB,QAAQ,EAAE,SAAS;IACnB,iBAAiB,EAAE,CAAC,EAAE,sCAAsC;IAC5D,mBAAmB,EAAE,CAAC,EAAE,mDAAmD;CAC5E,CAAC","sourcesContent":["/**\n * Queue trigger configuration for workflow step execution.\n * Steps are queued to the __wkf_step_* topic.\n */\nexport const STEP_QUEUE_TRIGGER = {\n type: 'queue/v2beta' as const,\n topic: '__wkf_step_*',\n consumer: 'default',\n retryAfterSeconds: 5, // Delay between retries (default: 60)\n initialDelaySeconds: 0, // Initial delay before first delivery (default: 0)\n};\n\n/**\n * Queue trigger configuration for workflow orchestration.\n * Workflows are queued to the __wkf_workflow_* topic.\n */\nexport const WORKFLOW_QUEUE_TRIGGER = {\n type: 'queue/v2beta' as const,\n topic: '__wkf_workflow_*',\n consumer: 'default',\n retryAfterSeconds: 5, // Delay between retries (default: 60)\n initialDelaySeconds: 0, // Initial delay before first delivery (default: 0)\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discover-entries-esbuild-plugin.js","sourceRoot":"","sources":["../src/discover-entries-esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,uBAAuB,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;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CAAC;4BACjD,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;wBACjD,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,iBAAiB,CACtC,cAAc,EACd,MAAM,EACN,KAAK,EACL,cAAc,EACd,mBAAmB,CACpB,CAAC;wBACF,eAAe,GAAG,IAAI,CAAC;oBACzB,CAAC;oBAED,OAAO;wBACL,QAAQ,EAAE,eAAe;wBACzB,MAAM;qBACP,CAAC;gBACJ,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,4CAA4C;oBAC5C,OAAO;wBACL,QAAQ,EAAE,EAAE;wBACZ,MAAM,EAAE,IAAI;qBACb,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { promisify } from 'node:util';\nimport enhancedResolveOriginal from 'enhanced-resolve';\nimport type { Plugin } from 'esbuild';\nimport type { WorkflowManifest } from './apply-swc-transform.js';\nimport { applySwcTransform } from './apply-swc-transform.js';\nimport {\n detectWorkflowPatterns,\n isGeneratedWorkflowFile,\n} from './transform-utils.js';\n\nconst enhancedResolve = promisify(enhancedResolveOriginal);\n\nexport const jsTsRegex = /\\.(ts|tsx|js|jsx|mjs|cjs|mts|cts)$/;\n\n/** Returns true if a manifest section has at least one entry. */\nfunction hasManifestEntries(\n section: WorkflowManifest[keyof WorkflowManifest]\n): boolean {\n if (!section) return false;\n return Object.values(section).some(\n (entries) => Object.keys(entries).length > 0\n );\n}\n\nfunction isGeneratedBuildArtifactPath(filePath: string): boolean {\n const normalizedPath = filePath.replace(/\\\\/g, '/');\n return (\n normalizedPath.includes('/.output/') ||\n normalizedPath.includes('/.next/') ||\n normalizedPath.includes('/.nuxt/') ||\n normalizedPath.includes('/.svelte-kit/') ||\n normalizedPath.includes('/.vercel/')\n );\n}\n\n// parent -> children relationship (a file can import multiple files)\nexport const importParents = new Map<string, Set<string>>();\n\n// check if a parent has a child in its import chain\n// e.g. if a dependency needs to be bundled because it has\n// a 'use workflow/'use step' directive in it\nexport function parentHasChild(parent: string, childToFind: string): boolean {\n const visited = new Set<string>();\n const queue: string[] = [parent];\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n\n if (visited.has(current)) {\n continue;\n }\n visited.add(current);\n\n const children = importParents.get(current);\n if (!children) {\n continue;\n }\n\n for (const child of children) {\n if (child === childToFind) {\n return true;\n }\n queue.push(child);\n }\n }\n\n return false;\n}\n\nexport function createDiscoverEntriesPlugin(\n state: {\n discoveredSteps: Set<string>;\n discoveredWorkflows: Set<string>;\n discoveredSerdeFiles: Set<string>;\n },\n projectRoot?: string\n): Plugin {\n return {\n name: 'discover-entries-esbuild-plugin',\n setup(build) {\n // Track parent→child import relationships for ALL imports (not just\n // those with file extensions) so that `parentHasChild()` can correctly\n // identify transitive parents of serde/step files even when the\n // dependency chain passes through bare specifier imports like\n // `@workflow/core/runtime` or `workflow/runtime`.\n build.onResolve({ filter: /.*/ }, async (args) => {\n try {\n const resolved = await enhancedResolve(args.resolveDir, args.path);\n\n if (resolved) {\n // Normalize path separators for cross-platform compatibility\n const normalizedImporter = args.importer.replace(/\\\\/g, '/');\n const normalizedResolved = resolved.replace(/\\\\/g, '/');\n // A file can import multiple files, so we store a Set of children\n let children = importParents.get(normalizedImporter);\n if (!children) {\n children = new Set<string>();\n importParents.set(normalizedImporter, children);\n }\n children.add(normalizedResolved);\n }\n } catch (_) {}\n return null;\n });\n\n // Handle TypeScript and JavaScript files\n build.onLoad({ filter: jsTsRegex }, async (args) => {\n try {\n if (isGeneratedBuildArtifactPath(args.path)) {\n return {\n contents: '',\n loader: 'js',\n };\n }\n\n // Skip generated workflow route files to avoid re-processing them\n if (isGeneratedWorkflowFile(args.path)) {\n const source = await readFile(args.path, 'utf8');\n return {\n contents: source,\n loader: args.path.endsWith('.jsx') ? 'jsx' : 'js',\n };\n }\n\n // Determine the loader based on the output\n let loader: 'js' | 'jsx' = 'js';\n const isTypeScript =\n args.path.endsWith('.ts') ||\n args.path.endsWith('.tsx') ||\n args.path.endsWith('.mts') ||\n args.path.endsWith('.cts');\n if (!isTypeScript && args.path.endsWith('.jsx')) {\n loader = 'jsx';\n }\n const source = await readFile(args.path, 'utf8');\n\n // Normalize path separators to forward slashes for cross-platform compatibility\n // This is critical for Windows where paths contain backslashes\n const normalizedPath = args.path.replace(/\\\\/g, '/');\n\n const resolvedProjectRoot =\n projectRoot || build.initialOptions.absWorkingDir || process.cwd();\n\n // Two-phase discovery:\n // 1. Fast regexp pre-scan filters out the vast majority of files.\n // 2. For the small number that match, run the SWC plugin in 'detect'\n // mode to get an AST-level manifest. Detect mode walks the AST to\n // find directives and serde patterns but does NOT transform any\n // code, eliminating false positives where directive-like strings\n // appear inside template literals, regular strings, or comments.\n //\n // All files are transformed by SWC (TS→JS, decorators, etc.) since\n // esbuild does not support all TypeScript syntax (e.g. legacy\n // decorators, emitDecoratorMetadata). For regexp-matched files the\n // 'detect' call handles both the syntax transform and the manifest\n // in a single pass; for all other files a mode:false call is used.\n const patterns = detectWorkflowPatterns(source);\n\n let transformedCode: string;\n\n if (patterns.hasDirective || patterns.hasSerde) {\n const { code, workflowManifest } = await applySwcTransform(\n normalizedPath,\n source,\n 'detect',\n normalizedPath,\n resolvedProjectRoot\n );\n transformedCode = code;\n\n if (hasManifestEntries(workflowManifest.workflows)) {\n state.discoveredWorkflows.add(normalizedPath);\n }\n if (hasManifestEntries(workflowManifest.steps)) {\n state.discoveredSteps.add(normalizedPath);\n }\n\n if (hasManifestEntries(workflowManifest.classes)) {\n state.discoveredSerdeFiles.add(normalizedPath);\n }\n } else {\n const { code } = await applySwcTransform(\n normalizedPath,\n source,\n false,\n normalizedPath,\n resolvedProjectRoot\n );\n transformedCode = code;\n }\n\n return {\n contents: transformedCode,\n loader,\n };\n } catch (_) {\n // ignore trace errors during discover phase\n return {\n contents: '',\n loader: 'js',\n };\n }\n });\n },\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discover-entries-esbuild-plugin.test.js","sourceRoot":"","sources":["../src/discover-entries-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,EACb,cAAc,GACf,MAAM,sCAAsC,CAAC;AAE9C,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;AAE1C,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,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,OAA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CAAC,CAAC;QACpD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACtD,MAAM,eAAe,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAEpD,kDAAkD;QAClD,MAAM,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACzD,MAAM,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,CAAC,aAAc,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1D,2DAA2D;QAC3D,MAAM,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC1D,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QAClC,MAAM,CAAC,WAAY,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErD,iEAAiE;QACjE,MAAM,CAAC,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtE,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 parentHasChild,\n} from './discover-entries-esbuild-plugin.js';\n\nconst realTmpdir = realpathSync(tmpdir());\n\nfunction normalizeSlashes(path: string): string {\n return path.replace(/\\\\/g, '/');\n}\n\nfunction writeFile(path: string, contents = ''): void {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, contents, 'utf-8');\n}\n\ndescribe('createDiscoverEntriesPlugin projectRoot', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'workflow-discover-plugin-'));\n importParents.clear();\n applySwcTransformMock.mockReset();\n applySwcTransformMock.mockImplementation(\n async (filename: string, source: string) => {\n // Simulate the SWC plugin producing a manifest in 'detect' mode\n const hasWorkflow = /['\"]use workflow['\"]/.test(source);\n const hasStep = /['\"]use step['\"]/.test(source);\n const workflowManifest: Record<string, unknown> = {};\n if (hasWorkflow) {\n workflowManifest.workflows = {\n [filename]: { handleMessageWorkflow: { workflowId: 'test' } },\n };\n }\n if (hasStep) {\n workflowManifest.steps = {\n [filename]: { myStep: { stepId: 'test' } },\n };\n }\n return { code: source, workflowManifest };\n }\n );\n });\n\n afterEach(() => {\n importParents.clear();\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('uses the explicit projectRoot during discovery transforms', async () => {\n const fixture = setupFixture();\n const normalizedWorkflowFile = normalizeSlashes(fixture.workflowFile);\n const state = {\n discoveredSteps: new Set<string>(),\n discoveredWorkflows: new Set<string>(),\n discoveredSerdeFiles: new Set<string>(),\n };\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: [createDiscoverEntriesPlugin(state, fixture.appRoot)],\n });\n\n expect(result.errors).toHaveLength(0);\n expect(state.discoveredWorkflows).toEqual(\n new Set([normalizedWorkflowFile])\n );\n // Single 'detect' mode call for AST-level manifest validation\n expect(applySwcTransformMock).toHaveBeenCalledWith(\n normalizedWorkflowFile,\n expect.stringContaining('\"use workflow\"'),\n 'detect',\n normalizedWorkflowFile,\n fixture.appRoot\n );\n });\n\n it('defaults discovery transforms to absWorkingDir when projectRoot is omitted', async () => {\n const fixture = setupFixture();\n const normalizedWorkflowFile = normalizeSlashes(fixture.workflowFile);\n const state = {\n discoveredSteps: new Set<string>(),\n discoveredWorkflows: new Set<string>(),\n discoveredSerdeFiles: new Set<string>(),\n };\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: [createDiscoverEntriesPlugin(state)],\n });\n\n expect(result.errors).toHaveLength(0);\n expect(state.discoveredWorkflows).toEqual(\n new Set([normalizedWorkflowFile])\n );\n // Single 'detect' mode call for AST-level manifest validation\n expect(applySwcTransformMock).toHaveBeenCalledWith(\n normalizedWorkflowFile,\n expect.stringContaining('\"use workflow\"'),\n 'detect',\n normalizedWorkflowFile,\n fixture.packageRoot\n );\n });\n\n it('tracks importParents through bare specifier imports', async () => {\n // Simulate: entry.ts -> bare-pkg -> ./serde-file.ts\n // The bare specifier \"bare-pkg\" should not break the parent-child chain.\n const entryFile = join(testRoot, 'entry.ts');\n const pkgDir = join(testRoot, 'node_modules', 'bare-pkg');\n const pkgIndex = join(pkgDir, 'index.js');\n const serdeFile = join(pkgDir, 'serde.js');\n\n writeFile(\n join(pkgDir, 'package.json'),\n JSON.stringify({ name: 'bare-pkg', main: 'index.js' })\n );\n writeFile(pkgIndex, `export { Foo } from './serde.js';`);\n writeFile(serdeFile, `export class Foo {}\\n`);\n writeFile(\n entryFile,\n `import { Foo } from 'bare-pkg';\\nconsole.log(Foo);\\n`\n );\n\n const state = {\n discoveredSteps: new Set<string>(),\n discoveredWorkflows: new Set<string>(),\n discoveredSerdeFiles: new Set<string>(),\n };\n\n const result = await esbuild.build({\n entryPoints: [entryFile],\n absWorkingDir: testRoot,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n plugins: [createDiscoverEntriesPlugin(state)],\n });\n\n expect(result.errors).toHaveLength(0);\n\n const normalizedEntry = normalizeSlashes(entryFile);\n const normalizedPkgIndex = normalizeSlashes(pkgIndex);\n const normalizedSerde = normalizeSlashes(serdeFile);\n\n // entry.ts -> bare-pkg/index.js should be tracked\n const entryChildren = importParents.get(normalizedEntry);\n expect(entryChildren).toBeDefined();\n expect(entryChildren!.has(normalizedPkgIndex)).toBe(true);\n\n // bare-pkg/index.js -> bare-pkg/serde.js should be tracked\n const pkgChildren = importParents.get(normalizedPkgIndex);\n expect(pkgChildren).toBeDefined();\n expect(pkgChildren!.has(normalizedSerde)).toBe(true);\n\n // parentHasChild should transitively find serde.js from entry.ts\n expect(parentHasChild(normalizedEntry, normalizedSerde)).toBe(true);\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-tsconfig.js","sourceRoot":"","sources":["../src/esbuild-tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOnD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,YAAgC;IAEhC,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC;YAC5B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;QACpC,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACzD,OAAO,EAAE,WAAW,EAAE,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IACpC,CAAC;AACH,CAAC","sourcesContent":["import { lstat, readFile } from 'node:fs/promises';\n\nexport type EsbuildTsconfigOptions = {\n tsconfig?: string;\n tsconfigRaw?: string;\n};\n\n/**\n * Returns the appropriate tsconfig options for esbuild.\n *\n * For symlinked tsconfig files we pass `tsconfigRaw` instead of `tsconfig` so\n * path aliases (for example `@/*`) are resolved relative to the current\n * working directory instead of the symlink target directory.\n */\nexport async function getEsbuildTsconfigOptions(\n tsconfigPath: string | undefined\n): Promise<EsbuildTsconfigOptions> {\n if (!tsconfigPath) {\n return {};\n }\n\n try {\n const stats = await lstat(tsconfigPath);\n if (!stats.isSymbolicLink()) {\n return { tsconfig: tsconfigPath };\n }\n\n const tsconfigRaw = await readFile(tsconfigPath, 'utf8');\n return { tsconfigRaw };\n } catch {\n return { tsconfig: tsconfigPath };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-tsconfig.test.js","sourceRoot":"","sources":["../src/esbuild-tsconfig.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,WAAW,EACX,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,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;AAE1C,SAAS,SAAS,CAAC,IAAY,EAAE,QAAgB;I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,MAAM,WAAW,CAAC;YACzC,UAAU;YACV,eAAe,EAAE,OAAO;SACzB,CAAC,CAAC;QAEH,MAAM,CACJ,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CACxE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,CACJ,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9B,KAAK,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CACpD,CACF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,CACJ,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9B,KAAK,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CACpD,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,MAAM,CACJ,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9B,KAAK,CAAC,QAAQ,CAAC,iDAAiD,CAAC,CAClE,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import {\n mkdirSync,\n mkdtempSync,\n realpathSync,\n rmSync,\n symlinkSync,\n writeFileSync,\n} from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport * as esbuild from 'esbuild';\nimport { afterEach, describe, expect, it } from 'vitest';\nimport { getEsbuildTsconfigOptions } from './esbuild-tsconfig.js';\n\nconst realTmpdir = realpathSync(tmpdir());\n\nfunction writeFile(path: string, contents: string): void {\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, contents, 'utf8');\n}\n\nfunction normalize(paths: string[]): string[] {\n return paths.map((p) => p.replace(/\\\\/g, '/'));\n}\n\nasync function buildInputs({\n workingDir,\n tsconfigOptions,\n}: {\n workingDir: string;\n tsconfigOptions: { tsconfig?: string; tsconfigRaw?: string };\n}): Promise<string[]> {\n const result = await esbuild.build({\n absWorkingDir: workingDir,\n bundle: true,\n format: 'esm',\n platform: 'node',\n write: false,\n logLevel: 'silent',\n metafile: true,\n stdin: {\n contents: `import '@/workflows/target'; import '@/app/.well-known/agent/v1/steps';`,\n resolveDir: workingDir,\n sourcefile: 'entry.ts',\n loader: 'ts',\n },\n ...tsconfigOptions,\n });\n\n return normalize(Object.keys(result.metafile.inputs));\n}\n\ndescribe('getEsbuildTsconfigOptions', () => {\n const createdRoots: string[] = [];\n const symlinkTest = process.platform === 'win32' ? it.skip : it;\n\n afterEach(() => {\n for (const root of createdRoots.splice(0)) {\n rmSync(root, { recursive: true, force: true });\n }\n });\n\n it('returns tsconfig for regular files', async () => {\n const root = mkdtempSync(join(realTmpdir, 'workflow-tsconfig-regular-'));\n createdRoots.push(root);\n const workingDir = join(root, 'app');\n const tsconfigPath = join(workingDir, 'tsconfig.json');\n\n writeFile(\n tsconfigPath,\n JSON.stringify(\n {\n compilerOptions: {\n paths: {\n '@/*': ['./*'],\n },\n },\n },\n null,\n 2\n )\n );\n\n const options = await getEsbuildTsconfigOptions(tsconfigPath);\n expect(options).toEqual({ tsconfig: tsconfigPath });\n });\n\n symlinkTest(\n 'uses tsconfigRaw for symlinked configs so aliases resolve from working dir',\n async () => {\n const root = mkdtempSync(join(realTmpdir, 'workflow-tsconfig-symlink-'));\n createdRoots.push(root);\n const workingDir = join(root, 'webpack-app');\n const sourceDir = join(root, 'turbopack-app');\n const symlinkTsconfigPath = join(workingDir, 'tsconfig.json');\n\n writeFile(\n join(sourceDir, 'tsconfig.json'),\n JSON.stringify(\n {\n compilerOptions: {\n paths: {\n '@/*': ['./*'],\n },\n },\n },\n null,\n 2\n )\n );\n\n writeFile(\n join(workingDir, 'workflows/target.ts'),\n 'export const id = \"webpack\";'\n );\n writeFile(\n join(workingDir, 'app/.well-known/agent/v1/steps.ts'),\n 'export const id = \"webpack-app\";'\n );\n writeFile(\n join(sourceDir, 'workflows/target.ts'),\n 'export const id = \"turbopack\";'\n );\n writeFile(\n join(sourceDir, 'app/.well-known/agent/v1/steps.ts'),\n 'export const id = \"turbopack-app\";'\n );\n\n symlinkSync(\n join(sourceDir, 'tsconfig.json'),\n symlinkTsconfigPath,\n 'file'\n );\n\n const directInputs = await buildInputs({\n workingDir,\n tsconfigOptions: { tsconfig: symlinkTsconfigPath },\n });\n expect(\n directInputs.some((input) =>\n input.includes('turbopack-app/workflows/target.ts')\n )\n ).toBe(true);\n expect(\n directInputs.some((input) =>\n input.includes('turbopack-app/app/.well-known/agent/v1/steps.ts')\n )\n ).toBe(true);\n\n const options = await getEsbuildTsconfigOptions(symlinkTsconfigPath);\n expect(typeof options.tsconfigRaw).toBe('string');\n expect(options.tsconfig).toBeUndefined();\n\n const normalizedInputs = await buildInputs({\n workingDir,\n tsconfigOptions: options,\n });\n\n expect(\n normalizedInputs.some((input) => input.endsWith('workflows/target.ts'))\n ).toBe(true);\n expect(\n normalizedInputs.some((input) =>\n input.endsWith('app/.well-known/agent/v1/steps.ts')\n )\n ).toBe(true);\n expect(\n normalizedInputs.some((input) =>\n input.includes('turbopack-app/workflows/target.ts')\n )\n ).toBe(false);\n expect(\n normalizedInputs.some((input) =>\n input.includes('turbopack-app/app/.well-known/agent/v1/steps.ts')\n )\n ).toBe(false);\n }\n );\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-input-files.test.js","sourceRoot":"","sources":["../src/get-input-files.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,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,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AM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QAExC,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAC,IAAI,CAC/C,IAAI,CAAC,QAAQ,EAAE,oDAAoD,CAAC,CACrE,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 { afterEach, beforeEach, describe, expect, it } from 'vitest';\nimport { BaseBuilder } from './base-builder.js';\nimport type { StandaloneConfig, VercelBuildOutputConfig } from './types.js';\n\n/**\n * Minimal subclass to expose the protected `getInputFiles()` for testing.\n */\nclass TestBuilder extends BaseBuilder {\n async build(): Promise<void> {\n // no-op\n }\n\n // Expose for tests\n public getInputFiles(): Promise<string[]> {\n return super.getInputFiles();\n }\n\n public getDiagnosticsManifestPath(): string | undefined {\n return super.getDiagnosticsManifestPath();\n }\n}\n\n// Resolve symlinks in tmpdir to avoid macOS /var -> /private/var issues\nconst realTmpdir = realpathSync(tmpdir());\n\n/**\n * Normalize a path to forward slashes for cross-platform comparison.\n * tinyglobby always returns forward-slash paths, even on Windows,\n * while Node's `path.join()` uses backslashes on Windows.\n */\nfunction normalize(p: string): string {\n return p.replace(/\\\\/g, '/');\n}\n\nfunction writeFile(dir: string, relativePath: string, content = ''): string {\n const fullPath = join(dir, relativePath);\n mkdirSync(dirname(fullPath), { recursive: true });\n writeFileSync(fullPath, content, 'utf-8');\n return fullPath;\n}\n\nfunction createBuilder(\n workingDir: string,\n dirs: string[],\n configOverrides: Partial<StandaloneConfig> = {}\n): TestBuilder {\n const config: StandaloneConfig = {\n buildTarget: 'standalone',\n workingDir,\n dirs,\n stepsBundlePath: join(workingDir, 'steps.js'),\n workflowsBundlePath: join(workingDir, 'workflows.js'),\n webhookBundlePath: join(workingDir, 'webhook.js'),\n ...configOverrides,\n };\n return new TestBuilder(config);\n}\n\ndescribe('getInputFiles', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'get-input-files-'));\n });\n\n afterEach(() => {\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n it('discovers files inside dot-prefixed directories', async () => {\n const srcDir = join(testRoot, 'src');\n writeFile(srcDir, '.hidden/step.ts', \"'use step';\");\n writeFile(srcDir, '.config/workflow.ts', \"'use workflow';\");\n writeFile(srcDir, 'regular/step.ts', \"'use step';\");\n\n const builder = createBuilder(testRoot, ['src']);\n const files = (await builder.getInputFiles()).map(normalize);\n\n expect(files).toContain(normalize(join(srcDir, '.hidden/step.ts')));\n expect(files).toContain(normalize(join(srcDir, '.config/workflow.ts')));\n expect(files).toContain(normalize(join(srcDir, 'regular/step.ts')));\n });\n\n it('discovers dot-prefixed files', async () => {\n const srcDir = join(testRoot, 'src');\n writeFile(srcDir, '.hidden-step.ts', \"'use step';\");\n writeFile(srcDir, 'visible-step.ts', \"'use step';\");\n\n const builder = createBuilder(testRoot, ['src']);\n const files = (await builder.getInputFiles()).map(normalize);\n\n expect(files).toContain(normalize(join(srcDir, '.hidden-step.ts')));\n expect(files).toContain(normalize(join(srcDir, 'visible-step.ts')));\n });\n\n it('still excludes explicitly ignored dot-directories', async () => {\n const srcDir = join(testRoot, 'src');\n writeFile(srcDir, '.git/hooks/pre-commit.ts');\n writeFile(srcDir, '.next/server/page.ts');\n writeFile(srcDir, '.nuxt/workflow/steps.mjs');\n writeFile(srcDir, '.vercel/output/step.ts');\n writeFile(srcDir, '.svelte-kit/output/step.ts');\n writeFile(srcDir, '.workflow-data/state.ts');\n writeFile(srcDir, '.workflow-vitest/workflows.mjs');\n writeFile(srcDir, '.well-known/workflow/route.ts');\n writeFile(srcDir, '.turbo/cache/build.ts');\n writeFile(srcDir, '.cache/babel/plugin.js');\n writeFile(srcDir, '.yarn/releases/yarn.cjs');\n writeFile(srcDir, '.pnpm-store/v3/files.ts');\n writeFile(srcDir, 'node_modules/pkg/index.ts');\n // This one should still be found\n writeFile(srcDir, '.custom/step.ts', \"'use step';\");\n\n const builder = createBuilder(testRoot, ['src']);\n const files = (await builder.getInputFiles()).map(normalize);\n\n expect(files).not.toContain(\n normalize(join(srcDir, '.git/hooks/pre-commit.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.next/server/page.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.nuxt/workflow/steps.mjs'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.vercel/output/step.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.svelte-kit/output/step.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.workflow-data/state.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.workflow-vitest/workflows.mjs'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.well-known/workflow/route.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.turbo/cache/build.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.cache/babel/plugin.js'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.yarn/releases/yarn.cjs'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, '.pnpm-store/v3/files.ts'))\n );\n expect(files).not.toContain(\n normalize(join(srcDir, 'node_modules/pkg/index.ts'))\n );\n expect(files).toContain(normalize(join(srcDir, '.custom/step.ts')));\n });\n\n it('discovers files with various supported extensions in dot-directories', async () => {\n const srcDir = join(testRoot, 'src');\n writeFile(srcDir, '.api/route.tsx');\n writeFile(srcDir, '.api/handler.mts');\n writeFile(srcDir, '.api/utils.js');\n writeFile(srcDir, '.api/config.cjs');\n\n const builder = createBuilder(testRoot, ['src']);\n const files = (await builder.getInputFiles()).map(normalize);\n\n expect(files).toContain(normalize(join(srcDir, '.api/route.tsx')));\n expect(files).toContain(normalize(join(srcDir, '.api/handler.mts')));\n expect(files).toContain(normalize(join(srcDir, '.api/utils.js')));\n expect(files).toContain(normalize(join(srcDir, '.api/config.cjs')));\n });\n});\n\ndescribe('getDiagnosticsManifestPath', () => {\n let testRoot: string;\n\n beforeEach(() => {\n testRoot = mkdtempSync(join(realTmpdir, 'diagnostics-path-'));\n });\n\n afterEach(() => {\n rmSync(testRoot, { recursive: true, force: true });\n });\n\n it('uses an explicit diagnosticsDir when configured', () => {\n const builder = createBuilder(testRoot, ['src'], {\n diagnosticsDir: '.next/diagnostics',\n });\n\n expect(builder.getDiagnosticsManifestPath()).toBe(\n join(testRoot, '.next/diagnostics/workflows-manifest.json')\n );\n });\n\n it('does not emit Vercel diagnostics for non-Vercel builder targets', () => {\n const previousTargetWorld = process.env.WORKFLOW_TARGET_WORLD;\n process.env.WORKFLOW_TARGET_WORLD = 'vercel';\n try {\n const builder = createBuilder(testRoot, ['src']);\n\n expect(builder.getDiagnosticsManifestPath()).toBeUndefined();\n } finally {\n if (previousTargetWorld === undefined) {\n delete process.env.WORKFLOW_TARGET_WORLD;\n } else {\n process.env.WORKFLOW_TARGET_WORLD = previousTargetWorld;\n }\n }\n });\n\n it('falls back to Vercel output diagnostics for the Vercel builder', () => {\n const config: VercelBuildOutputConfig = {\n buildTarget: 'vercel-build-output-api',\n workingDir: testRoot,\n dirs: ['src'],\n stepsBundlePath: join(testRoot, 'steps.js'),\n workflowsBundlePath: join(testRoot, 'workflows.js'),\n webhookBundlePath: join(testRoot, 'webhook.js'),\n };\n const builder = new TestBuilder(config);\n\n expect(builder.getDiagnosticsManifestPath()).toBe(\n join(testRoot, '.vercel/output/diagnostics/workflows-manifest.json')\n );\n });\n});\n"]}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,uBAAuB,EAGvB,+BAA+B,EAC/B,6CAA6C,GAC9C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EACL,yBAAyB,EACzB,aAAa,EAGb,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACL,yBAAyB,EACzB,eAAe,GAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GAGpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAElB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export type { WorkflowManifest } from './apply-swc-transform.js';\nexport { applySwcTransform } from './apply-swc-transform.js';\nexport { BaseBuilder } from './base-builder.js';\nexport { createBuildQueue } from './build-queue.js';\nexport {\n createBaseBuilderConfig,\n type DecoratorOptions,\n type DecoratorOptionsWithConfigPath,\n getDecoratorOptionsForDirectory,\n getDecoratorOptionsForDirectoryWithConfigPath,\n} from './config-helpers.js';\nexport { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';\nexport { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';\nexport {\n clearModuleSpecifierCache,\n getImportPath,\n type ImportPathResult,\n type ModuleSpecifierResult,\n resolveModuleSpecifier,\n} from './module-specifier.js';\nexport { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';\nexport {\n createPseudoPackagePlugin,\n PSEUDO_PACKAGES,\n} from './pseudo-package-esbuild-plugin.js';\nexport { NORMALIZE_REQUEST_CODE } from './request-converter.js';\nexport {\n analyzeSerdeCompliance,\n extractClassEntries,\n type SerdeCheckResult,\n type SerdeClassCheckResult,\n} from './serde-checker.js';\nexport { StandaloneBuilder } from './standalone.js';\nexport { createSwcPlugin } from './swc-esbuild-plugin.js';\nexport {\n detectWorkflowPatterns,\n generatedWorkflowPathPattern,\n isGeneratedWorkflowFile,\n shouldTransformFile,\n turbopackContentPattern,\n useStepPattern,\n useWorkflowPattern,\n type WorkflowPatternMatch,\n workflowSerdeImportPattern,\n workflowSerdeSymbolPattern,\n} from './transform-utils.js';\nexport type {\n AstroConfig,\n BuildTarget,\n NextConfig,\n StandaloneConfig,\n SvelteKitConfig,\n VercelBuildOutputConfig,\n WorkflowConfig,\n} from './types.js';\nexport { isValidBuildTarget, validBuildTargets } from './types.js';\nexport { VercelBuildOutputAPIBuilder } from './vercel-build-output-api.js';\nexport { resolveWorkflowAliasRelativePath } from './workflow-alias.js';\n"]}
|