@workflow/builders 4.0.1-beta.9 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/apply-swc-transform.d.ts +19 -4
- package/dist/apply-swc-transform.d.ts.map +1 -1
- package/dist/apply-swc-transform.js +62 -7
- package/dist/apply-swc-transform.js.map +1 -1
- package/dist/base-builder.d.ts +77 -22
- package/dist/base-builder.d.ts.map +1 -1
- package/dist/base-builder.js +667 -202
- package/dist/base-builder.js.map +1 -1
- package/dist/build-queue.d.ts +18 -0
- package/dist/build-queue.d.ts.map +1 -0
- package/dist/build-queue.js +26 -0
- package/dist/build-queue.js.map +1 -0
- package/dist/config-helpers.d.ts +32 -0
- package/dist/config-helpers.d.ts.map +1 -1
- package/dist/config-helpers.js +61 -0
- package/dist/config-helpers.js.map +1 -1
- package/dist/constants.d.ts +2 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -4
- package/dist/constants.js.map +1 -1
- package/dist/discover-entries-esbuild-plugin.d.ts +5 -6
- package/dist/discover-entries-esbuild-plugin.d.ts.map +1 -1
- package/dist/discover-entries-esbuild-plugin.js +98 -30
- package/dist/discover-entries-esbuild-plugin.js.map +1 -1
- package/dist/discover-entries-esbuild-plugin.test.d.ts +2 -0
- package/dist/discover-entries-esbuild-plugin.test.d.ts.map +1 -0
- package/dist/discover-entries-esbuild-plugin.test.js +110 -0
- package/dist/discover-entries-esbuild-plugin.test.js.map +1 -0
- package/dist/esbuild-tsconfig.d.ts +13 -0
- package/dist/esbuild-tsconfig.d.ts.map +1 -0
- package/dist/esbuild-tsconfig.js +25 -0
- package/dist/esbuild-tsconfig.js.map +1 -0
- package/dist/esbuild-tsconfig.test.d.ts +2 -0
- package/dist/esbuild-tsconfig.test.d.ts.map +1 -0
- package/dist/esbuild-tsconfig.test.js +94 -0
- package/dist/esbuild-tsconfig.test.js.map +1 -0
- package/dist/get-input-files.test.d.ts +2 -0
- package/dist/get-input-files.test.d.ts.map +1 -0
- package/dist/get-input-files.test.js +121 -0
- package/dist/get-input-files.test.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/module-specifier.d.ts +85 -0
- package/dist/module-specifier.d.ts.map +1 -0
- package/dist/module-specifier.js +448 -0
- package/dist/module-specifier.js.map +1 -0
- package/dist/module-specifier.test.d.ts +2 -0
- package/dist/module-specifier.test.d.ts.map +1 -0
- package/dist/module-specifier.test.js +240 -0
- package/dist/module-specifier.test.js.map +1 -0
- package/dist/node-module-esbuild-plugin.d.ts +37 -0
- package/dist/node-module-esbuild-plugin.d.ts.map +1 -1
- package/dist/node-module-esbuild-plugin.js +364 -7
- package/dist/node-module-esbuild-plugin.js.map +1 -1
- package/dist/node-module-esbuild-plugin.test.js +461 -146
- package/dist/node-module-esbuild-plugin.test.js.map +1 -1
- package/dist/pseudo-package-esbuild-plugin.d.ts +20 -0
- package/dist/pseudo-package-esbuild-plugin.d.ts.map +1 -0
- package/dist/pseudo-package-esbuild-plugin.js +47 -0
- package/dist/pseudo-package-esbuild-plugin.js.map +1 -0
- package/dist/pseudo-package-esbuild-plugin.test.d.ts +2 -0
- package/dist/pseudo-package-esbuild-plugin.test.d.ts.map +1 -0
- package/dist/pseudo-package-esbuild-plugin.test.js +315 -0
- package/dist/pseudo-package-esbuild-plugin.test.js.map +1 -0
- package/dist/request-converter.d.ts +3 -0
- package/dist/request-converter.d.ts.map +1 -0
- package/dist/request-converter.js +14 -0
- package/dist/request-converter.js.map +1 -0
- package/dist/serde-checker.d.ts +70 -0
- package/dist/serde-checker.d.ts.map +1 -0
- package/dist/serde-checker.js +118 -0
- package/dist/serde-checker.js.map +1 -0
- package/dist/standalone.d.ts +3 -0
- package/dist/standalone.d.ts.map +1 -1
- package/dist/standalone.js +37 -13
- package/dist/standalone.js.map +1 -1
- package/dist/swc-esbuild-plugin.d.ts +23 -2
- package/dist/swc-esbuild-plugin.d.ts.map +1 -1
- package/dist/swc-esbuild-plugin.js +133 -43
- package/dist/swc-esbuild-plugin.js.map +1 -1
- package/dist/swc-esbuild-plugin.test.d.ts +2 -0
- package/dist/swc-esbuild-plugin.test.d.ts.map +1 -0
- package/dist/swc-esbuild-plugin.test.js +493 -0
- package/dist/swc-esbuild-plugin.test.js.map +1 -0
- package/dist/transform-utils.d.ts +68 -0
- package/dist/transform-utils.d.ts.map +1 -0
- package/dist/transform-utils.js +102 -0
- package/dist/transform-utils.js.map +1 -0
- package/dist/transform-utils.test.d.ts +2 -0
- package/dist/transform-utils.test.d.ts.map +1 -0
- package/dist/transform-utils.test.js +302 -0
- package/dist/transform-utils.test.js.map +1 -0
- package/dist/types.d.ts +31 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/dist/vercel-build-output-api.d.ts.map +1 -1
- package/dist/vercel-build-output-api.js +38 -14
- package/dist/vercel-build-output-api.js.map +1 -1
- package/dist/workflow-alias.d.ts +3 -0
- package/dist/workflow-alias.d.ts.map +1 -0
- package/dist/workflow-alias.js +65 -0
- package/dist/workflow-alias.js.map +1 -0
- package/dist/workflow-alias.test.d.ts +2 -0
- package/dist/workflow-alias.test.d.ts.map +1 -0
- package/dist/workflow-alias.test.js +53 -0
- package/dist/workflow-alias.test.js.map +1 -0
- package/dist/workflows-extractor.d.ts +92 -0
- package/dist/workflows-extractor.d.ts.map +1 -0
- package/dist/workflows-extractor.js +1476 -0
- package/dist/workflows-extractor.js.map +1 -0
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @workflow/builders
|
|
2
2
|
|
|
3
|
-
Shared builder infrastructure for Workflow
|
|
3
|
+
Shared builder infrastructure for Workflow SDK. This package provides the base builder class and utilities used by framework-specific integrations.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -13,11 +13,26 @@ export type WorkflowManifest = {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
+
classes?: {
|
|
17
|
+
[relativeFileName: string]: {
|
|
18
|
+
[className: string]: {
|
|
19
|
+
classId: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
16
23
|
};
|
|
17
|
-
export declare function applySwcTransform(filename: string, source: string, mode: 'workflow' | 'step' | 'client' | false,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
export declare function applySwcTransform(filename: string, source: string, mode: 'workflow' | 'step' | 'client' | 'detect' | false,
|
|
25
|
+
/**
|
|
26
|
+
* Optional absolute path to the file being transformed.
|
|
27
|
+
* Used for module specifier resolution when filename is relative.
|
|
28
|
+
* If not provided, filename is joined with process.cwd().
|
|
29
|
+
*/
|
|
30
|
+
absolutePath?: string,
|
|
31
|
+
/**
|
|
32
|
+
* Optional project root used for module specifier resolution.
|
|
33
|
+
* Defaults to process.cwd() for backwards compatibility.
|
|
34
|
+
*/
|
|
35
|
+
projectRoot?: string): Promise<{
|
|
21
36
|
code: string;
|
|
22
37
|
workflowManifest: WorkflowManifest;
|
|
23
38
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-swc-transform.d.ts","sourceRoot":"","sources":["../src/apply-swc-transform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-swc-transform.d.ts","sourceRoot":"","sources":["../src/apply-swc-transform.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE;QACN,CAAC,gBAAgB,EAAE,MAAM,GAAG;YAC1B,CAAC,YAAY,EAAE,MAAM,GAAG;gBACtB,MAAM,EAAE,MAAM,CAAC;aAChB,CAAC;SACH,CAAC;KACH,CAAC;IACF,SAAS,CAAC,EAAE;QACV,CAAC,gBAAgB,EAAE,MAAM,GAAG;YAC1B,CAAC,YAAY,EAAE,MAAM,GAAG;gBACtB,UAAU,EAAE,MAAM,CAAC;aACpB,CAAC;SACH,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE;QACR,CAAC,gBAAgB,EAAE,MAAM,GAAG;YAC1B,CAAC,SAAS,EAAE,MAAM,GAAG;gBACnB,OAAO,EAAE,MAAM,CAAC;aACjB,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK;AACvD;;;;GAIG;AACH,YAAY,CAAC,EAAE,MAAM;AACrB;;;GAGG;AACH,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC,CA6ED"}
|
|
@@ -1,26 +1,81 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
+
import { dirname, isAbsolute, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
2
4
|
import { transform } from '@swc/core';
|
|
5
|
+
import { getDecoratorOptionsForDirectory } from './config-helpers.js';
|
|
6
|
+
import { resolveModuleSpecifier } from './module-specifier.js';
|
|
3
7
|
const require = createRequire(import.meta.url);
|
|
4
|
-
|
|
8
|
+
// Cache decorator options per directory - tsconfig doesn't change during a build
|
|
9
|
+
const decoratorOptionsCache = new Map();
|
|
10
|
+
function getDecoratorOptions(projectRoot) {
|
|
11
|
+
const cwd = projectRoot ?? process.cwd();
|
|
12
|
+
let cached = decoratorOptionsCache.get(cwd);
|
|
13
|
+
if (!cached) {
|
|
14
|
+
cached = getDecoratorOptionsForDirectory(cwd);
|
|
15
|
+
decoratorOptionsCache.set(cwd, cached);
|
|
16
|
+
}
|
|
17
|
+
return cached;
|
|
18
|
+
}
|
|
19
|
+
export async function applySwcTransform(filename, source, mode,
|
|
20
|
+
/**
|
|
21
|
+
* Optional absolute path to the file being transformed.
|
|
22
|
+
* Used for module specifier resolution when filename is relative.
|
|
23
|
+
* If not provided, filename is joined with process.cwd().
|
|
24
|
+
*/
|
|
25
|
+
absolutePath,
|
|
26
|
+
/**
|
|
27
|
+
* Optional project root used for module specifier resolution.
|
|
28
|
+
* Defaults to process.cwd() for backwards compatibility.
|
|
29
|
+
*/
|
|
30
|
+
projectRoot) {
|
|
31
|
+
const resolvedProjectRoot = projectRoot ?? process.cwd();
|
|
32
|
+
const decoratorOptions = await getDecoratorOptions(resolvedProjectRoot);
|
|
33
|
+
const swcPluginPath = require.resolve('@workflow/swc-plugin', {
|
|
34
|
+
paths: [dirname(fileURLToPath(import.meta.url))],
|
|
35
|
+
});
|
|
5
36
|
// Determine if this is a TypeScript file
|
|
6
|
-
const isTypeScript = filename.endsWith('.ts') ||
|
|
7
|
-
|
|
37
|
+
const isTypeScript = filename.endsWith('.ts') ||
|
|
38
|
+
filename.endsWith('.tsx') ||
|
|
39
|
+
filename.endsWith('.mts') ||
|
|
40
|
+
filename.endsWith('.cts');
|
|
41
|
+
// Resolve module specifier for packages (node_modules or workspace packages)
|
|
42
|
+
const absoluteFilename = absolutePath
|
|
43
|
+
? absolutePath
|
|
44
|
+
: isAbsolute(filename)
|
|
45
|
+
? filename
|
|
46
|
+
: join(resolvedProjectRoot, filename);
|
|
47
|
+
const { moduleSpecifier } = resolveModuleSpecifier(absoluteFilename, resolvedProjectRoot);
|
|
8
48
|
// Transform with SWC to support syntax esbuild doesn't
|
|
9
49
|
const result = await transform(source, {
|
|
10
50
|
filename,
|
|
11
51
|
swcrc: false,
|
|
12
52
|
jsc: {
|
|
13
53
|
parser: {
|
|
14
|
-
|
|
15
|
-
|
|
54
|
+
...(isTypeScript
|
|
55
|
+
? {
|
|
56
|
+
syntax: 'typescript',
|
|
57
|
+
tsx: filename.endsWith('.tsx'),
|
|
58
|
+
decorators: decoratorOptions.decorators,
|
|
59
|
+
}
|
|
60
|
+
: {
|
|
61
|
+
syntax: 'ecmascript',
|
|
62
|
+
jsx: filename.endsWith('.jsx'),
|
|
63
|
+
decorators: decoratorOptions.decorators,
|
|
64
|
+
}),
|
|
16
65
|
},
|
|
17
66
|
target: 'es2022',
|
|
18
67
|
experimental: mode
|
|
19
68
|
? {
|
|
20
|
-
plugins: [[
|
|
69
|
+
plugins: [[swcPluginPath, { mode, moduleSpecifier }]],
|
|
21
70
|
}
|
|
22
71
|
: undefined,
|
|
23
|
-
|
|
72
|
+
transform: {
|
|
73
|
+
react: {
|
|
74
|
+
runtime: 'preserve',
|
|
75
|
+
},
|
|
76
|
+
legacyDecorator: decoratorOptions.legacyDecorator,
|
|
77
|
+
decoratorMetadata: decoratorOptions.decoratorMetadata,
|
|
78
|
+
},
|
|
24
79
|
},
|
|
25
80
|
// TODO: investigate proper source map support as they
|
|
26
81
|
// won't even be used in Node.js by default unless we
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-swc-transform.js","sourceRoot":"","sources":["../src/apply-swc-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"apply-swc-transform.js","sourceRoot":"","sources":["../src/apply-swc-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,C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C,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"}
|
package/dist/base-builder.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
+
import { type WorkflowManifest } from './apply-swc-transform.js';
|
|
2
3
|
import type { WorkflowConfig } from './types.js';
|
|
4
|
+
export interface DiscoveredEntries {
|
|
5
|
+
discoveredSteps: Set<string>;
|
|
6
|
+
discoveredWorkflows: Set<string>;
|
|
7
|
+
discoveredSerdeFiles: Set<string>;
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* Base class for workflow builders. Provides common build logic for transforming
|
|
5
11
|
* workflow source files into deployable bundles using esbuild and SWC.
|
|
@@ -9,19 +15,34 @@ import type { WorkflowConfig } from './types.js';
|
|
|
9
15
|
export declare abstract class BaseBuilder {
|
|
10
16
|
protected config: WorkflowConfig;
|
|
11
17
|
constructor(config: WorkflowConfig);
|
|
18
|
+
protected get transformProjectRoot(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether informational BaseBuilder logs should be printed.
|
|
21
|
+
* Subclasses can override this to silence progress logs while keeping warnings/errors.
|
|
22
|
+
*/
|
|
23
|
+
protected get shouldLogBaseBuilderInfo(): boolean;
|
|
24
|
+
protected logBaseBuilderInfo(...args: unknown[]): void;
|
|
25
|
+
private logCreateWorkflowsBundleInfo;
|
|
26
|
+
private logCreateWebhookBundleInfo;
|
|
27
|
+
private logCreateManifestInfo;
|
|
28
|
+
/**
|
|
29
|
+
* When outputting CJS, esbuild replaces `import.meta` with an empty object,
|
|
30
|
+
* making `import.meta.url` (and `import.meta.resolve`) undefined. This method
|
|
31
|
+
* returns banner code and `define` entries that polyfill them using CJS
|
|
32
|
+
* equivalents (`__filename`, `require.resolve`) so user code (e.g. Prisma)
|
|
33
|
+
* that relies on `import.meta.url` works correctly in bundled CJS output.
|
|
34
|
+
*/
|
|
35
|
+
private getCjsImportMetaPolyfill;
|
|
12
36
|
/**
|
|
13
37
|
* Performs the complete build process for workflows.
|
|
14
38
|
* Subclasses must implement this to define their specific build steps.
|
|
15
39
|
*/
|
|
16
40
|
abstract build(): Promise<void>;
|
|
17
41
|
/**
|
|
18
|
-
*
|
|
19
|
-
* Used to properly resolve module imports during bundling.
|
|
42
|
+
* Finds tsconfig.json/jsconfig.json for the project.
|
|
43
|
+
* Used by esbuild to properly resolve module imports during bundling.
|
|
20
44
|
*/
|
|
21
|
-
protected
|
|
22
|
-
baseUrl?: string;
|
|
23
|
-
paths?: Record<string, string[]>;
|
|
24
|
-
}>;
|
|
45
|
+
protected findTsConfigPath(): Promise<string | undefined>;
|
|
25
46
|
/**
|
|
26
47
|
* Discovers all source files in the configured directories.
|
|
27
48
|
* Searches for TypeScript and JavaScript files while excluding common build
|
|
@@ -35,13 +56,11 @@ export declare abstract class BaseBuilder {
|
|
|
35
56
|
* (e.g., when files are added/removed during watch mode).
|
|
36
57
|
*/
|
|
37
58
|
private discoveredEntries;
|
|
38
|
-
protected discoverEntries(inputs: string[], outdir: string): Promise<
|
|
39
|
-
discoveredSteps: string[];
|
|
40
|
-
discoveredWorkflows: string[];
|
|
41
|
-
}>;
|
|
59
|
+
protected discoverEntries(inputs: string[], outdir: string, tsconfigPath?: string): Promise<DiscoveredEntries>;
|
|
42
60
|
/**
|
|
43
61
|
* Writes debug information to a JSON file for troubleshooting build issues.
|
|
44
|
-
*
|
|
62
|
+
* Uses atomic write (temp file + rename) to prevent race conditions when
|
|
63
|
+
* multiple builds run concurrently.
|
|
45
64
|
*/
|
|
46
65
|
private writeDebugFile;
|
|
47
66
|
/**
|
|
@@ -49,36 +68,47 @@ export declare abstract class BaseBuilder {
|
|
|
49
68
|
* @param throwOnError - If true, throws an error when esbuild errors are present
|
|
50
69
|
*/
|
|
51
70
|
private logEsbuildMessages;
|
|
71
|
+
/**
|
|
72
|
+
* Converts an absolute file path to a normalized relative path for the manifest.
|
|
73
|
+
*/
|
|
74
|
+
private getRelativeFilepath;
|
|
52
75
|
/**
|
|
53
76
|
* Creates a bundle for workflow step functions.
|
|
54
77
|
* Steps have full Node.js runtime access and handle side effects, API calls, etc.
|
|
55
78
|
*
|
|
56
79
|
* @param externalizeNonSteps - If true, only bundles step entry points and externalizes other code
|
|
80
|
+
* @returns Build context (for watch mode) and the collected workflow manifest
|
|
57
81
|
*/
|
|
58
|
-
protected createStepsBundle({ inputFiles, format, outfile, externalizeNonSteps,
|
|
59
|
-
|
|
60
|
-
tsBaseUrl?: string;
|
|
82
|
+
protected createStepsBundle({ inputFiles, format, outfile, externalizeNonSteps, rewriteTsExtensions, tsconfigPath, discoveredEntries, }: {
|
|
83
|
+
tsconfigPath?: string;
|
|
61
84
|
inputFiles: string[];
|
|
62
85
|
outfile: string;
|
|
63
86
|
format?: 'cjs' | 'esm';
|
|
64
87
|
externalizeNonSteps?: boolean;
|
|
65
|
-
|
|
88
|
+
rewriteTsExtensions?: boolean;
|
|
89
|
+
discoveredEntries?: DiscoveredEntries;
|
|
90
|
+
}): Promise<{
|
|
91
|
+
context: esbuild.BuildContext | undefined;
|
|
92
|
+
manifest: WorkflowManifest;
|
|
93
|
+
}>;
|
|
66
94
|
/**
|
|
67
95
|
* Creates a bundle for workflow orchestration functions.
|
|
68
96
|
* Workflows run in a sandboxed VM and coordinate step execution.
|
|
69
97
|
*
|
|
70
98
|
* @param bundleFinalOutput - If false, skips the final bundling step (used by Next.js)
|
|
71
99
|
*/
|
|
72
|
-
protected createWorkflowsBundle({ inputFiles, format, outfile, bundleFinalOutput,
|
|
73
|
-
|
|
74
|
-
tsBaseUrl?: string;
|
|
100
|
+
protected createWorkflowsBundle({ inputFiles, format, outfile, bundleFinalOutput, keepInterimBundleContext, tsconfigPath, discoveredEntries, }: {
|
|
101
|
+
tsconfigPath?: string;
|
|
75
102
|
inputFiles: string[];
|
|
76
103
|
outfile: string;
|
|
77
104
|
format?: 'cjs' | 'esm';
|
|
78
105
|
bundleFinalOutput?: boolean;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
keepInterimBundleContext?: boolean;
|
|
107
|
+
discoveredEntries?: DiscoveredEntries;
|
|
108
|
+
}): Promise<{
|
|
109
|
+
manifest: WorkflowManifest;
|
|
110
|
+
interimBundleCtx?: esbuild.BuildContext;
|
|
111
|
+
bundleFinal?: (interimBundleResult: string) => Promise<void>;
|
|
82
112
|
}>;
|
|
83
113
|
/**
|
|
84
114
|
* Creates a client library bundle for workflow execution.
|
|
@@ -109,8 +139,9 @@ export declare abstract class BaseBuilder {
|
|
|
109
139
|
architecture?: string;
|
|
110
140
|
shouldAddHelpers?: boolean;
|
|
111
141
|
shouldAddSourcemapSupport?: boolean;
|
|
142
|
+
maxDuration?: number | 'max';
|
|
112
143
|
experimentalTriggers?: Array<{
|
|
113
|
-
type:
|
|
144
|
+
type: 'queue/v2beta';
|
|
114
145
|
topic: string;
|
|
115
146
|
consumer: string;
|
|
116
147
|
maxDeliveries?: number;
|
|
@@ -127,5 +158,29 @@ export declare abstract class BaseBuilder {
|
|
|
127
158
|
*/
|
|
128
159
|
protected ensureDirectory(filePath: string): Promise<void>;
|
|
129
160
|
private createSwcGitignore;
|
|
161
|
+
/**
|
|
162
|
+
* Whether the manifest should be exposed as a public HTTP route.
|
|
163
|
+
* Controlled by the `WORKFLOW_PUBLIC_MANIFEST` environment variable.
|
|
164
|
+
*/
|
|
165
|
+
protected get shouldExposePublicManifest(): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Whether diagnostics artifacts should be emitted to Vercel output.
|
|
168
|
+
* This is enabled when the resolved world target is Vercel.
|
|
169
|
+
*/
|
|
170
|
+
protected get shouldEmitVercelDiagnostics(): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Creates a manifest JSON file containing step/workflow/class metadata
|
|
173
|
+
* and graph data for visualization.
|
|
174
|
+
*
|
|
175
|
+
* @returns The manifest JSON string, or undefined if manifest creation failed.
|
|
176
|
+
*/
|
|
177
|
+
protected createManifest({ workflowBundlePath, manifestDir, manifest, }: {
|
|
178
|
+
workflowBundlePath: string;
|
|
179
|
+
manifestDir: string;
|
|
180
|
+
manifest: WorkflowManifest;
|
|
181
|
+
}): Promise<string | undefined>;
|
|
182
|
+
private convertStepsManifest;
|
|
183
|
+
private convertWorkflowsManifest;
|
|
184
|
+
private convertClassesManifest;
|
|
130
185
|
}
|
|
131
186
|
//# sourceMappingURL=base-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-builder.d.ts","sourceRoot":"","sources":["../src/base-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-builder.d.ts","sourceRoot":"","sources":["../src/base-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA2BjD,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;GAKG;AACH,8BAAsB,WAAW;IAC/B,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;gBAErB,MAAM,EAAE,cAAc;IAIlC,SAAS,KAAK,oBAAoB,IAAI,MAAM,CAE3C;IAED;;;OAGG;IACH,SAAS,KAAK,wBAAwB,IAAI,OAAO,CAEhD;IAED,SAAS,CAAC,kBAAkB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtD,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,0BAA0B;I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