@workflow/builders 4.0.1-beta.4 → 4.0.1-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/apply-swc-transform.d.ts +1 -4
  2. package/dist/apply-swc-transform.d.ts.map +1 -1
  3. package/dist/apply-swc-transform.js +44 -9
  4. package/dist/apply-swc-transform.js.map +1 -1
  5. package/dist/base-builder.d.ts +26 -14
  6. package/dist/base-builder.d.ts.map +1 -1
  7. package/dist/base-builder.js +207 -74
  8. package/dist/base-builder.js.map +1 -1
  9. package/dist/build-queue.d.ts +18 -0
  10. package/dist/build-queue.d.ts.map +1 -0
  11. package/dist/build-queue.js +26 -0
  12. package/dist/build-queue.js.map +1 -0
  13. package/dist/config-helpers.d.ts +21 -0
  14. package/dist/config-helpers.d.ts.map +1 -1
  15. package/dist/config-helpers.js +50 -0
  16. package/dist/config-helpers.js.map +1 -1
  17. package/dist/discover-entries-esbuild-plugin.d.ts.map +1 -1
  18. package/dist/discover-entries-esbuild-plugin.js +10 -4
  19. package/dist/discover-entries-esbuild-plugin.js.map +1 -1
  20. package/dist/index.d.ts +5 -3
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +4 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/node-module-esbuild-plugin.d.ts +37 -0
  25. package/dist/node-module-esbuild-plugin.d.ts.map +1 -1
  26. package/dist/node-module-esbuild-plugin.js +289 -9
  27. package/dist/node-module-esbuild-plugin.js.map +1 -1
  28. package/dist/node-module-esbuild-plugin.test.js +359 -88
  29. package/dist/node-module-esbuild-plugin.test.js.map +1 -1
  30. package/dist/request-converter.d.ts +3 -0
  31. package/dist/request-converter.d.ts.map +1 -0
  32. package/dist/request-converter.js +14 -0
  33. package/dist/request-converter.js.map +1 -0
  34. package/dist/standalone.d.ts +2 -0
  35. package/dist/standalone.d.ts.map +1 -1
  36. package/dist/standalone.js +23 -11
  37. package/dist/standalone.js.map +1 -1
  38. package/dist/swc-esbuild-plugin.d.ts +0 -2
  39. package/dist/swc-esbuild-plugin.d.ts.map +1 -1
  40. package/dist/swc-esbuild-plugin.js +67 -16
  41. package/dist/swc-esbuild-plugin.js.map +1 -1
  42. package/dist/types.d.ts +12 -2
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/types.js +1 -0
  45. package/dist/types.js.map +1 -1
  46. package/dist/vercel-build-output-api.d.ts.map +1 -1
  47. package/dist/vercel-build-output-api.js +16 -11
  48. package/dist/vercel-build-output-api.js.map +1 -1
  49. package/dist/workflows-extractor.d.ts +92 -0
  50. package/dist/workflows-extractor.d.ts.map +1 -0
  51. package/dist/workflows-extractor.js +1476 -0
  52. package/dist/workflows-extractor.js.map +1 -0
  53. package/package.json +9 -9
