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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/base-builder.d.ts +69 -2
  2. package/dist/base-builder.d.ts.map +1 -1
  3. package/dist/base-builder.js +368 -19
  4. package/dist/base-builder.js.map +1 -1
  5. package/dist/config-helpers.d.ts +2 -1
  6. package/dist/config-helpers.d.ts.map +1 -1
  7. package/dist/config-helpers.js +1 -0
  8. package/dist/config-helpers.js.map +1 -1
  9. package/dist/constants.d.ts +3 -13
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/constants.js +3 -13
  12. package/dist/constants.js.map +1 -1
  13. package/dist/discover-entries-esbuild-plugin.d.ts.map +1 -1
  14. package/dist/discover-entries-esbuild-plugin.js +16 -1
  15. package/dist/discover-entries-esbuild-plugin.js.map +1 -1
  16. package/dist/external-package-warning.test.d.ts +2 -0
  17. package/dist/external-package-warning.test.d.ts.map +1 -0
  18. package/dist/external-package-warning.test.js +219 -0
  19. package/dist/external-package-warning.test.js.map +1 -0
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/module-specifier.d.ts.map +1 -1
  25. package/dist/module-specifier.js +47 -9
  26. package/dist/module-specifier.js.map +1 -1
  27. package/dist/module-specifier.test.js +20 -0
  28. package/dist/module-specifier.test.js.map +1 -1
  29. package/dist/node-module-esbuild-plugin.d.ts.map +1 -1
  30. package/dist/node-module-esbuild-plugin.js +72 -22
  31. package/dist/node-module-esbuild-plugin.js.map +1 -1
  32. package/dist/node-module-esbuild-plugin.test.js +96 -0
  33. package/dist/node-module-esbuild-plugin.test.js.map +1 -1
  34. package/dist/resolve-sourcemap.test.d.ts +2 -0
  35. package/dist/resolve-sourcemap.test.d.ts.map +1 -0
  36. package/dist/resolve-sourcemap.test.js +126 -0
  37. package/dist/resolve-sourcemap.test.js.map +1 -0
  38. package/dist/standalone.d.ts +0 -3
  39. package/dist/standalone.d.ts.map +1 -1
  40. package/dist/standalone.js +10 -39
  41. package/dist/standalone.js.map +1 -1
  42. package/dist/swc-esbuild-plugin.d.ts +9 -0
  43. package/dist/swc-esbuild-plugin.d.ts.map +1 -1
  44. package/dist/swc-esbuild-plugin.js +63 -8
  45. package/dist/swc-esbuild-plugin.js.map +1 -1
  46. package/dist/swc-esbuild-plugin.test.js +279 -3
  47. package/dist/swc-esbuild-plugin.test.js.map +1 -1
  48. package/dist/types.d.ts +29 -0
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/types.js.map +1 -1
  51. package/dist/vercel-build-output-api.d.ts +0 -2
  52. package/dist/vercel-build-output-api.d.ts.map +1 -1
  53. package/dist/vercel-build-output-api.js +24 -55
  54. package/dist/vercel-build-output-api.js.map +1 -1
  55. package/package.json +5 -5
@@ -305,6 +305,102 @@ describe('workflow-node-module-error plugin', () => {
305
305
  rmSync(tempDir, { recursive: true, force: true });
306
306
  }
307
307
  });
