@workflow/builders 4.0.1-beta.10
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/LICENSE.md +201 -0
- package/README.md +43 -0
- package/dist/apply-swc-transform.d.ts +24 -0
- package/dist/apply-swc-transform.d.ts.map +1 -0
- package/dist/apply-swc-transform.js +38 -0
- package/dist/apply-swc-transform.js.map +1 -0
- package/dist/base-builder.d.ts +135 -0
- package/dist/base-builder.d.ts.map +1 -0
- package/dist/base-builder.js +598 -0
- package/dist/base-builder.js.map +1 -0
- package/dist/config-helpers.d.ts +12 -0
- package/dist/config-helpers.d.ts.map +1 -0
- package/dist/config-helpers.js +16 -0
- package/dist/config-helpers.js.map +1 -0
- package/dist/constants.d.ts +25 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +25 -0
- package/dist/constants.js.map +1 -0
- package/dist/discover-entries-esbuild-plugin.d.ts +11 -0
- package/dist/discover-entries-esbuild-plugin.d.ts.map +1 -0
- package/dist/discover-entries-esbuild-plugin.js +87 -0
- package/dist/discover-entries-esbuild-plugin.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/node-module-esbuild-plugin.d.ts +3 -0
- package/dist/node-module-esbuild-plugin.d.ts.map +1 -0
- package/dist/node-module-esbuild-plugin.js +25 -0
- package/dist/node-module-esbuild-plugin.js.map +1 -0
- package/dist/node-module-esbuild-plugin.test.d.ts +2 -0
- package/dist/node-module-esbuild-plugin.test.d.ts.map +1 -0
- package/dist/node-module-esbuild-plugin.test.js +198 -0
- package/dist/node-module-esbuild-plugin.test.js.map +1 -0
- package/dist/standalone.d.ts +8 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +47 -0
- package/dist/standalone.js.map +1 -0
- package/dist/swc-esbuild-plugin.d.ts +12 -0
- package/dist/swc-esbuild-plugin.d.ts.map +1 -0
- package/dist/swc-esbuild-plugin.js +179 -0
- package/dist/swc-esbuild-plugin.js.map +1 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/vercel-build-output-api.d.ts +9 -0
- package/dist/vercel-build-output-api.d.ts.map +1 -0
- package/dist/vercel-build-output-api.js +92 -0
- package/dist/vercel-build-output-api.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue trigger configuration for workflow step execution.
|
|
3
|
+
* Steps are queued to the __wkf_step_* topic.
|
|
4
|
+
*/
|
|
5
|
+
export declare const STEP_QUEUE_TRIGGER: {
|
|
6
|
+
type: "queue/v1beta";
|
|
7
|
+
topic: string;
|
|
8
|
+
consumer: string;
|
|
9
|
+
maxDeliveries: number;
|
|
10
|
+
retryAfterSeconds: number;
|
|
11
|
+
initialDelaySeconds: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Queue trigger configuration for workflow orchestration.
|
|
15
|
+
* Workflows are queued to the __wkf_workflow_* topic.
|
|
16
|
+
*/
|
|
17
|
+
export declare const WORKFLOW_QUEUE_TRIGGER: {
|
|
18
|
+
type: "queue/v1beta";
|
|
19
|
+
topic: string;
|
|
20
|
+
consumer: string;
|
|
21
|
+
maxDeliveries: number;
|
|
22
|
+
retryAfterSeconds: number;
|
|
23
|
+
initialDelaySeconds: number;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;CAO9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue trigger configuration for workflow step execution.
|
|
3
|
+
* Steps are queued to the __wkf_step_* topic.
|
|
4
|
+
*/
|
|
5
|
+
export const STEP_QUEUE_TRIGGER = {
|
|
6
|
+
type: 'queue/v1beta',
|
|
7
|
+
topic: '__wkf_step_*',
|
|
8
|
+
consumer: 'default',
|
|
9
|
+
maxDeliveries: 64, // Maximum number of delivery attempts (default: 3)
|
|
10
|
+
retryAfterSeconds: 5, // Delay between retries (default: 60)
|
|
11
|
+
initialDelaySeconds: 0, // Initial delay before first delivery (default: 0)
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Queue trigger configuration for workflow orchestration.
|
|
15
|
+
* Workflows are queued to the __wkf_workflow_* topic.
|
|
16
|
+
*/
|
|
17
|
+
export const WORKFLOW_QUEUE_TRIGGER = {
|
|
18
|
+
type: 'queue/v1beta',
|
|
19
|
+
topic: '__wkf_workflow_*',
|
|
20
|
+
consumer: 'default',
|
|
21
|
+
maxDeliveries: 64, // Maximum number of delivery attempts (default: 3)
|
|
22
|
+
retryAfterSeconds: 5, // Delay between retries (default: 60)
|
|
23
|
+
initialDelaySeconds: 0, // Initial delay before first delivery (default: 0)
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,aAAa,EAAE,EAAE,EAAE,mDAAmD;IACtE,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,aAAa,EAAE,EAAE,EAAE,mDAAmD;IACtE,iBAAiB,EAAE,CAAC,EAAE,sCAAsC;IAC5D,mBAAmB,EAAE,CAAC,EAAE,mDAAmD;CAC5E,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plugin } from 'esbuild';
|
|
2
|
+
export declare const jsTsRegex: RegExp;
|
|
3
|
+
export declare const useWorkflowPattern: RegExp;
|
|
4
|
+
export declare const useStepPattern: RegExp;
|
|
5
|
+
export declare const importParents: Map<string, string>;
|
|
6
|
+
export declare function parentHasChild(parent: string, childToFind: string): boolean;
|
|
7
|
+
export declare function createDiscoverEntriesPlugin(state: {
|
|
8
|
+
discoveredSteps: string[];
|
|
9
|
+
discoveredWorkflows: string[];
|
|
10
|
+
}): Plugin;
|
|
11
|
+
//# sourceMappingURL=discover-entries-esbuild-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-entries-esbuild-plugin.d.ts","sourceRoot":"","sources":["../src/discover-entries-esbuild-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAKtC,eAAO,MAAM,SAAS,QAA+B,CAAC;AAGtD,eAAO,MAAM,kBAAkB,QAAoC,CAAC;AACpE,eAAO,MAAM,cAAc,QAAgC,CAAC;AAG5D,eAAO,MAAM,aAAa,qBAA4B,CAAC;AAKvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,WAsBjE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,GAAG,MAAM,CA6DT"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import enhancedResolveOriginal from 'enhanced-resolve';
|
|
4
|
+
import { applySwcTransform } from './apply-swc-transform.js';
|
|
5
|
+
const enhancedResolve = promisify(enhancedResolveOriginal);
|
|
6
|
+
export const jsTsRegex = /\.(ts|tsx|js|jsx|mjs|cjs)$/;
|
|
7
|
+
// Matches: 'use workflow'; "use workflow"; 'use step'; "use step"; at line start with optional whitespace
|
|
8
|
+
export const useWorkflowPattern = /^\s*(['"])use workflow\1;?\s*$/m;
|
|
9
|
+
export const useStepPattern = /^\s*(['"])use step\1;?\s*$/m;
|
|
10
|
+
// parent -> child relationship
|
|
11
|
+
export const importParents = new Map();
|
|
12
|
+
// check if a parent has a child in it's import chain
|
|
13
|
+
// e.g. if a dependency needs to be bundled because it has
|
|
14
|
+
// a 'use workflow/'use step' directive in it
|
|
15
|
+
export function parentHasChild(parent, childToFind) {
|
|
16
|
+
let child;
|
|
17
|
+
let currentParent = parent;
|
|
18
|
+
const visited = new Set();
|
|
19
|
+
do {
|
|
20
|
+
if (currentParent) {
|
|
21
|
+
// Detect circular imports to prevent infinite loop
|
|
22
|
+
if (visited.has(currentParent)) {
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
visited.add(currentParent);
|
|
26
|
+
child = importParents.get(currentParent);
|
|
27
|
+
}
|
|
28
|
+
if (child === childToFind) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
currentParent = child;
|
|
32
|
+
} while (child && currentParent);
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
export function createDiscoverEntriesPlugin(state) {
|
|
36
|
+
return {
|
|
37
|
+
name: 'discover-entries-esbuild-plugin',
|
|
38
|
+
setup(build) {
|
|
39
|
+
build.onResolve({ filter: jsTsRegex }, async (args) => {
|
|
40
|
+
try {
|
|
41
|
+
const resolved = await enhancedResolve(args.resolveDir, args.path);
|
|
42
|
+
if (resolved) {
|
|
43
|
+
importParents.set(args.importer, resolved);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (_) { }
|
|
47
|
+
return null;
|
|
48
|
+
});
|
|
49
|
+
// Handle TypeScript and JavaScript files
|
|
50
|
+
build.onLoad({ filter: jsTsRegex }, async (args) => {
|
|
51
|
+
try {
|
|
52
|
+
// Determine the loader based on the output
|
|
53
|
+
let loader = 'js';
|
|
54
|
+
const isTypeScript = args.path.endsWith('.ts') || args.path.endsWith('.tsx');
|
|
55
|
+
if (!isTypeScript && args.path.endsWith('.jsx')) {
|
|
56
|
+
loader = 'jsx';
|
|
57
|
+
}
|
|
58
|
+
const source = await readFile(args.path, 'utf8');
|
|
59
|
+
const hasUseWorkflow = useWorkflowPattern.test(source);
|
|
60
|
+
const hasUseStep = useStepPattern.test(source);
|
|
61
|
+
// Normalize path separators to forward slashes for cross-platform compatibility
|
|
62
|
+
// This is critical for Windows where paths contain backslashes
|
|
63
|
+
const normalizedPath = args.path.replace(/\\/g, '/');
|
|
64
|
+
if (hasUseWorkflow) {
|
|
65
|
+
state.discoveredWorkflows.push(normalizedPath);
|
|
66
|
+
}
|
|
67
|
+
if (hasUseStep) {
|
|
68
|
+
state.discoveredSteps.push(normalizedPath);
|
|
69
|
+
}
|
|
70
|
+
const { code: transformedCode } = await applySwcTransform(args.path, source, false);
|
|
71
|
+
return {
|
|
72
|
+
contents: transformedCode,
|
|
73
|
+
loader,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch (_) {
|
|
77
|
+
// ignore trace errors during discover phase
|
|
78
|
+
return {
|
|
79
|
+
contents: '',
|
|
80
|
+
loader: 'js',
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=discover-entries-esbuild-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-entries-esbuild-plugin.js","sourceRoot":"","sources":["../src/discover-entries-esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO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AC,KAAK,EAAE,GAAG,CAAC,CAAC;oBAErD,IAAI,cAAc,EAAE,CAAC;wBACnB,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBACjD,CAAC;oBAED,IAAI,UAAU,EAAE,CAAC;wBACf,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC7C,CAAC;oBAED,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,MAAM,iBAAiB,CACvD,IAAI,CAAC,IAAI,EACT,MAAM,EACN,KAAK,CACN,CAAC;oBAEF,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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type { WorkflowManifest } from './apply-swc-transform.js';
|
|
2
|
+
export { applySwcTransform } from './apply-swc-transform.js';
|
|
3
|
+
export { BaseBuilder } from './base-builder.js';
|
|
4
|
+
export { createBaseBuilderConfig } from './config-helpers.js';
|
|
5
|
+
export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
|
|
6
|
+
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
|
|
7
|
+
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
|
|
8
|
+
export { StandaloneBuilder } from './standalone.js';
|
|
9
|
+
export { createSwcPlugin } from './swc-esbuild-plugin.js';
|
|
10
|
+
export type { BuildTarget, NextConfig, StandaloneConfig, SvelteKitConfig, VercelBuildOutputConfig, WorkflowConfig, } from './types.js';
|
|
11
|
+
export { isValidBuildTarget, validBuildTargets, } from './types.js';
|
|
12
|
+
export { VercelBuildOutputAPIBuilder } from './vercel-build-output-api.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EACV,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { applySwcTransform } from './apply-swc-transform.js';
|
|
2
|
+
export { BaseBuilder } from './base-builder.js';
|
|
3
|
+
export { createBaseBuilderConfig } from './config-helpers.js';
|
|
4
|
+
export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
|
|
5
|
+
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
|
|
6
|
+
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
|
|
7
|
+
export { StandaloneBuilder } from './standalone.js';
|
|
8
|
+
export { createSwcPlugin } from './swc-esbuild-plugin.js';
|
|
9
|
+
export { isValidBuildTarget, validBuildTargets, } from './types.js';
|
|
10
|
+
export { VercelBuildOutputAPIBuilder } from './vercel-build-output-api.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAS1D,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-module-esbuild-plugin.d.ts","sourceRoot":"","sources":["../src/node-module-esbuild-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAQxC,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAgB5D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ERROR_SLUGS } from '@workflow/errors';
|
|
2
|
+
import builtinModules from 'builtin-modules';
|
|
3
|
+
// Match exact Node.js built-in module names:
|
|
4
|
+
// - "fs", "path", "stream" etc. (exact match)
|
|
5
|
+
// - "node:fs", "node:path" etc. (with node: prefix)
|
|
6
|
+
// But NOT "some-package/stream" or "eventsource-parser/stream"
|
|
7
|
+
const nodeModulesRegex = new RegExp(`^(${builtinModules.join('|')})$`);
|
|
8
|
+
export function createNodeModuleErrorPlugin() {
|
|
9
|
+
return {
|
|
10
|
+
name: 'workflow-node-module-error',
|
|
11
|
+
setup(build) {
|
|
12
|
+
build.onResolve({ filter: nodeModulesRegex }, (args) => {
|
|
13
|
+
return {
|
|
14
|
+
path: args.path,
|
|
15
|
+
errors: [
|
|
16
|
+
{
|
|
17
|
+
text: `Cannot use Node.js module "${args.path}" in workflow functions. Move this module to a step function.\n\nLearn more: https://useworkflow.dev/err/${ERROR_SLUGS.NODE_JS_MODULE_IN_WORKFLOW}`,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=node-module-esbuild-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-module-esbuild-plugin.js","sourceRoot":"","sources":["../src/node-module-esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAG7C,6CAA6C;AAC7C,8CAA8C;AAC9C,oDAAoD;AACpD,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,KAAK,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAEvE,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;gBACrD,OAAO;oBACL,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,8BAA8B,IAAI,CAAC,IAAI,4GAA4G,WAAW,CAAC,0BAA0B,EAAE;yBAClM;qBACF;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-module-esbuild-plugin.test.d.ts","sourceRoot":"","sources":["../src/node-module-esbuild-plugin.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
|
|
4
|
+
describe('workflow-node-module-error plugin', () => {
|
|
5
|
+
it('should error on fs import', async () => {
|
|
6
|
+
const testCode = `
|
|
7
|
+
import { readFile } from "fs";
|
|
8
|
+
export function workflow() {
|
|
9
|
+
return readFile("test.txt");
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
await expect(esbuild.build({
|
|
13
|
+
stdin: {
|
|
14
|
+
contents: testCode,
|
|
15
|
+
resolveDir: process.cwd(),
|
|
16
|
+
sourcefile: 'test-workflow.ts',
|
|
17
|
+
loader: 'ts',
|
|
18
|
+
},
|
|
19
|
+
bundle: true,
|
|
20
|
+
write: false,
|
|
21
|
+
platform: 'neutral',
|
|
22
|
+
plugins: [createNodeModuleErrorPlugin()],
|
|
23
|
+
logLevel: 'silent',
|
|
24
|
+
})).rejects.toThrow(/Cannot use Node\.js module "fs"/);
|
|
25
|
+
});
|
|
26
|
+
it('should error on path import', async () => {
|
|
27
|
+
const testCode = `
|
|
28
|
+
import { join } from "path";
|
|
29
|
+
export function workflow() {
|
|
30
|
+
return join("a", "b");
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
await expect(esbuild.build({
|
|
34
|
+
stdin: {
|
|
35
|
+
contents: testCode,
|
|
36
|
+
resolveDir: process.cwd(),
|
|
37
|
+
sourcefile: 'test-workflow.ts',
|
|
38
|
+
loader: 'ts',
|
|
39
|
+
},
|
|
40
|
+
format: 'cjs',
|
|
41
|
+
bundle: true,
|
|
42
|
+
write: false,
|
|
43
|
+
platform: 'neutral',
|
|
44
|
+
plugins: [createNodeModuleErrorPlugin()],
|
|
45
|
+
logLevel: 'silent',
|
|
46
|
+
})).rejects.toThrow(/Cannot use Node\.js module "path"/);
|
|
47
|
+
});
|
|
48
|
+
it('should error on node: prefixed imports', async () => {
|
|
49
|
+
const testCode = `
|
|
50
|
+
import { readFile } from "node:fs";
|
|
51
|
+
export function workflow() {
|
|
52
|
+
return readFile;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
await expect(esbuild.build({
|
|
56
|
+
stdin: {
|
|
57
|
+
contents: testCode,
|
|
58
|
+
resolveDir: process.cwd(),
|
|
59
|
+
sourcefile: 'test-workflow.ts',
|
|
60
|
+
loader: 'ts',
|
|
61
|
+
},
|
|
62
|
+
bundle: true,
|
|
63
|
+
write: false,
|
|
64
|
+
platform: 'neutral',
|
|
65
|
+
format: 'cjs',
|
|
66
|
+
plugins: [createNodeModuleErrorPlugin()],
|
|
67
|
+
logLevel: 'silent',
|
|
68
|
+
})).rejects.toThrow(/Cannot use Node\.js module/);
|
|
69
|
+
});
|
|
70
|
+
it('should error on multiple Node.js imports', async () => {
|
|
71
|
+
const testCode = `
|
|
72
|
+
import { readFile } from "fs";
|
|
73
|
+
import { join } from "path";
|
|
74
|
+
export function workflow() {
|
|
75
|
+
return readFile(join("a", "b"));
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
const result = esbuild.build({
|
|
79
|
+
stdin: {
|
|
80
|
+
contents: testCode,
|
|
81
|
+
resolveDir: process.cwd(),
|
|
82
|
+
sourcefile: 'test-workflow.ts',
|
|
83
|
+
loader: 'ts',
|
|
84
|
+
},
|
|
85
|
+
format: 'cjs',
|
|
86
|
+
bundle: true,
|
|
87
|
+
write: false,
|
|
88
|
+
platform: 'neutral',
|
|
89
|
+
plugins: [createNodeModuleErrorPlugin()],
|
|
90
|
+
logLevel: 'silent',
|
|
91
|
+
});
|
|
92
|
+
await expect(result).rejects.toThrow();
|
|
93
|
+
// Verify we get errors for both imports
|
|
94
|
+
try {
|
|
95
|
+
await result;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
expect(error.message).toMatch(/fs/);
|
|
99
|
+
expect(error.message).toMatch(/path/);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
it('should allow non-Node.js npm package imports', async () => {
|
|
103
|
+
const testCode = `
|
|
104
|
+
// This should NOT error - it's not a built-in Node.js module
|
|
105
|
+
import { someFunction } from "some-random-package";
|
|
106
|
+
export function workflow() {
|
|
107
|
+
return "ok";
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
// This will fail because the package doesn't exist, but it shouldn't
|
|
111
|
+
// fail with our plugin's error message
|
|
112
|
+
await expect(esbuild.build({
|
|
113
|
+
stdin: {
|
|
114
|
+
contents: testCode,
|
|
115
|
+
resolveDir: process.cwd(),
|
|
116
|
+
sourcefile: 'test-workflow.ts',
|
|
117
|
+
loader: 'ts',
|
|
118
|
+
},
|
|
119
|
+
bundle: true,
|
|
120
|
+
write: false,
|
|
121
|
+
platform: 'neutral',
|
|
122
|
+
plugins: [createNodeModuleErrorPlugin()],
|
|
123
|
+
logLevel: 'silent',
|
|
124
|
+
external: ['some-random-package'], // Mark as external so it doesn't fail resolution
|
|
125
|
+
})).resolves.toBeDefined();
|
|
126
|
+
});
|
|
127
|
+
it('should allow packages with subpaths that contain built-in module names', async () => {
|
|
128
|
+
// This is the false positive case from the real issue:
|
|
129
|
+
// "eventsource-parser/stream" should NOT be flagged as the built-in "stream" module
|
|
130
|
+
const testCode = `
|
|
131
|
+
import { EventSourceParserStream } from "eventsource-parser/stream";
|
|
132
|
+
export function workflow() {
|
|
133
|
+
return "ok";
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
await expect(esbuild.build({
|
|
137
|
+
stdin: {
|
|
138
|
+
contents: testCode,
|
|
139
|
+
resolveDir: process.cwd(),
|
|
140
|
+
sourcefile: 'test-workflow.ts',
|
|
141
|
+
loader: 'ts',
|
|
142
|
+
},
|
|
143
|
+
bundle: true,
|
|
144
|
+
write: false,
|
|
145
|
+
platform: 'neutral',
|
|
146
|
+
plugins: [createNodeModuleErrorPlugin()],
|
|
147
|
+
logLevel: 'silent',
|
|
148
|
+
external: ['eventsource-parser'], // Mark as external so it doesn't fail resolution
|
|
149
|
+
})).resolves.toBeDefined();
|
|
150
|
+
});
|
|
151
|
+
it('should error on Node.js imports from nested npm packages', async () => {
|
|
152
|
+
// This simulates what happens when a package like @supabase/supabase-js
|
|
153
|
+
// internally imports Node.js built-ins. The key is that the import path
|
|
154
|
+
// needs to look like it's coming from node_modules
|
|
155
|
+
const testCode = `
|
|
156
|
+
// Simulating a fake npm package that uses Node.js built-ins
|
|
157
|
+
import { fakePackage } from "./fake-package";
|
|
158
|
+
export function workflow() {
|
|
159
|
+
return fakePackage();
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
const fakePackageCode = `
|
|
163
|
+
// This simulates @supabase/node-fetch or similar packages
|
|
164
|
+
import { Stream } from "stream";
|
|
165
|
+
export function fakePackage() {
|
|
166
|
+
return new Stream();
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
// Create a virtual plugin to provide the fake package
|
|
170
|
+
const virtualModulePlugin = {
|
|
171
|
+
name: 'virtual-fake-package',
|
|
172
|
+
setup(build) {
|
|
173
|
+
build.onResolve({ filter: /^\.\/fake-package$/ }, () => ({
|
|
174
|
+
path: '/some/path/node_modules/fake-package/index.js', // Make it look like node_modules
|
|
175
|
+
namespace: 'fake-ns',
|
|
176
|
+
}));
|
|
177
|
+
build.onLoad({ filter: /.*/, namespace: 'fake-ns' }, () => ({
|
|
178
|
+
contents: fakePackageCode,
|
|
179
|
+
loader: 'ts',
|
|
180
|
+
}));
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
await expect(esbuild.build({
|
|
184
|
+
stdin: {
|
|
185
|
+
contents: testCode,
|
|
186
|
+
resolveDir: process.cwd(),
|
|
187
|
+
sourcefile: 'test-workflow.ts',
|
|
188
|
+
loader: 'ts',
|
|
189
|
+
},
|
|
190
|
+
bundle: true,
|
|
191
|
+
write: false,
|
|
192
|
+
platform: 'neutral',
|
|
193
|
+
plugins: [virtualModulePlugin, createNodeModuleErrorPlugin()],
|
|
194
|
+
logLevel: 'silent',
|
|
195
|
+
})).rejects.toThrow(/Cannot use Node\.js module "stream"/);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
//# sourceMappingURL=node-module-esbuild-plugin.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-module-esbuild-plugin.test.js","sourceRoot":"","sources":["../src/node-module-esbuild-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,QAAQ,GAAG;;;;;KAKhB,CAAC;QAEF,MAAM,MAAM,CACV,OAAO,CAAC,KAAK,CAAC;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,QAAQ;gBAClB,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE;gBACzB,UAAU,EAAE,kBAAkB;gBAC9B,MAAM,EAAE,IAAI;aACb;YACD,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,KAAK;YACZ,QAAQ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iCAAiC;oBACxF,SAAS,EAAE,SAAS;iBACrB,CAAC,CAAC,CAAC;gBACJ,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;oBAC1D,QAAQ,EAAE,eAAe;oBACzB,MAAM,EAAE,IAAI;iBACb,CAAC,CAAC,CAAC;YACN,CAAC;SACF,CAAC;QAEF,MAAM,MAAM,CACV,OAAO,CAAC,KAAK,CAAC;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,QAAQ;gBAClB,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE;gBACzB,UAAU,EAAE,kBAAkB;gBAC9B,MAAM,EAAE,IAAI;aACb;YACD,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,CAAC;YAC7D,QAAQ,EAAE,QAAQ;SACnB,CAAC,CACH,CAAC,OAAO,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseBuilder } from './base-builder.js';
|
|
2
|
+
export declare class StandaloneBuilder extends BaseBuilder {
|
|
3
|
+
build(): Promise<void>;
|
|
4
|
+
private buildStepsBundle;
|
|
5
|
+
private buildWorkflowsBundle;
|
|
6
|
+
private buildWebhookFunction;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=standalone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,WAAW;IAC1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAgBd,gBAAgB;YAsBhB,oBAAoB;YA2BpB,oBAAoB;CAUnC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BaseBuilder } from './base-builder.js';
|
|
2
|
+
export class StandaloneBuilder extends BaseBuilder {
|
|
3
|
+
async build() {
|
|
4
|
+
const inputFiles = await this.getInputFiles();
|
|
5
|
+
const tsConfig = await this.getTsConfigOptions();
|
|
6
|
+
const options = {
|
|
7
|
+
inputFiles,
|
|
8
|
+
tsBaseUrl: tsConfig.baseUrl,
|
|
9
|
+
tsPaths: tsConfig.paths,
|
|
10
|
+
};
|
|
11
|
+
await this.buildStepsBundle(options);
|
|
12
|
+
await this.buildWorkflowsBundle(options);
|
|
13
|
+
await this.buildWebhookFunction();
|
|
14
|
+
await this.createClientLibrary();
|
|
15
|
+
}
|
|
16
|
+
async buildStepsBundle({ inputFiles, tsPaths, tsBaseUrl, }) {
|
|
17
|
+
console.log('Creating steps bundle at', this.config.stepsBundlePath);
|
|
18
|
+
const stepsBundlePath = this.resolvePath(this.config.stepsBundlePath);
|
|
19
|
+
await this.ensureDirectory(stepsBundlePath);
|
|
20
|
+
await this.createStepsBundle({
|
|
21
|
+
outfile: stepsBundlePath,
|
|
22
|
+
inputFiles,
|
|
23
|
+
tsBaseUrl,
|
|
24
|
+
tsPaths,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async buildWorkflowsBundle({ inputFiles, tsPaths, tsBaseUrl, }) {
|
|
28
|
+
console.log('Creating workflows bundle at', this.config.workflowsBundlePath);
|
|
29
|
+
const workflowBundlePath = this.resolvePath(this.config.workflowsBundlePath);
|
|
30
|
+
await this.ensureDirectory(workflowBundlePath);
|
|
31
|
+
await this.createWorkflowsBundle({
|
|
32
|
+
outfile: workflowBundlePath,
|
|
33
|
+
inputFiles,
|
|
34
|
+
tsBaseUrl,
|
|
35
|
+
tsPaths,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async buildWebhookFunction() {
|
|
39
|
+
console.log('Creating webhook bundle at', this.config.webhookBundlePath);
|
|
40
|
+
const webhookBundlePath = this.resolvePath(this.config.webhookBundlePath);
|
|
41
|
+
await this.ensureDirectory(webhookBundlePath);
|
|
42
|
+
await this.createWebhookBundle({
|
|
43
|
+
outfile: webhookBundlePath,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=standalone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.js","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAChD,KAAK,CAAC,KAAK;QACT,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAEjD,MAAM,OAAO,GAAG;YACd,UAAU;YACV,SAAS,EAAE,QAAQ,CAAC,OAAO;YAC3B,OAAO,EAAE,QAAQ,CAAC,KAAK;SACxB,CAAC;QACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACzC,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAElC,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;IACnC,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,EAC7B,UAAU,EACV,OAAO,EACP,SAAS,GAKV;QACC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAErE,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACtE,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QAE5C,MAAM,IAAI,CAAC,iBAAiB,CAAC;YAC3B,OAAO,EAAE,eAAe;YACxB,UAAU;YACV,SAAS;YACT,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAAC,EACjC,UAAU,EACV,OAAO,EACP,SAAS,GAKV;QACC,OAAO,CAAC,GAAG,CACT,8BAA8B,EAC9B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAChC,CAAC;QAEF,MAAM,kBAAkB,GAAG,IAAI,CAAC,WAAW,CACzC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAChC,CAAC;QACF,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;QAE/C,MAAM,IAAI,CAAC,qBAAqB,CAAC;YAC/B,OAAO,EAAE,kBAAkB;YAC3B,UAAU;YACV,SAAS;YACT,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,oBAAoB;QAChC,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAEzE,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC1E,MAAM,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;QAE9C,MAAM,IAAI,CAAC,mBAAmB,CAAC;YAC7B,OAAO,EAAE,iBAAiB;SAC3B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Plugin } from 'esbuild';
|
|
2
|
+
import { type WorkflowManifest } from './apply-swc-transform.js';
|
|
3
|
+
export interface SwcPluginOptions {
|
|
4
|
+
mode: 'step' | 'workflow' | 'client';
|
|
5
|
+
entriesToBundle?: string[];
|
|
6
|
+
outdir?: string;
|
|
7
|
+
tsPaths?: Record<string, string[]>;
|
|
8
|
+
tsBaseUrl?: string;
|
|
9
|
+
workflowManifest?: WorkflowManifest;
|
|
10
|
+
}
|
|
11
|
+
export declare function createSwcPlugin(options: SwcPluginOptions): Plugin;
|
|
12
|
+
//# sourceMappingURL=swc-esbuild-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swc-esbuild-plugin.d.ts","sourceRoot":"","sources":["../src/swc-esbuild-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAMlC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AA2BD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAuMjE"}
|