@@ -1,3 +1,53 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { findUp } from 'find-up';
3
+ import JSON5 from 'json5';
4
+ /**
5
+ * Reads tsconfig.json and extracts decorator-related compiler options.
6
+ * Returns decorator options based on experimentalDecorators and emitDecoratorMetadata settings.
7
+ *
8
+ * @param tsconfigPath - Path to tsconfig.json or jsconfig.json
9
+ * @returns DecoratorOptions with settings based on tsconfig compilerOptions
10
+ */
11
+ export async function getDecoratorOptionsFromTsConfig(tsconfigPath) {
12
+ const defaultOptions = {
13
+ decorators: false,
14
+ legacyDecorator: false,
15
+ decoratorMetadata: false,
16
+ };
17
+ if (!tsconfigPath) {
18
+ return defaultOptions;
19
+ }
20
+ try {
21
+ const content = await readFile(tsconfigPath, 'utf-8');
22
+ const tsconfig = JSON5.parse(content);
23
+ const compilerOptions = tsconfig.compilerOptions || {};
24
+ // Match Next.js behavior: enable decorators only when experimentalDecorators is true
25
+ const experimentalDecorators = compilerOptions.experimentalDecorators === true;
26
+ const emitDecoratorMetadata = compilerOptions.emitDecoratorMetadata === true;
27
+ return {
28
+ decorators: experimentalDecorators,
29
+ legacyDecorator: experimentalDecorators,
30
+ decoratorMetadata: experimentalDecorators && emitDecoratorMetadata,
31
+ };
32
+ }
33
+ catch {
34
+ // If we can't read or parse the tsconfig, return defaults
35
+ return defaultOptions;
36
+ }
37
+ }
38
+ /**
39
+ * Finds tsconfig.json in the given directory (or ancestors) and extracts decorator options.
40
+ * Combines tsconfig discovery with decorator option extraction for convenience.
41
+ *
42
+ * @param cwd - Directory to start searching for tsconfig.json
43
+ * @returns DecoratorOptions with settings based on tsconfig compilerOptions
44
+ */
45
+ export async function getDecoratorOptionsForDirectory(cwd) {
46
+ const tsconfigPath = await findUp(['tsconfig.json', 'jsconfig.json'], {
47
+ cwd,
48
+ });
49
+ return getDecoratorOptionsFromTsConfig(tsconfigPath);
50
+ }
1
51
  /**
2
52
  * Creates a partial configuration for builders that don't use bundle paths directly.
3
53
  * Used by framework integrations like Nitro where the builder computes paths internally.
@@ -1 +1 @@
1
- {"version":3,"file":"config-helpers.js","sourceRoot":"","sources":["../src/config-helpers.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAKvC;IACC,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC;QACnC,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;KAC3C,CAAC;AACJ,CAAC"}
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;AAS1B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+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mCAAmC;QACxD,mBAAmB,EAAE,EAAE,EAAE,mCAAmC;QAC5D,iBAAiB,EAAE,EAAE,EAAE,mCAAmC;QAC1D,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC;AACJ,CAAC"}
@@ -1 +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,CAyDT"}
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,QAAuC,CAAC;AAG9D,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,CAgET"}
@@ -3,7 +3,7 @@ import { promisify } from 'node:util';
3
3
  import enhancedResolveOriginal from 'enhanced-resolve';
4
4
  import { applySwcTransform } from './apply-swc-transform.js';
5
5
  const enhancedResolve = promisify(enhancedResolveOriginal);
6
- export const jsTsRegex = /\.(ts|tsx|js|jsx|mjs|cjs)$/;
6
+ export const jsTsRegex = /\.(ts|tsx|js|jsx|mjs|cjs|mts|cts)$/;
7
7
  // Matches: 'use workflow'; "use workflow"; 'use step'; "use step"; at line start with optional whitespace
8
8
  export const useWorkflowPattern = /^\s*(['"])use workflow\1;?\s*$/m;
9
9
  export const useStepPattern = /^\s*(['"])use step\1;?\s*$/m;
@@ -51,18 +51,24 @@ export function createDiscoverEntriesPlugin(state) {
51
51
  try {
52
52
  // Determine the loader based on the output
53
53
  let loader = 'js';
54
- const isTypeScript = args.path.endsWith('.ts') || args.path.endsWith('.tsx');
54
+ const isTypeScript = args.path.endsWith('.ts') ||
55
+ args.path.endsWith('.tsx') ||
56
+ args.path.endsWith('.mts') ||
57
+ args.path.endsWith('.cts');
55
58
  if (!isTypeScript && args.path.endsWith('.jsx')) {
56
59
  loader = 'jsx';
57
60
  }
58
61
  const source = await readFile(args.path, 'utf8');
59
62
  const hasUseWorkflow = useWorkflowPattern.test(source);
60
63
  const hasUseStep = useStepPattern.test(source);
64
+ // Normalize path separators to forward slashes for cross-platform compatibility
65
+ // This is critical for Windows where paths contain backslashes
66
+ const normalizedPath = args.path.replace(/\\/g, '/');
61
67
  if (hasUseWorkflow) {
62
- state.discoveredWorkflows.push(args.path);
68
+ state.discoveredWorkflows.push(normalizedPath);
63
69
  }
64
70
  if (hasUseStep) {
65
- state.discoveredSteps.push(args.path);
71
+ state.discoveredSteps.push(normalizedPath);
66
72
  }
67
73
  const { code: transformedCode } = await applySwcTransform(args.path, source, false);
68
74
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"discover-entries-esbuild-plugin.js","sourceRoot":"","sources":["../src/discover-entries-esbuild-plugin.ts"],"names":[],"mappings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,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 CHANGED
@@ -1,13 +1,15 @@
1
1
  export type { WorkflowManifest } from './apply-swc-transform.js';
2
2
  export { applySwcTransform } from './apply-swc-transform.js';
3
3
  export { BaseBuilder } from './base-builder.js';
4
- export { createBaseBuilderConfig } from './config-helpers.js';
4
+ export { createBuildQueue } from './build-queue.js';
5
+ export { createBaseBuilderConfig, getDecoratorOptionsForDirectory, type DecoratorOptions, } from './config-helpers.js';
5
6
  export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
6
7
  export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
7
8
  export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
9
+ export { NORMALIZE_REQUEST_CODE } from './request-converter.js';
8
10
  export { StandaloneBuilder } from './standalone.js';
9
11
  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 type { AstroConfig, BuildTarget, NextConfig, StandaloneConfig, SvelteKitConfig, VercelBuildOutputConfig, WorkflowConfig, } from './types.js';
13
+ export { isValidBuildTarget, validBuildTargets } from './types.js';
12
14
  export { VercelBuildOutputAPIBuilder } from './vercel-build-output-api.js';
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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;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EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  export { applySwcTransform } from './apply-swc-transform.js';
2
2
  export { BaseBuilder } from './base-builder.js';
3
- export { createBaseBuilderConfig } from './config-helpers.js';
3
+ export { createBuildQueue } from './build-queue.js';
4
+ export { createBaseBuilderConfig, getDecoratorOptionsForDirectory, } from './config-helpers.js';
4
5
  export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
5
6
  export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
6
7
  export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
8
+ export { NORMALIZE_REQUEST_CODE } from './request-converter.js';
7
9
  export { StandaloneBuilder } from './standalone.js';
8
10
  export { createSwcPlugin } from './swc-esbuild-plugin.js';
9
- export { isValidBuildTarget, validBuildTargets, } from './types.js';
11
+ export { isValidBuildTarget, validBuildTargets } from './types.js';
10
12
  export { VercelBuildOutputAPIBuilder } from './vercel-build-output-api.js';
11
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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"}
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,EACvB,+BAA+B,GAEhC,MAAM,qBAAqB,CAAC;AAC7B,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,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAU1D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,3 +1,40 @@
1
1
  import type * as esbuild from 'esbuild';
2
+ /**
3
+ * Get the package name from a file path.
4
+ * @param filePath - The file path to get the package name from.
5
+ * @returns The package name.
6
+ */
7
+ export declare function getPackageName(filePath: string): string | null;
8
+ /**
9
+ * Escape a regular expression string.
10
+ * @param value - The string to escape.
11
+ * @returns The escaped string.
12
+ */
13
+ export declare function escapeRegExp(value: string): string;
14
+ /**
15
+ * Get the imported identifier from a specifier.
16
+ * @param specifier - The specifier to get the imported identifier from.
17
+ * @returns The imported identifier.
18
+ */
19
+ export declare function getImportedIdentifier(specifier: string): string | undefined;
20
+ /**
21
+ * Get the location of a violation.
22
+ * @param cwd - The current working directory.
23
+ * @param relativePath - The relative path to the file.
24
+ * @param packageName - The name of the package.
25
+ * @returns The location of the violation.
26
+ */
27
+ export declare function getViolationLocation(cwd: string, relativePath: string, packageName: string): Promise<{
28
+ file: string;
29
+ line: number;
30
+ column: number;
31
+ lineText: string;
32
+ length: number;
33
+ } | undefined>;
34
+ /**
35
+ * Create an esbuild plugin to detect violations of the Node.js module usage rule.
36
+ * This plugin prevents workflow functions from importing Node.js or Bun built-in
37
+ * modules, which are not available in the sandboxed workflow runtime.
38
+ */
2
39
  export declare function createNodeModuleErrorPlugin(): esbuild.Plugin;