308
+ it('should not error when a shared module exposes a workflow-safe export alongside an unused Node.js-using export', async () => {
309
+ // Repro for https://github.com/vercel/workflow/issues/1817
310
+ //
311
+ // When a shared module has both a workflow-safe export and a Node.js-using
312
+ // export, and the workflow bundle only uses the workflow-safe one, esbuild
313
+ // should be able to tree-shake the Node.js-using export (and its imports)
314
+ // and the plugin should not emit a false-positive violation.
315
+ const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));
316
+ const sharedFile = join(tempDir, 'shared.ts');
317
+ const entryFile = join(tempDir, 'workflow.ts');
318
+ writeFileSync(sharedFile, `
319
+ import { readFile } from "node:fs/promises";
320
+ import path from "node:path";
321
+
322
+ export const isSupportedValue = (value) => value === "ok";
323
+
324
+ export async function readFixtureFile() {
325
+ return readFile(path.join(process.cwd(), "fixture.txt"), "utf8");
326
+ }
327
+ `);
328
+ writeFileSync(entryFile, `
329
+ import { isSupportedValue } from "./shared.js";
330
+ export function workflow() {
331
+ return isSupportedValue("ok");
332
+ }
333
+ `);
334
+ try {
335
+ const result = await esbuild.build({
336
+ entryPoints: [entryFile],
337
+ bundle: true,
338
+ write: false,
339
+ platform: 'neutral',
340
+ logLevel: 'silent',
341
+ plugins: [createNodeModuleErrorPlugin()],
342
+ });
343
+ expect(result.errors).toHaveLength(0);
344
+ }
345
+ finally {
346
+ rmSync(tempDir, { recursive: true, force: true });
347
+ }
348
+ });
349
+ it("should still error when a shared module's Node.js-using export is actually referenced", async () => {
350
+ // Counterpart to the previous test: when the workflow really does pull in
351
+ // the Node.js-using export (directly or transitively), the plugin must
352
+ // still emit the violation.
353
+ const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));
354
+ const sharedFile = join(tempDir, 'shared.ts');
355
+ const entryFile = join(tempDir, 'workflow.ts');
356
+ const relativeShared = relative(process.cwd(), sharedFile);
357
+ writeFileSync(sharedFile, `
358
+ import { readFile } from "node:fs/promises";
359
+ import path from "node:path";
360
+
361
+ export const isSupportedValue = (value) => value === "ok";
362
+
363
+ export async function readFixtureFile() {
364
+ return readFile(path.join(process.cwd(), "fixture.txt"), "utf8");
365
+ }
366
+ `);
367
+ writeFileSync(entryFile, `
368
+ import { isSupportedValue, readFixtureFile } from "./shared.js";
369
+ export async function workflow() {
370
+ if (!isSupportedValue("ok")) throw new Error("nope");
371
+ return readFixtureFile();
372
+ }
373
+ `);
374
+ try {
375
+ await esbuild.build({
376
+ entryPoints: [entryFile],
377
+ bundle: true,
378
+ write: false,
379
+ platform: 'neutral',
380
+ logLevel: 'silent',
381
+ plugins: [createNodeModuleErrorPlugin()],
382
+ });
383
+ throw new Error('Expected build to fail');
384
+ }
385
+ catch (error) {
386
+ if (error && typeof error === 'object' && 'errors' in error) {
387
+ const failure = error;
388
+ const paths = failure.errors.map((e) => e.text);
389
+ expect(paths.some((t) => t.includes('"node:fs/promises"'))).toBe(true);
390
+ expect(paths.some((t) => t.includes('"node:path"'))).toBe(true);
391
+ // Violations should be attributed to the shared module, not the entry.
392
+ for (const err of failure.errors) {
393
+ expect(err.location?.file).toBe(relativeShared);
394
+ }
395
+ }
396
+ else {
397
+ throw error;
398
+ }
399
+ }
400
+ finally {
401
+ rmSync(tempDir, { recursive: true, force: true });
402
+ }
403
+ });
308
404
  it('should not point to JSDoc comments when finding usage', async () => {
309
405
  const testCode = `
310
406
  import { Writable } from "stream";
@@ -1 +1 @@
1
- {"version":3,"file":"node-module-esbuild-plugin.test.js","sourceRoot":"","sources":["../src/node-module-esbuild-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpD,wEAAwE;AACxE,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;AAE1C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,2BAA2B,EAC3B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAEzC,KAAK,UAAU,0BAA0B,CACvC,MAAc,EACd,YAA2C,EAAE;IAE7C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,0BAA0B,CAAC,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC/C,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;IAEzD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,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;YAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CACzC,GAAG,EACH,sBAAsB,EACtB,cAAc,CACf,CAAC;YAEF,MAAM,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8DAA8D,EAAE,KAAK,IAAI,EAAE;YAC5E,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,wCAAwC,CAAC;YAE1D,gDAAgD;YAChD,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CACzC,GAAG,EACH,QAAQ,EACR,sBAAsB,CACvB,CAAC;YAEF,MAAM,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wEAAwE,EAAE,KAAK,IAAI,EAAE;YACtF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,wCAAwC,CAAC;YAE1D,sEAAsE;YACtE,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;YAExE,sEAAsE;YACtE,kCAAkC;YAClC,MAAM,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n mkdtempSync,\n readFileSync,\n realpathSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\n// @ts-expect-error - Intentionally unused import for testing getViolationLocation\n// with an import that exists but is never referenced in code\nimport http from 'node:http';\nimport { tmpdir } from 'node:os';\nimport { join, relative, resolve } from 'node:path';\n\n// Resolve symlinks in tmpdir to avoid macOS /var -> /private/var issues\nconst realTmpdir = realpathSync(tmpdir());\n\nimport * as esbuild from 'esbuild';\nimport { describe, expect, it } from 'vitest';\nimport {\n createNodeModuleErrorPlugin,\n escapeRegExp,\n getImportedIdentifier,\n getPackageName,\n getViolationLocation,\n} from './node-module-esbuild-plugin.js';\n\nasync function buildWorkflowWithViolation(\n source: string,\n overrides: Partial<esbuild.BuildOptions> = {}\n) {\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, source);\n const relativeEntry = relative(process.cwd(), entryFile);\n\n try {\n await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin(), ...(overrides.plugins ?? [])],\n ...overrides,\n });\n throw new Error('Expected build to fail');\n } catch (error: any) {\n if (error && typeof error === 'object' && 'errors' in error) {\n return {\n failure: error as esbuild.BuildFailure,\n relativeEntry,\n };\n }\n throw error;\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n}\n\ndescribe('workflow-node-module-error plugin', () => {\n it('should error on fs import', async () => {\n const testCode = `\n import { readFile } from \"fs\";\n export function workflow() {\n return readFile(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain(\n 'You are attempting to use \"fs\" which is a Node.js module'\n );\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(violation.location?.line).toBeGreaterThan(0);\n expect(violation.location?.column).toBeGreaterThanOrEqual(0);\n expect(violation.location?.lineText).toContain('readFile');\n });\n\n it('should error on node: prefixed imports', async () => {\n const testCode = `\n import { readFile } from \"node:fs\";\n export function workflow() {\n return readFile;\n }\n `;\n\n const { failure, relativeEntry } = await buildWorkflowWithViolation(\n testCode,\n { format: 'cjs' }\n );\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain(\n 'You are attempting to use \"node:fs\" which is a Node.js module'\n );\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(violation.location?.lineText).toContain('readFile');\n });\n\n it('should error on multiple Node.js imports', async () => {\n const testCode = `\n import { readFile } from \"fs\";\n import { join } from \"path\";\n export function workflow() {\n return readFile(join(\"a\", \"b\"));\n }\n `;\n\n const { failure, relativeEntry } = await buildWorkflowWithViolation(\n testCode,\n { format: 'cjs' }\n );\n\n expect(failure.errors).toHaveLength(2);\n\n const packages = failure.errors.map((error) => ({\n text: error.text,\n location: error.location,\n }));\n\n const fsViolation = packages.find((pkg) => pkg.text.includes('\"fs\"'));\n const pathViolation = packages.find((pkg) => pkg.text.includes('\"path\"'));\n\n expect(fsViolation?.text).toContain('which is a Node.js module');\n expect(pathViolation?.text).toContain('which is a Node.js module');\n\n expect(fsViolation?.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(fsViolation?.location?.lineText).toContain('readFile');\n expect(pathViolation?.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(pathViolation?.location?.lineText).toContain('join');\n });\n\n it('should show top-level package name for nested Node.js imports', async () => {\n // This test validates that when a package in node_modules internally uses\n // Node.js built-in modules, the error message shows the top-level package name\n // (e.g., \"fake-package\") instead of the internal built-in (e.g., \"stream\").\n //\n // We create a real node_modules directory structure to simulate this scenario.\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const nodeModulesDir = join(tempDir, 'node_modules', 'fake-package');\n const { mkdirSync } = await import('node:fs');\n mkdirSync(nodeModulesDir, { recursive: true });\n\n const fakePackageCode = `\n import { Stream } from \"stream\";\n export function fakePackage() {\n return new Stream();\n }\n `;\n writeFileSync(join(nodeModulesDir, 'index.js'), fakePackageCode);\n writeFileSync(\n join(nodeModulesDir, 'package.json'),\n JSON.stringify({ name: 'fake-package', main: 'index.js' })\n );\n\n const testCode = `\n import { fakePackage } from \"fake-package\";\n export function workflow() {\n return fakePackage();\n }\n `;\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, testCode);\n const relativeEntry = relative(process.cwd(), entryFile);\n\n try {\n await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n throw new Error('Expected build to fail');\n } catch (error: any) {\n if (error && typeof error === 'object' && 'errors' in error) {\n const failure = error as esbuild.BuildFailure;\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n // Should mention the top-level package \"fake-package\", not the internal \"stream\" module\n expect(violation.text).toContain('\"fake-package\"');\n expect(violation.text).toContain('which depends on Node.js modules');\n expect(violation.text).not.toContain('\"stream\"');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n } else {\n throw error;\n }\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it('should detect packages when esbuild and resolver choose different entry fields', async () => {\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const nodeModulesDir = join(tempDir, 'node_modules', 'dual-entry-package');\n const esmDir = join(nodeModulesDir, 'esm');\n const cjsDir = join(nodeModulesDir, 'cjs');\n const { mkdirSync } = await import('node:fs');\n mkdirSync(esmDir, { recursive: true });\n mkdirSync(cjsDir, { recursive: true });\n\n writeFileSync(\n join(esmDir, 'index.js'),\n `\n import os from \"os\";\n export function getPlatform() {\n return os.platform();\n }\n `\n );\n writeFileSync(\n join(cjsDir, 'index.cjs'),\n `\n module.exports = {\n getPlatform() {\n return \"cjs\";\n }\n };\n `\n );\n writeFileSync(\n join(nodeModulesDir, 'package.json'),\n JSON.stringify({\n name: 'dual-entry-package',\n main: 'cjs/index.cjs',\n module: 'esm/index.js',\n })\n );\n\n const testCode = `\n import { getPlatform } from \"dual-entry-package\";\n export function workflow() {\n return getPlatform();\n }\n `;\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, testCode);\n const relativeEntry = relative(process.cwd(), entryFile);\n\n try {\n await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n format: 'cjs',\n mainFields: ['module', 'main'],\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n throw new Error('Expected build to fail');\n } catch (error: any) {\n if (error && typeof error === 'object' && 'errors' in error) {\n const failure = error as esbuild.BuildFailure;\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"dual-entry-package\"');\n expect(violation.text).toContain('depends on Node.js modules');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n } else {\n throw error;\n }\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it('should find usage of namespace imports', async () => {\n const testCode = `\n import * as fs from \"fs\";\n export function workflow() {\n return fs.readFile(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"fs\" which is a Node.js module');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n expect(violation.location?.lineText).toContain('fs.readFile');\n });\n\n it('should find usage of default imports', async () => {\n const testCode = `\n import fs from \"fs\";\n export function workflow() {\n return fs.readFile(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"fs\" which is a Node.js module');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n expect(violation.location?.lineText).toContain('fs.readFile');\n });\n\n it('should find usage of aliased imports', async () => {\n const testCode = `\n import { readFile as read } from \"fs\";\n export function workflow() {\n return read(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"fs\" which is a Node.js module');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n // Should point to the aliased identifier \"read\", not \"readFile\"\n expect(violation.location?.lineText).toContain('read(');\n });\n\n it('should not error when import is unused (tree-shaken)', async () => {\n // Note: esbuild tree-shakes unused imports, so they never trigger resolution.\n // This is expected behavior - if the import isn't used, the module won't be bundled.\n const testCode = `\n import { readFile } from \"fs\";\n export function workflow() {\n return \"no fs usage\";\n }\n `;\n\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, testCode);\n\n try {\n // Build should succeed because unused imports are tree-shaken\n const result = await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n expect(result.errors).toHaveLength(0);\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it('should not point to JSDoc comments when finding usage', async () => {\n const testCode = `\n import { Writable } from \"stream\";\n /**\n * Convert a Web WritableStream<string> into a Node.js Writable stream\n */\n export function workflow() {\n return new Writable();\n }\n `;\n\n const { failure } = await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"stream\" which is a Node.js module');\n // Should point to the actual code usage, not the JSDoc comment\n expect(violation.location?.lineText).toContain('new Writable()');\n expect(violation.location?.lineText).not.toContain('*');\n });\n\n it('should not point to single-line block comments when finding usage', async () => {\n const testCode = `\n import { Writable } from \"stream\";\n /* Writable is used below */\n export function workflow() {\n return new Writable();\n }\n `;\n\n const { failure } = await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n // Should point to the actual code usage, not the comment\n expect(violation.location?.lineText).toContain('new Writable()');\n });\n\n it('should not treat comment delimiters inside strings as comments', async () => {\n const testCode = `\n import { Writable } from \"stream\";\n const pattern = \"/* Writable */\";\n export function workflow() {\n return new Writable();\n }\n `;\n\n const { failure } = await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"stream\" which is a Node.js module');\n // Should point to actual code, not the string containing \"Writable\"\n expect(violation.location?.lineText).toContain('new Writable()');\n });\n\n it('should error on Bun module imports', async () => {\n const testCode = `\n import { serve } from \"bun\";\n export function workflow() {\n return serve({ port: 3000 });\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"bun\" which is a Bun module');\n expect(violation.text).toContain('Bun modules are not available');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n });\n\n it('should error on Bun subpath imports', async () => {\n const testCode = `\n import { Database } from \"bun:sqlite\";\n export function workflow() {\n return new Database(\"test.db\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"bun:sqlite\" which is a Bun module');\n expect(violation.text).toContain('Bun modules are not available');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n });\n});\n\ndescribe('workflow-node-module-error helper functions', () => {\n describe('getPackageName', () => {\n it('should get the package name from simple node_modules path', () => {\n const packageName = getPackageName(\n '/Users/adrianlam/GitHub/workflow/node_modules/node-fetch/src/index.js'\n );\n expect(packageName).toBe('node-fetch');\n });\n\n it('should get the package name from pnpm nested path', () => {\n const packageName = getPackageName(\n '/Users/adrianlam/GitHub/workflow/node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js'\n );\n expect(packageName).toBe('node-fetch');\n });\n\n it('should get scoped package name', () => {\n const packageName = getPackageName(\n '/project/node_modules/@supabase/supabase-js/dist/index.js'\n );\n expect(packageName).toBe('@supabase/supabase-js');\n });\n\n it('should return null for paths without node_modules', () => {\n const packageName = getPackageName(\n '/Users/adrianlam/GitHub/workflow/src/index.js'\n );\n expect(packageName).toBeNull();\n });\n });\n\n describe('escapeRegExp', () => {\n it('should escape regex special characters', () => {\n expect(escapeRegExp('test.file')).toBe('test\\\\.file');\n expect(escapeRegExp('test*file')).toBe('test\\\\*file');\n expect(escapeRegExp('test+file')).toBe('test\\\\+file');\n expect(escapeRegExp('test?file')).toBe('test\\\\?file');\n expect(escapeRegExp('test^file')).toBe('test\\\\^file');\n expect(escapeRegExp('test$file')).toBe('test\\\\$file');\n });\n\n it('should escape brackets and braces', () => {\n expect(escapeRegExp('test{file}')).toBe('test\\\\{file\\\\}');\n expect(escapeRegExp('test[file]')).toBe('test\\\\[file\\\\]');\n expect(escapeRegExp('test(file)')).toBe('test\\\\(file\\\\)');\n });\n\n it('should escape pipes and backslashes', () => {\n expect(escapeRegExp('test|file')).toBe('test\\\\|file');\n expect(escapeRegExp('test\\\\file')).toBe('test\\\\\\\\file');\n });\n\n it('should handle strings without special characters', () => {\n expect(escapeRegExp('testfile')).toBe('testfile');\n expect(escapeRegExp('test-file')).toBe('test-file');\n });\n\n it('should handle package names with special characters', () => {\n expect(escapeRegExp('@supabase/supabase-js')).toBe(\n '@supabase/supabase-js'\n );\n expect(escapeRegExp('package.name')).toBe('package\\\\.name');\n });\n });\n\n describe('getImportedIdentifier', () => {\n it('should extract namespace import identifier', () => {\n expect(getImportedIdentifier('* as fs')).toBe('fs');\n expect(getImportedIdentifier('* as path')).toBe('path');\n });\n\n it('should extract first named import', () => {\n expect(getImportedIdentifier('{ readFile }')).toBe('readFile');\n expect(getImportedIdentifier('{ readFile, writeFile }')).toBe('readFile');\n });\n\n it('should extract aliased named import', () => {\n expect(getImportedIdentifier('{ readFile as read }')).toBe('read');\n expect(getImportedIdentifier('{ readFile as read, writeFile }')).toBe(\n 'read'\n );\n });\n\n it('should extract default import', () => {\n expect(getImportedIdentifier('fs')).toBe('fs');\n expect(getImportedIdentifier('myDefault')).toBe('myDefault');\n });\n\n it('should extract first identifier from mixed imports', () => {\n // The function checks for braces first, so it extracts from named imports\n expect(getImportedIdentifier('fs, { readFile }')).toBe('readFile');\n expect(getImportedIdentifier('defaultExport, { named }')).toBe('named');\n });\n\n it('should handle whitespace variations', () => {\n expect(getImportedIdentifier(' { readFile } ')).toBe('readFile');\n expect(getImportedIdentifier('{readFile}')).toBe('readFile');\n expect(getImportedIdentifier('{ readFile , writeFile }')).toBe(\n 'readFile'\n );\n });\n\n it('should handle complex named imports', () => {\n expect(getImportedIdentifier('type { ReadStream }')).toBe('ReadStream');\n expect(getImportedIdentifier('{ default as fs }')).toBe('fs');\n });\n\n it('should return undefined for edge cases', () => {\n expect(getImportedIdentifier('*')).toBeUndefined();\n expect(getImportedIdentifier('')).toBeUndefined();\n // Empty braces should return undefined since there's no valid identifier\n expect(getImportedIdentifier('{}')).toBeUndefined();\n });\n });\n\n describe('getViolationLocation', () => {\n it('should find violation location for package name that appears in file', async () => {\n // Use the actual monorepo root as cwd\n const cwd = process.cwd();\n const testFile = 'src/node-module-esbuild-plugin.test.ts';\n\n // Test with 'vitest' which is actually imported in this file\n const location = await getViolationLocation(cwd, testFile, 'vitest');\n\n // The function should find 'vitest' in the import statement\n expect(location).toBeDefined();\n expect(location?.file).toBe(testFile);\n\n const contents = readFileSync(resolve(cwd, testFile), 'utf8');\n const lines = contents.split(/\\r?\\n/);\n const expectedLine =\n lines.findIndex((line) => line.includes(`describe(`)) + 1;\n\n expect(location?.line).toBe(expectedLine);\n expect(location?.column).toBe(0);\n expect(location?.lineText).toContain(`describe(`);\n expect(location?.length).toBe(8);\n });\n\n it('should return undefined for non-existent files', async () => {\n const cwd = process.cwd();\n const location = await getViolationLocation(\n cwd,\n 'non-existent-file.ts',\n 'some-package'\n );\n\n expect(location).toBeUndefined();\n });\n\n it('should return undefined for files without the package import', async () => {\n const cwd = process.cwd();\n const testFile = 'src/node-module-esbuild-plugin.test.ts';\n\n // This package is not imported in the test file\n const location = await getViolationLocation(\n cwd,\n testFile,\n 'non-existent-package'\n );\n\n expect(location).toBeUndefined();\n });\n\n it('should return undefined when import is unused even if it can be parsed', async () => {\n const cwd = process.cwd();\n const testFile = 'src/node-module-esbuild-plugin.test.ts';\n\n // Test with 'node:http' which is imported in this file but never used\n const location = await getViolationLocation(cwd, testFile, 'node:http');\n\n // Since the identifier is never referenced (only imported), we should\n // not produce a location preview.\n expect(location).toBeUndefined();\n });\n });\n});\n"]}
1
+ {"version":3,"file":"node-module-esbuild-plugin.test.js","sourceRoot":"","sources":["../src/node-module-esbuild-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpD,wEAAwE;AACxE,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;AAE1C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,2BAA2B,EAC3B,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,oBAAoB,GACrB,MAAM,iCAAiC,CAAC;AAEzC,KAAK,UAAU,0BAA0B,CACvC,MAAc,EACd,YAA2C,EAAE;IAE7C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,0BAA0B,CAAC,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC/C,aAAa,CAA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1B,MAAM,QAAQ,GAAG,wCAAwC,CAAC;YAE1D,sEAAsE;YACtE,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;YAExE,sEAAsE;YACtE,kCAAkC;YAClC,MAAM,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n mkdtempSync,\n readFileSync,\n realpathSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\n// @ts-expect-error - Intentionally unused import for testing getViolationLocation\n// with an import that exists but is never referenced in code\nimport http from 'node:http';\nimport { tmpdir } from 'node:os';\nimport { join, relative, resolve } from 'node:path';\n\n// Resolve symlinks in tmpdir to avoid macOS /var -> /private/var issues\nconst realTmpdir = realpathSync(tmpdir());\n\nimport * as esbuild from 'esbuild';\nimport { describe, expect, it } from 'vitest';\nimport {\n createNodeModuleErrorPlugin,\n escapeRegExp,\n getImportedIdentifier,\n getPackageName,\n getViolationLocation,\n} from './node-module-esbuild-plugin.js';\n\nasync function buildWorkflowWithViolation(\n source: string,\n overrides: Partial<esbuild.BuildOptions> = {}\n) {\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, source);\n const relativeEntry = relative(process.cwd(), entryFile);\n\n try {\n await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin(), ...(overrides.plugins ?? [])],\n ...overrides,\n });\n throw new Error('Expected build to fail');\n } catch (error: any) {\n if (error && typeof error === 'object' && 'errors' in error) {\n return {\n failure: error as esbuild.BuildFailure,\n relativeEntry,\n };\n }\n throw error;\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n}\n\ndescribe('workflow-node-module-error plugin', () => {\n it('should error on fs import', async () => {\n const testCode = `\n import { readFile } from \"fs\";\n export function workflow() {\n return readFile(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain(\n 'You are attempting to use \"fs\" which is a Node.js module'\n );\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(violation.location?.line).toBeGreaterThan(0);\n expect(violation.location?.column).toBeGreaterThanOrEqual(0);\n expect(violation.location?.lineText).toContain('readFile');\n });\n\n it('should error on node: prefixed imports', async () => {\n const testCode = `\n import { readFile } from \"node:fs\";\n export function workflow() {\n return readFile;\n }\n `;\n\n const { failure, relativeEntry } = await buildWorkflowWithViolation(\n testCode,\n { format: 'cjs' }\n );\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain(\n 'You are attempting to use \"node:fs\" which is a Node.js module'\n );\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(violation.location?.lineText).toContain('readFile');\n });\n\n it('should error on multiple Node.js imports', async () => {\n const testCode = `\n import { readFile } from \"fs\";\n import { join } from \"path\";\n export function workflow() {\n return readFile(join(\"a\", \"b\"));\n }\n `;\n\n const { failure, relativeEntry } = await buildWorkflowWithViolation(\n testCode,\n { format: 'cjs' }\n );\n\n expect(failure.errors).toHaveLength(2);\n\n const packages = failure.errors.map((error) => ({\n text: error.text,\n location: error.location,\n }));\n\n const fsViolation = packages.find((pkg) => pkg.text.includes('\"fs\"'));\n const pathViolation = packages.find((pkg) => pkg.text.includes('\"path\"'));\n\n expect(fsViolation?.text).toContain('which is a Node.js module');\n expect(pathViolation?.text).toContain('which is a Node.js module');\n\n expect(fsViolation?.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(fsViolation?.location?.lineText).toContain('readFile');\n expect(pathViolation?.location).toMatchObject({\n file: relativeEntry,\n suggestion: 'Move this function into a step function.',\n });\n expect(pathViolation?.location?.lineText).toContain('join');\n });\n\n it('should show top-level package name for nested Node.js imports', async () => {\n // This test validates that when a package in node_modules internally uses\n // Node.js built-in modules, the error message shows the top-level package name\n // (e.g., \"fake-package\") instead of the internal built-in (e.g., \"stream\").\n //\n // We create a real node_modules directory structure to simulate this scenario.\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const nodeModulesDir = join(tempDir, 'node_modules', 'fake-package');\n const { mkdirSync } = await import('node:fs');\n mkdirSync(nodeModulesDir, { recursive: true });\n\n const fakePackageCode = `\n import { Stream } from \"stream\";\n export function fakePackage() {\n return new Stream();\n }\n `;\n writeFileSync(join(nodeModulesDir, 'index.js'), fakePackageCode);\n writeFileSync(\n join(nodeModulesDir, 'package.json'),\n JSON.stringify({ name: 'fake-package', main: 'index.js' })\n );\n\n const testCode = `\n import { fakePackage } from \"fake-package\";\n export function workflow() {\n return fakePackage();\n }\n `;\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, testCode);\n const relativeEntry = relative(process.cwd(), entryFile);\n\n try {\n await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n throw new Error('Expected build to fail');\n } catch (error: any) {\n if (error && typeof error === 'object' && 'errors' in error) {\n const failure = error as esbuild.BuildFailure;\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n // Should mention the top-level package \"fake-package\", not the internal \"stream\" module\n expect(violation.text).toContain('\"fake-package\"');\n expect(violation.text).toContain('which depends on Node.js modules');\n expect(violation.text).not.toContain('\"stream\"');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n } else {\n throw error;\n }\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it('should detect packages when esbuild and resolver choose different entry fields', async () => {\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const nodeModulesDir = join(tempDir, 'node_modules', 'dual-entry-package');\n const esmDir = join(nodeModulesDir, 'esm');\n const cjsDir = join(nodeModulesDir, 'cjs');\n const { mkdirSync } = await import('node:fs');\n mkdirSync(esmDir, { recursive: true });\n mkdirSync(cjsDir, { recursive: true });\n\n writeFileSync(\n join(esmDir, 'index.js'),\n `\n import os from \"os\";\n export function getPlatform() {\n return os.platform();\n }\n `\n );\n writeFileSync(\n join(cjsDir, 'index.cjs'),\n `\n module.exports = {\n getPlatform() {\n return \"cjs\";\n }\n };\n `\n );\n writeFileSync(\n join(nodeModulesDir, 'package.json'),\n JSON.stringify({\n name: 'dual-entry-package',\n main: 'cjs/index.cjs',\n module: 'esm/index.js',\n })\n );\n\n const testCode = `\n import { getPlatform } from \"dual-entry-package\";\n export function workflow() {\n return getPlatform();\n }\n `;\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, testCode);\n const relativeEntry = relative(process.cwd(), entryFile);\n\n try {\n await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n format: 'cjs',\n mainFields: ['module', 'main'],\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n throw new Error('Expected build to fail');\n } catch (error: any) {\n if (error && typeof error === 'object' && 'errors' in error) {\n const failure = error as esbuild.BuildFailure;\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"dual-entry-package\"');\n expect(violation.text).toContain('depends on Node.js modules');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n } else {\n throw error;\n }\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it('should find usage of namespace imports', async () => {\n const testCode = `\n import * as fs from \"fs\";\n export function workflow() {\n return fs.readFile(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"fs\" which is a Node.js module');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n expect(violation.location?.lineText).toContain('fs.readFile');\n });\n\n it('should find usage of default imports', async () => {\n const testCode = `\n import fs from \"fs\";\n export function workflow() {\n return fs.readFile(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"fs\" which is a Node.js module');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n expect(violation.location?.lineText).toContain('fs.readFile');\n });\n\n it('should find usage of aliased imports', async () => {\n const testCode = `\n import { readFile as read } from \"fs\";\n export function workflow() {\n return read(\"test.txt\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"fs\" which is a Node.js module');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n // Should point to the aliased identifier \"read\", not \"readFile\"\n expect(violation.location?.lineText).toContain('read(');\n });\n\n it('should not error when import is unused (tree-shaken)', async () => {\n // Note: esbuild tree-shakes unused imports, so they never trigger resolution.\n // This is expected behavior - if the import isn't used, the module won't be bundled.\n const testCode = `\n import { readFile } from \"fs\";\n export function workflow() {\n return \"no fs usage\";\n }\n `;\n\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const entryFile = join(tempDir, 'workflow.ts');\n writeFileSync(entryFile, testCode);\n\n try {\n // Build should succeed because unused imports are tree-shaken\n const result = await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n expect(result.errors).toHaveLength(0);\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it('should not error when a shared module exposes a workflow-safe export alongside an unused Node.js-using export', async () => {\n // Repro for https://github.com/vercel/workflow/issues/1817\n //\n // When a shared module has both a workflow-safe export and a Node.js-using\n // export, and the workflow bundle only uses the workflow-safe one, esbuild\n // should be able to tree-shake the Node.js-using export (and its imports)\n // and the plugin should not emit a false-positive violation.\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const sharedFile = join(tempDir, 'shared.ts');\n const entryFile = join(tempDir, 'workflow.ts');\n\n writeFileSync(\n sharedFile,\n `\n import { readFile } from \"node:fs/promises\";\n import path from \"node:path\";\n\n export const isSupportedValue = (value) => value === \"ok\";\n\n export async function readFixtureFile() {\n return readFile(path.join(process.cwd(), \"fixture.txt\"), \"utf8\");\n }\n `\n );\n writeFileSync(\n entryFile,\n `\n import { isSupportedValue } from \"./shared.js\";\n export function workflow() {\n return isSupportedValue(\"ok\");\n }\n `\n );\n\n try {\n const result = await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n expect(result.errors).toHaveLength(0);\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it(\"should still error when a shared module's Node.js-using export is actually referenced\", async () => {\n // Counterpart to the previous test: when the workflow really does pull in\n // the Node.js-using export (directly or transitively), the plugin must\n // still emit the violation.\n const tempDir = mkdtempSync(join(realTmpdir, 'node-module-plugin-test-'));\n const sharedFile = join(tempDir, 'shared.ts');\n const entryFile = join(tempDir, 'workflow.ts');\n const relativeShared = relative(process.cwd(), sharedFile);\n\n writeFileSync(\n sharedFile,\n `\n import { readFile } from \"node:fs/promises\";\n import path from \"node:path\";\n\n export const isSupportedValue = (value) => value === \"ok\";\n\n export async function readFixtureFile() {\n return readFile(path.join(process.cwd(), \"fixture.txt\"), \"utf8\");\n }\n `\n );\n writeFileSync(\n entryFile,\n `\n import { isSupportedValue, readFixtureFile } from \"./shared.js\";\n export async function workflow() {\n if (!isSupportedValue(\"ok\")) throw new Error(\"nope\");\n return readFixtureFile();\n }\n `\n );\n\n try {\n await esbuild.build({\n entryPoints: [entryFile],\n bundle: true,\n write: false,\n platform: 'neutral',\n logLevel: 'silent',\n plugins: [createNodeModuleErrorPlugin()],\n });\n throw new Error('Expected build to fail');\n } catch (error: any) {\n if (error && typeof error === 'object' && 'errors' in error) {\n const failure = error as esbuild.BuildFailure;\n const paths = failure.errors.map((e) => e.text);\n expect(paths.some((t) => t.includes('\"node:fs/promises\"'))).toBe(true);\n expect(paths.some((t) => t.includes('\"node:path\"'))).toBe(true);\n // Violations should be attributed to the shared module, not the entry.\n for (const err of failure.errors) {\n expect(err.location?.file).toBe(relativeShared);\n }\n } else {\n throw error;\n }\n } finally {\n rmSync(tempDir, { recursive: true, force: true });\n }\n });\n\n it('should not point to JSDoc comments when finding usage', async () => {\n const testCode = `\n import { Writable } from \"stream\";\n /**\n * Convert a Web WritableStream<string> into a Node.js Writable stream\n */\n export function workflow() {\n return new Writable();\n }\n `;\n\n const { failure } = await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"stream\" which is a Node.js module');\n // Should point to the actual code usage, not the JSDoc comment\n expect(violation.location?.lineText).toContain('new Writable()');\n expect(violation.location?.lineText).not.toContain('*');\n });\n\n it('should not point to single-line block comments when finding usage', async () => {\n const testCode = `\n import { Writable } from \"stream\";\n /* Writable is used below */\n export function workflow() {\n return new Writable();\n }\n `;\n\n const { failure } = await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n // Should point to the actual code usage, not the comment\n expect(violation.location?.lineText).toContain('new Writable()');\n });\n\n it('should not treat comment delimiters inside strings as comments', async () => {\n const testCode = `\n import { Writable } from \"stream\";\n const pattern = \"/* Writable */\";\n export function workflow() {\n return new Writable();\n }\n `;\n\n const { failure } = await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"stream\" which is a Node.js module');\n // Should point to actual code, not the string containing \"Writable\"\n expect(violation.location?.lineText).toContain('new Writable()');\n });\n\n it('should error on Bun module imports', async () => {\n const testCode = `\n import { serve } from \"bun\";\n export function workflow() {\n return serve({ port: 3000 });\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"bun\" which is a Bun module');\n expect(violation.text).toContain('Bun modules are not available');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n });\n\n it('should error on Bun subpath imports', async () => {\n const testCode = `\n import { Database } from \"bun:sqlite\";\n export function workflow() {\n return new Database(\"test.db\");\n }\n `;\n\n const { failure, relativeEntry } =\n await buildWorkflowWithViolation(testCode);\n\n expect(failure.errors).toHaveLength(1);\n const violation = failure.errors[0];\n expect(violation.text).toContain('\"bun:sqlite\" which is a Bun module');\n expect(violation.text).toContain('Bun modules are not available');\n expect(violation.location).toMatchObject({\n file: relativeEntry,\n });\n });\n});\n\ndescribe('workflow-node-module-error helper functions', () => {\n describe('getPackageName', () => {\n it('should get the package name from simple node_modules path', () => {\n const packageName = getPackageName(\n '/Users/adrianlam/GitHub/workflow/node_modules/node-fetch/src/index.js'\n );\n expect(packageName).toBe('node-fetch');\n });\n\n it('should get the package name from pnpm nested path', () => {\n const packageName = getPackageName(\n '/Users/adrianlam/GitHub/workflow/node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/index.js'\n );\n expect(packageName).toBe('node-fetch');\n });\n\n it('should get scoped package name', () => {\n const packageName = getPackageName(\n '/project/node_modules/@supabase/supabase-js/dist/index.js'\n );\n expect(packageName).toBe('@supabase/supabase-js');\n });\n\n it('should return null for paths without node_modules', () => {\n const packageName = getPackageName(\n '/Users/adrianlam/GitHub/workflow/src/index.js'\n );\n expect(packageName).toBeNull();\n });\n });\n\n describe('escapeRegExp', () => {\n it('should escape regex special characters', () => {\n expect(escapeRegExp('test.file')).toBe('test\\\\.file');\n expect(escapeRegExp('test*file')).toBe('test\\\\*file');\n expect(escapeRegExp('test+file')).toBe('test\\\\+file');\n expect(escapeRegExp('test?file')).toBe('test\\\\?file');\n expect(escapeRegExp('test^file')).toBe('test\\\\^file');\n expect(escapeRegExp('test$file')).toBe('test\\\\$file');\n });\n\n it('should escape brackets and braces', () => {\n expect(escapeRegExp('test{file}')).toBe('test\\\\{file\\\\}');\n expect(escapeRegExp('test[file]')).toBe('test\\\\[file\\\\]');\n expect(escapeRegExp('test(file)')).toBe('test\\\\(file\\\\)');\n });\n\n it('should escape pipes and backslashes', () => {\n expect(escapeRegExp('test|file')).toBe('test\\\\|file');\n expect(escapeRegExp('test\\\\file')).toBe('test\\\\\\\\file');\n });\n\n it('should handle strings without special characters', () => {\n expect(escapeRegExp('testfile')).toBe('testfile');\n expect(escapeRegExp('test-file')).toBe('test-file');\n });\n\n it('should handle package names with special characters', () => {\n expect(escapeRegExp('@supabase/supabase-js')).toBe(\n '@supabase/supabase-js'\n );\n expect(escapeRegExp('package.name')).toBe('package\\\\.name');\n });\n });\n\n describe('getImportedIdentifier', () => {\n it('should extract namespace import identifier', () => {\n expect(getImportedIdentifier('* as fs')).toBe('fs');\n expect(getImportedIdentifier('* as path')).toBe('path');\n });\n\n it('should extract first named import', () => {\n expect(getImportedIdentifier('{ readFile }')).toBe('readFile');\n expect(getImportedIdentifier('{ readFile, writeFile }')).toBe('readFile');\n });\n\n it('should extract aliased named import', () => {\n expect(getImportedIdentifier('{ readFile as read }')).toBe('read');\n expect(getImportedIdentifier('{ readFile as read, writeFile }')).toBe(\n 'read'\n );\n });\n\n it('should extract default import', () => {\n expect(getImportedIdentifier('fs')).toBe('fs');\n expect(getImportedIdentifier('myDefault')).toBe('myDefault');\n });\n\n it('should extract first identifier from mixed imports', () => {\n // The function checks for braces first, so it extracts from named imports\n expect(getImportedIdentifier('fs, { readFile }')).toBe('readFile');\n expect(getImportedIdentifier('defaultExport, { named }')).toBe('named');\n });\n\n it('should handle whitespace variations', () => {\n expect(getImportedIdentifier(' { readFile } ')).toBe('readFile');\n expect(getImportedIdentifier('{readFile}')).toBe('readFile');\n expect(getImportedIdentifier('{ readFile , writeFile }')).toBe(\n 'readFile'\n );\n });\n\n it('should handle complex named imports', () => {\n expect(getImportedIdentifier('type { ReadStream }')).toBe('ReadStream');\n expect(getImportedIdentifier('{ default as fs }')).toBe('fs');\n });\n\n it('should return undefined for edge cases', () => {\n expect(getImportedIdentifier('*')).toBeUndefined();\n expect(getImportedIdentifier('')).toBeUndefined();\n // Empty braces should return undefined since there's no valid identifier\n expect(getImportedIdentifier('{}')).toBeUndefined();\n });\n });\n\n describe('getViolationLocation', () => {\n it('should find violation location for package name that appears in file', async () => {\n // Use the actual monorepo root as cwd\n const cwd = process.cwd();\n const testFile = 'src/node-module-esbuild-plugin.test.ts';\n\n // Test with 'vitest' which is actually imported in this file\n const location = await getViolationLocation(cwd, testFile, 'vitest');\n\n // The function should find 'vitest' in the import statement\n expect(location).toBeDefined();\n expect(location?.file).toBe(testFile);\n\n const contents = readFileSync(resolve(cwd, testFile), 'utf8');\n const lines = contents.split(/\\r?\\n/);\n const expectedLine =\n lines.findIndex((line) => line.includes(`describe(`)) + 1;\n\n expect(location?.line).toBe(expectedLine);\n expect(location?.column).toBe(0);\n expect(location?.lineText).toContain(`describe(`);\n expect(location?.length).toBe(8);\n });\n\n it('should return undefined for non-existent files', async () => {\n const cwd = process.cwd();\n const location = await getViolationLocation(\n cwd,\n 'non-existent-file.ts',\n 'some-package'\n );\n\n expect(location).toBeUndefined();\n });\n\n it('should return undefined for files without the package import', async () => {\n const cwd = process.cwd();\n const testFile = 'src/node-module-esbuild-plugin.test.ts';\n\n // This package is not imported in the test file\n const location = await getViolationLocation(\n cwd,\n testFile,\n 'non-existent-package'\n );\n\n expect(location).toBeUndefined();\n });\n\n it('should return undefined when import is unused even if it can be parsed', async () => {\n const cwd = process.cwd();\n const testFile = 'src/node-module-esbuild-plugin.test.ts';\n\n // Test with 'node:http' which is imported in this file but never used\n const location = await getViolationLocation(cwd, testFile, 'node:http');\n\n // Since the identifier is never referenced (only imported), we should\n // not produce a location preview.\n expect(location).toBeUndefined();\n });\n });\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=resolve-sourcemap.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-sourcemap.test.d.ts","sourceRoot":"","sources":["../src/resolve-sourcemap.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,126 @@
1
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
2
+ import { BaseBuilder } from './base-builder.js';
3
+ /**
4
+ * Minimal subclass that exposes the protected `resolveSourcemap()` and
5
+ * `sourcemapsEnabled` members for testing.
6
+ */
7
+ class TestBuilder extends BaseBuilder {
8
+ async build() {
9
+ // no-op
10
+ }
11
+ callResolveSourcemap(defaultMode) {
12
+ return this.resolveSourcemap(defaultMode);
13
+ }
14
+ get publicSourcemapsEnabled() {
15
+ return this.sourcemapsEnabled;
16
+ }
17
+ }
18
+ function createBuilder(sourcemap) {
19
+ const config = {
20
+ buildTarget: 'standalone',
21
+ workingDir: '/tmp/workflow-test',
22
+ dirs: ['.'],
23
+ stepsBundlePath: '',
24
+ workflowsBundlePath: '',
25
+ webhookBundlePath: '',
26
+ sourcemap,
27
+ };
28
+ return new TestBuilder(config);
29
+ }
30
+ describe('resolveSourcemap', () => {
31
+ const originalEnv = process.env.WORKFLOW_SOURCEMAP;
32
+ beforeEach(() => {
33
+ delete process.env.WORKFLOW_SOURCEMAP;
34
+ });
35
+ afterEach(() => {
36
+ if (originalEnv === undefined) {
37
+ delete process.env.WORKFLOW_SOURCEMAP;
38
+ }
39
+ else {
40
+ process.env.WORKFLOW_SOURCEMAP = originalEnv;
41
+ }
42
+ });
43
+ it('returns the default when no config or env var is set', () => {
44
+ const builder = createBuilder();
45
+ expect(builder.callResolveSourcemap('inline')).toBe('inline');
46
+ expect(builder.callResolveSourcemap(false)).toBe(false);
47
+ expect(builder.callResolveSourcemap(true)).toBe(true);
48
+ });
49
+ it('prefers explicit config over the default', () => {
50
+ expect(createBuilder(false).callResolveSourcemap('inline')).toBe(false);
51
+ expect(createBuilder('external').callResolveSourcemap('inline')).toBe('external');
52
+ expect(createBuilder('linked').callResolveSourcemap(false)).toBe('linked');
53
+ expect(createBuilder(true).callResolveSourcemap('inline')).toBe(true);
54
+ });
55
+ it('prefers explicit config over environment variable', () => {
56
+ process.env.WORKFLOW_SOURCEMAP = 'inline';
57
+ expect(createBuilder(false).callResolveSourcemap('inline')).toBe(false);
58
+ expect(createBuilder('external').callResolveSourcemap('inline')).toBe('external');
59
+ });
60
+ it('uses environment variable when config is not set', () => {
61
+ process.env.WORKFLOW_SOURCEMAP = 'false';
62
+ expect(createBuilder().callResolveSourcemap('inline')).toBe(false);
63
+ process.env.WORKFLOW_SOURCEMAP = 'true';
64
+ expect(createBuilder().callResolveSourcemap(false)).toBe(true);
65
+ for (const mode of ['inline', 'linked', 'external', 'both']) {
66
+ process.env.WORKFLOW_SOURCEMAP = mode;
67
+ expect(createBuilder().callResolveSourcemap('inline')).toBe(mode);
68
+ }
69
+ });
70
+ it('accepts "0" / "1" as environment variable aliases for false / true', () => {
71
+ process.env.WORKFLOW_SOURCEMAP = '0';
72
+ expect(createBuilder().callResolveSourcemap('inline')).toBe(false);
73
+ process.env.WORKFLOW_SOURCEMAP = '1';
74
+ expect(createBuilder().callResolveSourcemap(false)).toBe(true);
75
+ });
76
+ it('falls back to default when env var is empty or unrecognized', () => {
77
+ process.env.WORKFLOW_SOURCEMAP = '';
78
+ expect(createBuilder().callResolveSourcemap('inline')).toBe('inline');
79
+ // Suppress the expected warning
80
+ const originalWarn = console.warn;
81
+ console.warn = () => { };
82
+ try {
83
+ process.env.WORKFLOW_SOURCEMAP = 'nonsense';
84
+ expect(createBuilder().callResolveSourcemap('inline')).toBe('inline');
85
+ }
86
+ finally {
87
+ console.warn = originalWarn;
88
+ }
89
+ });
90
+ });
91
+ describe('sourcemapsEnabled', () => {
92
+ const originalEnv = process.env.WORKFLOW_SOURCEMAP;
93
+ beforeEach(() => {
94
+ delete process.env.WORKFLOW_SOURCEMAP;
95
+ });
96
+ afterEach(() => {
97
+ if (originalEnv === undefined) {
98
+ delete process.env.WORKFLOW_SOURCEMAP;
99
+ }
100
+ else {
101
+ process.env.WORKFLOW_SOURCEMAP = originalEnv;
102
+ }
103
+ });
104
+ it('is true by default', () => {
105
+ expect(createBuilder().publicSourcemapsEnabled).toBe(true);
106
+ });
107
+ it('is false when config sourcemap is false', () => {
108
+ expect(createBuilder(false).publicSourcemapsEnabled).toBe(false);
109
+ });
110
+ it('is true for any non-false config value', () => {
111
+ for (const mode of [
112
+ true,
113
+ 'inline',
114
+ 'linked',
115
+ 'external',
116
+ 'both',
117
+ ]) {
118
+ expect(createBuilder(mode).publicSourcemapsEnabled).toBe(true);
119
+ }
120
+ });
121
+ it('is false when WORKFLOW_SOURCEMAP env is false', () => {
122
+ process.env.WORKFLOW_SOURCEMAP = 'false';
123
+ expect(createBuilder().publicSourcemapsEnabled).toBe(false);
124
+ });
125
+ });
126
+ //# sourceMappingURL=resolve-sourcemap.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-sourcemap.test.js","sourceRoot":"","sources":["../src/resolve-sourcemap.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;GAGG;AACH,MAAM,WAAY,SAAQ,WAAW;IACnC,KAAK,CAAC,KAAK;QACT,QAAQ;IACV,CAAC;IAEM,oBAAoB,CAAC,WAA0B;QACpD,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IAED,IAAW,uBAAuB;QAChC,OAAO,IAAI,CAAC,iBA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,kBAAkB,GAAG,OAAO,CAAC;QACzC,MAAM,CAAC,aAAa,EAAE,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { afterEach, beforeEach, describe, expect, it } from 'vitest';\nimport { BaseBuilder } from './base-builder.js';\nimport type { SourcemapMode, StandaloneConfig } from './types.js';\n\n/**\n * Minimal subclass that exposes the protected `resolveSourcemap()` and\n * `sourcemapsEnabled` members for testing.\n */\nclass TestBuilder extends BaseBuilder {\n async build(): Promise<void> {\n // no-op\n }\n\n public callResolveSourcemap(defaultMode: SourcemapMode): SourcemapMode {\n return this.resolveSourcemap(defaultMode);\n }\n\n public get publicSourcemapsEnabled(): boolean {\n return this.sourcemapsEnabled;\n }\n}\n\nfunction createBuilder(sourcemap?: SourcemapMode): TestBuilder {\n const config: StandaloneConfig = {\n buildTarget: 'standalone',\n workingDir: '/tmp/workflow-test',\n dirs: ['.'],\n stepsBundlePath: '',\n workflowsBundlePath: '',\n webhookBundlePath: '',\n sourcemap,\n };\n return new TestBuilder(config);\n}\n\ndescribe('resolveSourcemap', () => {\n const originalEnv = process.env.WORKFLOW_SOURCEMAP;\n\n beforeEach(() => {\n delete process.env.WORKFLOW_SOURCEMAP;\n });\n\n afterEach(() => {\n if (originalEnv === undefined) {\n delete process.env.WORKFLOW_SOURCEMAP;\n } else {\n process.env.WORKFLOW_SOURCEMAP = originalEnv;\n }\n });\n\n it('returns the default when no config or env var is set', () => {\n const builder = createBuilder();\n expect(builder.callResolveSourcemap('inline')).toBe('inline');\n expect(builder.callResolveSourcemap(false)).toBe(false);\n expect(builder.callResolveSourcemap(true)).toBe(true);\n });\n\n it('prefers explicit config over the default', () => {\n expect(createBuilder(false).callResolveSourcemap('inline')).toBe(false);\n expect(createBuilder('external').callResolveSourcemap('inline')).toBe(\n 'external'\n );\n expect(createBuilder('linked').callResolveSourcemap(false)).toBe('linked');\n expect(createBuilder(true).callResolveSourcemap('inline')).toBe(true);\n });\n\n it('prefers explicit config over environment variable', () => {\n process.env.WORKFLOW_SOURCEMAP = 'inline';\n expect(createBuilder(false).callResolveSourcemap('inline')).toBe(false);\n expect(createBuilder('external').callResolveSourcemap('inline')).toBe(\n 'external'\n );\n });\n\n it('uses environment variable when config is not set', () => {\n process.env.WORKFLOW_SOURCEMAP = 'false';\n expect(createBuilder().callResolveSourcemap('inline')).toBe(false);\n\n process.env.WORKFLOW_SOURCEMAP = 'true';\n expect(createBuilder().callResolveSourcemap(false)).toBe(true);\n\n for (const mode of ['inline', 'linked', 'external', 'both'] as const) {\n process.env.WORKFLOW_SOURCEMAP = mode;\n expect(createBuilder().callResolveSourcemap('inline')).toBe(mode);\n }\n });\n\n it('accepts \"0\" / \"1\" as environment variable aliases for false / true', () => {\n process.env.WORKFLOW_SOURCEMAP = '0';\n expect(createBuilder().callResolveSourcemap('inline')).toBe(false);\n\n process.env.WORKFLOW_SOURCEMAP = '1';\n expect(createBuilder().callResolveSourcemap(false)).toBe(true);\n });\n\n it('falls back to default when env var is empty or unrecognized', () => {\n process.env.WORKFLOW_SOURCEMAP = '';\n expect(createBuilder().callResolveSourcemap('inline')).toBe('inline');\n\n // Suppress the expected warning\n const originalWarn = console.warn;\n console.warn = () => {};\n try {\n process.env.WORKFLOW_SOURCEMAP = 'nonsense';\n expect(createBuilder().callResolveSourcemap('inline')).toBe('inline');\n } finally {\n console.warn = originalWarn;\n }\n });\n});\n\ndescribe('sourcemapsEnabled', () => {\n const originalEnv = process.env.WORKFLOW_SOURCEMAP;\n\n beforeEach(() => {\n delete process.env.WORKFLOW_SOURCEMAP;\n });\n\n afterEach(() => {\n if (originalEnv === undefined) {\n delete process.env.WORKFLOW_SOURCEMAP;\n } else {\n process.env.WORKFLOW_SOURCEMAP = originalEnv;\n }\n });\n\n it('is true by default', () => {\n expect(createBuilder().publicSourcemapsEnabled).toBe(true);\n });\n\n it('is false when config sourcemap is false', () => {\n expect(createBuilder(false).publicSourcemapsEnabled).toBe(false);\n });\n\n it('is true for any non-false config value', () => {\n for (const mode of [\n true,\n 'inline',\n 'linked',\n 'external',\n 'both',\n ] as const) {\n expect(createBuilder(mode).publicSourcemapsEnabled).toBe(true);\n }\n });\n\n it('is false when WORKFLOW_SOURCEMAP env is false', () => {\n process.env.WORKFLOW_SOURCEMAP = 'false';\n expect(createBuilder().publicSourcemapsEnabled).toBe(false);\n });\n});\n"]}
@@ -3,9 +3,6 @@ import type { WorkflowConfig } from './types.js';
3
3
  export declare class StandaloneBuilder extends BaseBuilder {
4
4
  constructor(config: WorkflowConfig);
5
5
  build(): Promise<void>;
6
- private mergeManifests;
7
- private buildStepsBundle;
8
- private buildWorkflowsBundle;
9
6
  private buildWebhookFunction;
10
7
  }
11
8
  //# sourceMappingURL=standalone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,iBAAkB,SAAQ,WAAW;gBACpC,MAAM,EAAE,cAAc;IAO5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B5B,OAAO,CAAC,cAAc;YAuBR,gBAAgB;YAqBhB,oBAAoB;YA0BpB,oBAAoB;CAUnC"}
1
+ {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,iBAAkB,SAAQ,WAAW;gBACpC,MAAM,EAAE,cAAc;IAO5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAiCd,oBAAoB;CAUnC"}
@@ -9,19 +9,19 @@ export class StandaloneBuilder extends BaseBuilder {
9
9
  async build() {
10
10
  const inputFiles = await this.getInputFiles();
11
11
  const tsconfigPath = await this.findTsConfigPath();
12
- const options = {
12
+ const stepsBundlePath = this.resolvePath(this.config.stepsBundlePath);
13
+ const workflowBundlePath = this.resolvePath(this.config.workflowsBundlePath);
14
+ await this.ensureDirectory(stepsBundlePath);
15
+ await this.ensureDirectory(workflowBundlePath);
16
+ console.log('Creating combined bundle');
17
+ const { manifest } = await this.createCombinedBundle({
13
18
  inputFiles,
19
+ stepsOutfile: stepsBundlePath,
20
+ flowOutfile: workflowBundlePath,
14
21
  tsconfigPath,
15
- };
16
- const stepsManifest = await this.buildStepsBundle(options);
17
- const workflowsManifest = await this.buildWorkflowsBundle(options);
22
+ bundleFinalOutput: true,
23
+ });
18
24
  await this.buildWebhookFunction();
19
- // Merge manifests from both bundles
20
- // Steps bundle discovers classes from default export conditions
21
- // Workflow bundle discovers classes from 'workflow' export conditions
22
- const manifest = this.mergeManifests(stepsManifest, workflowsManifest);
23
- // Build unified manifest from workflow bundle
24
- const workflowBundlePath = this.resolvePath(this.config.workflowsBundlePath);
25
25
  const manifestDir = this.resolvePath('.well-known/workflow/v1');
26
26
  await this.createManifest({
27
27
  workflowBundlePath,
@@ -30,35 +30,6 @@ export class StandaloneBuilder extends BaseBuilder {
30
30
  });
31
31
  await this.createClientLibrary();
32
32
  }
33
- mergeManifests(stepsManifest, workflowsManifest) {
34
- return {
35
- steps: { ...stepsManifest.steps, ...workflowsManifest.steps },
36
- workflows: { ...stepsManifest.workflows, ...workflowsManifest.workflows },
37
- classes: { ...stepsManifest.classes, ...workflowsManifest.classes },
38
- };
39
- }
40
- async buildStepsBundle({ inputFiles, tsconfigPath, }) {
41
- console.log('Creating steps bundle at', this.config.stepsBundlePath);
42
- const stepsBundlePath = this.resolvePath(this.config.stepsBundlePath);
43
- await this.ensureDirectory(stepsBundlePath);
44
- const { manifest } = await this.createStepsBundle({
45
- outfile: stepsBundlePath,
46
- inputFiles,
47
- tsconfigPath,
48
- });
49
- return manifest;
50
- }
51
- async buildWorkflowsBundle({ inputFiles, tsconfigPath, }) {
52
- console.log('Creating workflows bundle at', this.config.workflowsBundlePath);
53
- const workflowBundlePath = this.resolvePath(this.config.workflowsBundlePath);
54
- await this.ensureDirectory(workflowBundlePath);
55
- const { manifest } = await this.createWorkflowsBundle({
56
- outfile: workflowBundlePath,
57
- inputFiles,
58
- tsconfigPath,
59
- });
60
- return manifest;
61
- }
62
33
  async buildWebhookFunction() {
63
34
  console.log('Creating webhook bundle at', this.config.webhookBundlePath);
64
35
  const webhookBundlePath = this.resolvePath(this.config.webhookBundlePath);
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.js","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAChD,YAAY,MAAsB;QAChC,KAAK,CAAC;YACJ,GAAG,MAAM;YACT,IAAI,EAAE,CAAC,GAAG,CAAC;SACZ,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAEnD,MAAM,OAAO,GAAG;YACd,UAAU;YACV,YAAY;SACb,CAAC;QACF,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC3D,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QACnE,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAElC,oCAAoC;QACpC,gEAAgE;QAChE,sEAAsE;QACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;QAEvE,8CAA8C;QAC9C,MAAM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,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,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC;YACpD,OAAO,EAAE,kBAAkB;YAC3B,UAAU;YACV,YAAY;SACb,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,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","sourcesContent":["import { BaseBuilder } from './base-builder.js';\nimport type { WorkflowConfig } from './types.js';\n\nexport class StandaloneBuilder extends BaseBuilder {\n constructor(config: WorkflowConfig) {\n super({\n ...config,\n dirs: ['.'],\n });\n }\n\n async build(): Promise<void> {\n const inputFiles = await this.getInputFiles();\n const tsconfigPath = await this.findTsConfigPath();\n\n const options = {\n inputFiles,\n tsconfigPath,\n };\n const stepsManifest = await this.buildStepsBundle(options);\n const workflowsManifest = await this.buildWorkflowsBundle(options);\n await this.buildWebhookFunction();\n\n // Merge manifests from both bundles\n // Steps bundle discovers classes from default export conditions\n // Workflow bundle discovers classes from 'workflow' export conditions\n const manifest = this.mergeManifests(stepsManifest, workflowsManifest);\n\n // Build unified manifest from workflow bundle\n const workflowBundlePath = this.resolvePath(\n this.config.workflowsBundlePath\n );\n const manifestDir = this.resolvePath('.well-known/workflow/v1');\n await this.createManifest({\n workflowBundlePath,\n manifestDir,\n manifest,\n });\n\n await this.createClientLibrary();\n }\n\n private mergeManifests(\n stepsManifest: {\n steps?: Record<string, any>;\n workflows?: Record<string, any>;\n classes?: Record<string, any>;\n },\n workflowsManifest: {\n steps?: Record<string, any>;\n workflows?: Record<string, any>;\n classes?: Record<string, any>;\n }\n ): {\n steps?: Record<string, any>;\n workflows?: Record<string, any>;\n classes?: Record<string, any>;\n } {\n return {\n steps: { ...stepsManifest.steps, ...workflowsManifest.steps },\n workflows: { ...stepsManifest.workflows, ...workflowsManifest.workflows },\n classes: { ...stepsManifest.classes, ...workflowsManifest.classes },\n };\n }\n\n private async buildStepsBundle({\n inputFiles,\n tsconfigPath,\n }: {\n inputFiles: string[];\n tsconfigPath?: string;\n }) {\n console.log('Creating steps bundle at', this.config.stepsBundlePath);\n\n const stepsBundlePath = this.resolvePath(this.config.stepsBundlePath);\n await this.ensureDirectory(stepsBundlePath);\n\n const { manifest } = await this.createStepsBundle({\n outfile: stepsBundlePath,\n inputFiles,\n tsconfigPath,\n });\n\n return manifest;\n }\n\n private async buildWorkflowsBundle({\n inputFiles,\n tsconfigPath,\n }: {\n inputFiles: string[];\n tsconfigPath?: string;\n }) {\n console.log(\n 'Creating workflows bundle at',\n this.config.workflowsBundlePath\n );\n\n const workflowBundlePath = this.resolvePath(\n this.config.workflowsBundlePath\n );\n await this.ensureDirectory(workflowBundlePath);\n\n const { manifest } = await this.createWorkflowsBundle({\n outfile: workflowBundlePath,\n inputFiles,\n tsconfigPath,\n });\n\n return manifest;\n }\n\n private async buildWebhookFunction(): Promise<void> {\n console.log('Creating webhook bundle at', this.config.webhookBundlePath);\n\n const webhookBundlePath = this.resolvePath(this.config.webhookBundlePath);\n await this.ensureDirectory(webhookBundlePath);\n\n await this.createWebhookBundle({\n outfile: webhookBundlePath,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"standalone.js","sourceRoot":"","sources":["../src/standalone.ts"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4B,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","sourcesContent":["import { BaseBuilder } from './base-builder.js';\nimport type { WorkflowConfig } from './types.js';\n\nexport class StandaloneBuilder extends BaseBuilder {\n constructor(config: WorkflowConfig) {\n super({\n ...config,\n dirs: ['.'],\n });\n }\n\n async build(): Promise<void> {\n const inputFiles = await this.getInputFiles();\n const tsconfigPath = await this.findTsConfigPath();\n\n const stepsBundlePath = this.resolvePath(this.config.stepsBundlePath);\n const workflowBundlePath = this.resolvePath(\n this.config.workflowsBundlePath\n );\n await this.ensureDirectory(stepsBundlePath);\n await this.ensureDirectory(workflowBundlePath);\n\n console.log('Creating combined bundle');\n\n const { manifest } = await this.createCombinedBundle({\n inputFiles,\n stepsOutfile: stepsBundlePath,\n flowOutfile: workflowBundlePath,\n tsconfigPath,\n bundleFinalOutput: true,\n });\n\n await this.buildWebhookFunction();\n\n const manifestDir = this.resolvePath('.well-known/workflow/v1');\n await this.createManifest({\n workflowBundlePath,\n manifestDir,\n manifest,\n });\n\n await this.createClientLibrary();\n }\n\n private async buildWebhookFunction(): Promise<void> {\n console.log('Creating webhook bundle at', this.config.webhookBundlePath);\n\n const webhookBundlePath = this.resolvePath(this.config.webhookBundlePath);\n await this.ensureDirectory(webhookBundlePath);\n\n await this.createWebhookBundle({\n outfile: webhookBundlePath,\n });\n }\n}\n"]}
@@ -18,6 +18,15 @@ export interface SwcPluginOptions {
18
18
  * breaks them because the .js file doesn't exist on disk.
19
19
  */
20
20
  rewriteTsExtensions?: boolean;
21
+ /**
22
+ * Bundle project-local files that are transitively imported by step entries.
23
+ *
24
+ * Keep this disabled when a downstream bundler consumes the generated step
25
+ * bundle because that bundler can resolve the externalized local imports.
26
+ * Enable it for direct runtime loading, where Node imports the generated step
27
+ * bundle from disk without a later bundling pass.
28
+ */
29
+ bundleTransitiveLocalStepDependencies?: boolean;
21
30
  /**
22
31
  * Absolute file paths of discovered workflow/step/serde entries whose
23
32
  * imports must be treated as side-effectful.
@@ -1 +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;AAOlC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAsCD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAgTjE"}
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;AAQlC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3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