3
40
  //# sourceMappingURL=node-module-esbuild-plugin.d.ts.map
@@ -1 +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;AAIxC,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAmB5D"}
1
+ {"version":3,"file":"node-module-esbuild-plugin.d.ts","sourceRoot":"","sources":["../src/node-module-esbuild-plugin.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AA2BxC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,iBAoB9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,UAEzC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,sBAkCtD;AA0CD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM;;;;;;eAkDpB;AAcD;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAAC,MAAM,CA8I5D"}
@@ -1,23 +1,303 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { normalize, relative, resolve } from 'node:path';
3
+ import { promisify } from 'node:util';
1
4
  import { ERROR_SLUGS } from '@workflow/errors';
2
5
  import builtinModules from 'builtin-modules';
3
- const nodeModulesRegex = new RegExp(`^(${builtinModules.join('|')})`);
6
+ import enhancedResolveOriginal from 'enhanced-resolve';
7
+ const enhancedResolve = promisify(enhancedResolveOriginal);
8
+ // Match exact Node.js built-in module names:
9
+ // - "fs", "path", "stream" etc. (exact match)
10
+ // - "node:fs", "node:path" etc. (with node: prefix)
11
+ // But NOT "some-package/stream" or "eventsource-parser/stream"
12
+ const nodeModulesPattern = `(${builtinModules.join('|')})`;
13
+ // Match Bun modules:
14
+ // - "bun" (exact match)
15
+ // - "bun:sqlite", "bun:ffi" etc. (with bun: prefix)
16
+ const bunModulesRegex = /^bun(:|$)/;
17
+ // Combined regex for both Node.js and Bun modules
18
+ const runtimeModulesRegex = new RegExp(`^((node:)?${nodeModulesPattern}|bun(:.*)?)$`);
19
+ /**
20
+ * Get the package name from a file path.
21
+ * @param filePath - The file path to get the package name from.
22
+ * @returns The package name.
23
+ */
24
+ export function getPackageName(filePath) {
25
+ const normalized = filePath.replace(/\\/g, '/');
26
+ const marker = '/node_modules/';
27
+ const idx = normalized.lastIndexOf(marker);
28
+ if (idx === -1)
29
+ return null;
30
+ const after = normalized.slice(idx + marker.length); // e.g. ".pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js"
31
+ const segments = after.split('/');
32
+ if (!segments.length)
33
+ return null;
34
+ let packageName = segments[0];
35
+ // pnpm nests: ".pnpm/<pkg>@<version>/node_modules/<pkg>/..."
36
+ if (packageName === '.pnpm' && segments.length >= 3) {
37
+ packageName = segments[2];
38
+ }
39
+ else if (packageName.startsWith('@') && segments.length >= 2) {
40
+ packageName = `${segments[0]}/${segments[1]}`;
41
+ }
42
+ return packageName;
43
+ }
44
+ /**
45
+ * Escape a regular expression string.
46
+ * @param value - The string to escape.
47
+ * @returns The escaped string.
48
+ */
49
+ export function escapeRegExp(value) {
50
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
51
+ }
52
+ /**
53
+ * Get the imported identifier from a specifier.
54
+ * @param specifier - The specifier to get the imported identifier from.
55
+ * @returns The imported identifier.
56
+ */
57
+ export function getImportedIdentifier(specifier) {
58
+ const namespaceMatch = specifier.match(/\*\s+as\s+([A-Za-z0-9_$]+)/);
59
+ if (namespaceMatch) {
60
+ return namespaceMatch[1];
61
+ }
62
+ if (specifier.includes('{')) {
63
+ const inside = specifier.replace(/^[^{]*\{/, '').replace(/\}.*$/, '');
64
+ const firstNamed = inside
65
+ .split(',')
66
+ .map((token) => token.trim())
67
+ .find(Boolean);
68
+ if (firstNamed) {
69
+ const aliasMatch = firstNamed.match(/([A-Za-z0-9_$]+)\s+as\s+([A-Za-z0-9_$]+)/);
70
+ if (aliasMatch) {
71
+ return aliasMatch[2];
72
+ }
73
+ // Validate that firstNamed is a valid identifier (not empty braces or whitespace)
74
+ const identifierMatch = firstNamed.match(/^[A-Za-z_$][A-Za-z0-9_$]*/);
75
+ if (identifierMatch) {
76
+ return identifierMatch[0];
77
+ }
78
+ }
79
+ // Empty braces or no valid identifier found - return undefined
80
+ return undefined;
81
+ }
82
+ const defaultPart = specifier.split(',')[0]?.trim();
83
+ if (defaultPart && defaultPart !== '*') {
84
+ return defaultPart;
85
+ }
86
+ }
87
+ /**
88
+ * Find the usage of an identifier in a list of lines.
89
+ * @param lines - The list of lines to search in.
90
+ * @param startIndex - The index to start searching from.
91
+ * @param identifier - The identifier to search for.
92
+ * @returns The usage of the identifier.
93
+ */
94
+ function findIdentifierUsage(lines, startIndex, identifier) {
95
+ const usageRegex = new RegExp(`\\b${escapeRegExp(identifier)}\\b`);
96
+ for (let i = startIndex; i < lines.length; i += 1) {
97
+ const line = lines[i];
98
+ // Skip comments (both // and /* */ style)
99
+ const withoutComments = line
100
+ .replace(/\/\*[\s\S]*?\*\//g, '')
101
+ .replace(/\/\/.*$/, '');
102
+ // Remove (replace with spaces) string literals to avoid matching inside paths
103
+ // Use escaped quote handling to properly match strings with escaped quotes
104
+ const withoutStrings = withoutComments
105
+ .replace(/'(?:[^'\\]|\\.)*'/g, (segment) => ' '.repeat(segment.length))
106
+ .replace(/"(?:[^"\\]|\\.)*"/g, (segment) => ' '.repeat(segment.length))
107
+ .replace(/`(?:[^`\\]|\\.)*`/g, (segment) => ' '.repeat(segment.length));
108
+ const match = withoutStrings.match(usageRegex);
109
+ if (match && match.index !== undefined) {
110
+ return {
111
+ line: i,
112
+ column: match.index,
113
+ lineText: line,
114
+ };
115
+ }
116
+ }
117
+ }
118
+ /**
119
+ * Get the location of a violation.
120
+ * @param cwd - The current working directory.
121
+ * @param relativePath - The relative path to the file.
122
+ * @param packageName - The name of the package.
123
+ * @returns The location of the violation.
124
+ */
125
+ export async function getViolationLocation(cwd, relativePath, packageName) {
126
+ try {
127
+ const absolutePath = resolve(cwd, relativePath);
128
+ const contents = await readFile(absolutePath, 'utf8');
129
+ const lines = contents.split(/\r?\n/);
130
+ const importRegex = new RegExp(`import\\s+(.+?)\\s+from\\s+['"]${escapeRegExp(packageName)}(?:/[^'"]*)?['"]`);
131
+ for (let i = 0; i < lines.length; i += 1) {
132
+ const line = lines[i];
133
+ const importMatch = line.match(importRegex);
134
+ if (importMatch && importMatch.index !== undefined) {
135
+ const specifier = importMatch[1].trim();
136
+ const identifier = getImportedIdentifier(specifier);
137
+ if (identifier) {
138
+ const usage = findIdentifierUsage(lines, i + 1, identifier);
139
+ if (usage) {
140
+ return {
141
+ file: relativePath,
142
+ line: usage.line + 1,
143
+ column: usage.column,
144
+ lineText: usage.lineText,
145
+ length: identifier.length,
146
+ };
147
+ }
148
+ // Identifier exists but is never referenced; surface no location
149
+ return undefined;
150
+ }
151
+ // Fallback: if we can't extract identifier, point to package name
152
+ const columnIndex = line.indexOf(packageName);
153
+ if (columnIndex !== -1) {
154
+ return {
155
+ file: relativePath,
156
+ line: i + 1,
157
+ column: columnIndex,
158
+ lineText: line,
159
+ length: packageName.length,
160
+ };
161
+ }
162
+ }
163
+ }
164
+ }
165
+ catch {
166
+ // ignore file read failures, fallback to no location info
167
+ }
168
+ }
169
+ /**
170
+ * Get the module type label for error messages.
171
+ * @param modulePath - The module path to check.
172
+ * @returns The module type label.
173
+ */
174
+ function getModuleTypeLabel(modulePath) {
175
+ if (bunModulesRegex.test(modulePath)) {
176
+ return 'Bun';
177
+ }
178
+ return 'Node.js';
179
+ }
180
+ /**
181
+ * Create an esbuild plugin to detect violations of the Node.js module usage rule.
182
+ * This plugin prevents workflow functions from importing Node.js or Bun built-in
183
+ * modules, which are not available in the sandboxed workflow runtime.
184
+ */
4
185
  export function createNodeModuleErrorPlugin() {
5
186
  return {
6
187
  name: 'workflow-node-module-error',
7
188
  setup(build) {
8
- build.onResolve({ filter: nodeModulesRegex }, (args) => {
9
- // Ignore if the import is coming from a node_modules folder
10
- if (args.importer.includes('node_modules'))
189
+ const cwd = process.cwd();
190
+ const importParents = new Map();
191
+ const packageViolations = [];
192
+ const seenViolations = new Set();
193
+ // Track ALL import relationships to build the dependency graph.
194
+ // This is necessary to trace transitive dependencies back to user code.
195
+ // Performance impact is minimal as we only store path mappings.
196
+ build.onResolve({ filter: /.*/ }, async (args) => {
197
+ if (!args.importer)
11
198
  return null;
199
+ try {
200
+ const resolvedChild = await enhancedResolve(args.resolveDir, args.path);
201
+ if (resolvedChild) {
202
+ const childKey = normalize(resolvedChild);
203
+ const parentValue = normalize(args.importer);
204
+ importParents.set(childKey, parentValue);
205
+ }
206
+ }
207
+ catch {
208
+ // For built-in modules that can't be resolved, still track using the import path
209
+ const childKey = args.path;
210
+ const parentValue = normalize(args.importer);
211
+ importParents.set(childKey, parentValue);
212
+ }
213
+ return null;
214
+ });
215
+ // Detect Node.js and Bun module imports
216
+ build.onResolve({ filter: runtimeModulesRegex }, async (args) => {
217
+ const importerPath = resolve(cwd, args.importer);
218
+ let current = importerPath;
219
+ const chain = [];
220
+ const visited = new Set();
221
+ while (current) {
222
+ if (visited.has(current)) {
223
+ break;
224
+ }
225
+ visited.add(current);
226
+ chain.push(current);
227
+ let next = importParents.get(current);
228
+ // If we can't find the parent and current is in node_modules,
229
+ // try looking up by potential package import strings
230
+ if (!next && current.includes('node_modules')) {
231
+ const packageName = getPackageName(current);
232
+ if (packageName) {
233
+ // Try the package name directly
234
+ next = importParents.get(packageName);
235
+ if (!next) {
236
+ // Try with node: prefix
237
+ next = importParents.get(`node:${packageName}`);
238
+ }
239
+ }
240
+ }
241
+ current = next ?? '';
242
+ }
243
+ const filteredChain = chain.filter((path) => !path.includes('node_modules'));
244
+ const workflowFile = filteredChain[0] ?? importerPath;
245
+ if (!workflowFile || workflowFile.includes('node_modules')) {
246
+ return {
247
+ path: args.path,
248
+ external: true,
249
+ };
250
+ }
251
+ const packageName = importerPath.includes('node_modules')
252
+ ? (getPackageName(importerPath) ?? args.path)
253
+ : args.path;
254
+ const relativeWorkflowFile = relative(cwd, workflowFile);
255
+ const violationKey = `${packageName}:${relativeWorkflowFile}`;
256
+ if (!seenViolations.has(violationKey)) {
257
+ seenViolations.add(violationKey);
258
+ const location = await getViolationLocation(cwd, relativeWorkflowFile, packageName);
259
+ // Only report violations where we can find the import location.
260
+ // If we can't find it, the package is likely a transitive dependency
261
+ // that the user didn't directly import - we'll report the top-level
262
+ // package they did import instead.
263
+ if (location) {
264
+ packageViolations.push({
265
+ path: args.path,
266
+ importer: relativeWorkflowFile,
267
+ packageName,
268
+ location,
269
+ });
270
+ }
271
+ }
12
272
  return {
13
273
  path: args.path,
14
- errors: [
15
- {
16
- 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}`,
17
- },
18
- ],
274
+ external: true,
19
275
  };
20
276
  });
277
+ // Report all violations at the end of the build
278
+ build.onEnd(() => {
279
+ if (packageViolations.length > 0) {
280
+ return {
281
+ errors: packageViolations.map((violation) => {
282
+ const isBuiltinModule = runtimeModulesRegex.test(violation.packageName);
283
+ const moduleType = getModuleTypeLabel(violation.path);
284
+ // Different messages for built-in modules vs npm packages that use them
285
+ const text = isBuiltinModule
286
+ ? `You are attempting to use "${violation.packageName}" which is a ${moduleType} module. ${moduleType} modules are not available in workflow functions.\n\nLearn more: https://useworkflow.dev/err/${ERROR_SLUGS.NODE_JS_MODULE_IN_WORKFLOW}`
287
+ : `You are attempting to use "${violation.packageName}" which depends on ${moduleType} modules. Packages that depend on ${moduleType} modules are not available in workflow functions.\n\nLearn more: https://useworkflow.dev/err/${ERROR_SLUGS.NODE_JS_MODULE_IN_WORKFLOW}`;
288
+ return {
289
+ text,
290
+ location: violation.location
291
+ ? {
292
+ ...violation.location,
293
+ suggestion: 'Move this function into a step function.',
294
+ }
295
+ : undefined,
296
+ };
297
+ }),
298
+ };
299
+ }
300
+ });
21
301
  },
22
302
  };
23
303
  }
@@ -1 +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,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,KAAK,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEtE,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,KAAK,CAAC,KAAK;Y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