@workflow/cli 4.0.1-beta.6 → 4.0.1-beta.8

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 (56) hide show
  1. package/LICENSE.md +201 -21
  2. package/dist/commands/build.d.ts.map +1 -1
  3. package/dist/commands/build.js +1 -2
  4. package/dist/commands/build.js.map +1 -1
  5. package/dist/commands/inspect.d.ts.map +1 -1
  6. package/dist/commands/inspect.js +21 -4
  7. package/dist/commands/inspect.js.map +1 -1
  8. package/dist/lib/config/types.d.ts +3 -15
  9. package/dist/lib/config/types.d.ts.map +1 -1
  10. package/dist/lib/config/types.js +1 -8
  11. package/dist/lib/config/types.js.map +1 -1
  12. package/dist/lib/inspect/output.d.ts +1 -0
  13. package/dist/lib/inspect/output.d.ts.map +1 -1
  14. package/dist/lib/inspect/output.js +105 -1
  15. package/dist/lib/inspect/output.js.map +1 -1
  16. package/package.json +12 -14
  17. package/dist/lib/builders/apply-swc-transform.d.ts +0 -24
  18. package/dist/lib/builders/apply-swc-transform.d.ts.map +0 -1
  19. package/dist/lib/builders/apply-swc-transform.js +0 -38
  20. package/dist/lib/builders/apply-swc-transform.js.map +0 -1
  21. package/dist/lib/builders/base-builder.d.ts +0 -45
  22. package/dist/lib/builders/base-builder.d.ts.map +0 -1
  23. package/dist/lib/builders/base-builder.js +0 -466
  24. package/dist/lib/builders/base-builder.js.map +0 -1
  25. package/dist/lib/builders/discover-entries-esbuild-plugin.d.ts +0 -11
  26. package/dist/lib/builders/discover-entries-esbuild-plugin.d.ts.map +0 -1
  27. package/dist/lib/builders/discover-entries-esbuild-plugin.js +0 -84
  28. package/dist/lib/builders/discover-entries-esbuild-plugin.js.map +0 -1
  29. package/dist/lib/builders/next-build.d.ts +0 -11
  30. package/dist/lib/builders/next-build.d.ts.map +0 -1
  31. package/dist/lib/builders/next-build.js +0 -331
  32. package/dist/lib/builders/next-build.js.map +0 -1
  33. package/dist/lib/builders/node-module-esbuild-plugin.d.ts +0 -3
  34. package/dist/lib/builders/node-module-esbuild-plugin.d.ts.map +0 -1
  35. package/dist/lib/builders/node-module-esbuild-plugin.js +0 -24
  36. package/dist/lib/builders/node-module-esbuild-plugin.js.map +0 -1
  37. package/dist/lib/builders/node-module-esbuild-plugin.test.d.ts +0 -2
  38. package/dist/lib/builders/node-module-esbuild-plugin.test.d.ts.map +0 -1
  39. package/dist/lib/builders/node-module-esbuild-plugin.test.js +0 -128
  40. package/dist/lib/builders/node-module-esbuild-plugin.test.js.map +0 -1
  41. package/dist/lib/builders/standalone.d.ts +0 -8
  42. package/dist/lib/builders/standalone.d.ts.map +0 -1
  43. package/dist/lib/builders/standalone.js +0 -52
  44. package/dist/lib/builders/standalone.js.map +0 -1
  45. package/dist/lib/builders/swc-esbuild-plugin.d.ts +0 -12
  46. package/dist/lib/builders/swc-esbuild-plugin.d.ts.map +0 -1
  47. package/dist/lib/builders/swc-esbuild-plugin.js +0 -134
  48. package/dist/lib/builders/swc-esbuild-plugin.js.map +0 -1
  49. package/dist/lib/builders/vercel-build-output-api.d.ts +0 -9
  50. package/dist/lib/builders/vercel-build-output-api.d.ts.map +0 -1
  51. package/dist/lib/builders/vercel-build-output-api.js +0 -138
  52. package/dist/lib/builders/vercel-build-output-api.js.map +0 -1
  53. package/dist/lib/builders/webhook-route.test.d.ts +0 -2
  54. package/dist/lib/builders/webhook-route.test.d.ts.map +0 -1
  55. package/dist/lib/builders/webhook-route.test.js +0 -206
  56. package/dist/lib/builders/webhook-route.test.js.map +0 -1
@@ -1,466 +0,0 @@
1
- import { mkdir, readFile, writeFile } from 'node:fs/promises';
2
- import { dirname, join, resolve } from 'node:path';
3
- import { promisify } from 'node:util';
4
- import chalk from 'chalk';
5
- import { parse } from 'comment-json';
6
- import enhancedResolveOriginal from 'enhanced-resolve';
7
- import * as esbuild from 'esbuild';
8
- import { findUp } from 'find-up';
9
- import { glob } from 'tinyglobby';
10
- import { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
11
- import { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
12
- import { createSwcPlugin } from './swc-esbuild-plugin.js';
13
- const enhancedResolve = promisify(enhancedResolveOriginal);
14
- const EMIT_SOURCEMAPS_FOR_DEBUGGING = process.env.WORKFLOW_EMIT_SOURCEMAPS_FOR_DEBUGGING === '1';
15
- export class BaseBuilder {
16
- config;
17
- constructor(config) {
18
- this.config = config;
19
- }
20
- async getTsConfigOptions() {
21
- const options = {};
22
- const cwd = this.config.workingDir || process.cwd();
23
- const tsJsConfig = await findUp(['tsconfig.json', 'jsconfig.json'], {
24
- cwd,
25
- });
26
- if (tsJsConfig) {
27
- try {
28
- const rawJson = await readFile(tsJsConfig, 'utf8');
29
- const parsed = parse(rawJson);
30
- if (parsed) {
31
- options.paths = parsed.compilerOptions?.paths;
32
- if (parsed.compilerOptions?.baseUrl) {
33
- options.baseUrl = resolve(cwd, parsed.compilerOptions.baseUrl);
34
- }
35
- else {
36
- options.baseUrl = cwd;
37
- }
38
- }
39
- }
40
- catch (err) {
41
- console.error(`Failed to parse ${tsJsConfig} aliases might not apply properly`, err);
42
- }
43
- }
44
- return options;
45
- }
46
- async getInputFiles() {
47
- const result = await glob(this.config.dirs.map((dir) => `${resolve(this.config.workingDir, dir)}/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}`), {
48
- ignore: [
49
- '**/node_modules/**',
50
- '**/.git/**',
51
- '**/.next/**',
52
- '**/.vercel/**',
53
- '**/.workflow-data/**',
54
- '**/.well-known/workflow/**',
55
- ],
56
- absolute: true,
57
- });
58
- return result;
59
- }
60
- discoveredEntries = new WeakMap();
61
- async discoverEntries(inputs, outdir) {
62
- const previousResult = this.discoveredEntries.get(inputs);
63
- if (previousResult) {
64
- return previousResult;
65
- }
66
- const state = {
67
- discoveredSteps: [],
68
- discoveredWorkflows: [],
69
- };
70
- const discoverStart = Date.now();
71
- try {
72
- await esbuild.build({
73
- treeShaking: true,
74
- entryPoints: inputs,
75
- plugins: [createDiscoverEntriesPlugin(state)],
76
- platform: 'node',
77
- write: false,
78
- outdir,
79
- bundle: true,
80
- sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,
81
- absWorkingDir: this.config.workingDir,
82
- logLevel: 'silent',
83
- });
84
- }
85
- catch (_) { }
86
- console.log(`Discovering workflow directives`, `${Date.now() - discoverStart}ms`);
87
- this.discoveredEntries.set(inputs, state);
88
- return state;
89
- }
90
- // write debug information to JSON file (maybe move to diagnostics folder)
91
- // if on Vercel
92
- async writeDebugFile(outfile, debugData, merge) {
93
- try {
94
- let existing = {};
95
- if (merge) {
96
- existing = JSON.parse(await readFile(`${outfile}.debug.json`, 'utf8').catch(() => '{}'));
97
- }
98
- await writeFile(`${outfile}.debug.json`, JSON.stringify({
99
- ...existing,
100
- ...debugData,
101
- }, null, 2));
102
- }
103
- catch (error) {
104
- console.warn('Failed to write debug file:', error);
105
- }
106
- }
107
- logEsbuildMessages(result, phase) {
108
- if (result.errors && result.errors.length > 0) {
109
- console.error(`❌ esbuild errors in ${phase}:`);
110
- for (const error of result.errors) {
111
- console.error(` ${error.text}`);
112
- if (error.location) {
113
- console.error(` at ${error.location.file}:${error.location.line}:${error.location.column}`);
114
- }
115
- }
116
- }
117
- if (result.warnings && result.warnings.length > 0) {
118
- console.warn(`! esbuild warnings in ${phase}:`);
119
- for (const warning of result.warnings) {
120
- console.warn(` ${warning.text}`);
121
- if (warning.location) {
122
- console.warn(` at ${warning.location.file}:${warning.location.line}:${warning.location.column}`);
123
- }
124
- }
125
- }
126
- }
127
- async createStepsBundle({ inputFiles, format = 'cjs', outfile, externalizeNonSteps, tsBaseUrl, tsPaths, }) {
128
- // These need to handle watching for dev to scan for
129
- // new entries and changes to existing ones
130
- const { discoveredSteps: stepFiles } = await this.discoverEntries(inputFiles, dirname(outfile));
131
- // log the step files for debugging
132
- await this.writeDebugFile(outfile, { stepFiles });
133
- const stepsBundleStart = Date.now();
134
- const workflowManifest = {};
135
- const builtInSteps = 'workflow/internal/builtins';
136
- const resolvedBuiltInSteps = await enhancedResolve(dirname(outfile), 'workflow/internal/builtins').catch((err) => {
137
- throw new Error([
138
- chalk.red('Failed to resolve built-in steps sources.'),
139
- `${chalk.yellow.bold('hint:')} run \`${chalk.cyan.italic('npm install workflow')}\` to resolve this issue.`,
140
- '',
141
- `Caused by: ${chalk.red(String(err))}`,
142
- ].join('\n'));
143
- });
144
- // Create a virtual entry that imports all files. All step definitions
145
- // will get registered thanks to the swc transform.
146
- const imports = stepFiles.map((file) => `import '${file}';`).join('\n');
147
- const entryContent = `
148
- // Built in steps
149
- import '${builtInSteps}';
150
- // User steps
151
- ${imports}
152
- // API entrypoint
153
- export { stepEntrypoint as POST } from 'workflow/runtime';`;
154
- // Bundle with esbuild and our custom SWC plugin
155
- const esbuildCtx = await esbuild.context({
156
- banner: {
157
- js: '// biome-ignore-all lint: generated file\n/* eslint-disable */\n',
158
- },
159
- stdin: {
160
- contents: entryContent,
161
- resolveDir: this.config.workingDir,
162
- sourcefile: 'virtual-entry.js',
163
- loader: 'js',
164
- },
165
- outfile,
166
- absWorkingDir: this.config.workingDir,
167
- bundle: true,
168
- format,
169
- platform: 'node',
170
- conditions: ['node'],
171
- target: 'es2022',
172
- write: true,
173
- treeShaking: true,
174
- keepNames: true,
175
- minify: false,
176
- resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
177
- // TODO: investigate proper source map support
178
- sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,
179
- plugins: [
180
- createSwcPlugin({
181
- mode: 'step',
182
- entriesToBundle: externalizeNonSteps
183
- ? [
184
- ...stepFiles,
185
- ...(resolvedBuiltInSteps ? [resolvedBuiltInSteps] : []),
186
- ]
187
- : undefined,
188
- outdir: outfile ? dirname(outfile) : undefined,
189
- tsBaseUrl,
190
- tsPaths,
191
- workflowManifest,
192
- }),
193
- ],
194
- // Plugin should catch most things, but this lets users hard override
195
- // if the plugin misses anything that should be externalized
196
- external: this.config.externalPackages || [],
197
- });
198
- const stepsResult = await esbuildCtx.rebuild();
199
- this.logEsbuildMessages(stepsResult, 'steps bundle creation');
200
- console.log('Created steps bundle', `${Date.now() - stepsBundleStart}ms`);
201
- const partialWorkflowManifest = {
202
- steps: workflowManifest.steps,
203
- };
204
- // always write to debug file
205
- await this.writeDebugFile(join(dirname(outfile), 'manifest'), partialWorkflowManifest, true);
206
- // Create .gitignore in .swc directory
207
- await this.createSwcGitignore();
208
- if (this.config.watch) {
209
- return esbuildCtx;
210
- }
211
- await esbuildCtx.dispose();
212
- }
213
- async createWorkflowsBundle({ inputFiles, format = 'cjs', outfile, bundleFinalOutput = true, tsBaseUrl, tsPaths, }) {
214
- const { discoveredWorkflows: workflowFiles } = await this.discoverEntries(inputFiles, dirname(outfile));
215
- // log the workflow files for debugging
216
- await this.writeDebugFile(outfile, { workflowFiles });
217
- // Create a virtual entry that imports all files
218
- const imports = `globalThis.__private_workflows = new Map();\n` +
219
- workflowFiles
220
- .map((file, workflowFileIdx) => `import * as workflowFile${workflowFileIdx} from '${file}';
221
- Object.values(workflowFile${workflowFileIdx}).map(item => item?.workflowId && globalThis.__private_workflows.set(item.workflowId, item))`)
222
- .join('\n');
223
- const bundleStartTime = Date.now();
224
- const workflowManifest = {};
225
- // Bundle with esbuild and our custom SWC plugin in workflow mode.
226
- // this bundle will be run inside a vm isolate
227
- const interimBundleCtx = await esbuild.context({
228
- stdin: {
229
- contents: imports,
230
- resolveDir: this.config.workingDir,
231
- sourcefile: 'virtual-entry.js',
232
- loader: 'js',
233
- },
234
- bundle: true,
235
- absWorkingDir: this.config.workingDir,
236
- format: 'cjs', // Runs inside the VM which expects cjs
237
- platform: 'neutral', // The platform is neither node nor browser
238
- mainFields: ['module', 'main'], // To support npm style imports
239
- conditions: ['workflow'], // Allow packages to export 'workflow' compliant versions
240
- target: 'es2022',
241
- write: false,
242
- treeShaking: true,
243
- keepNames: true,
244
- minify: false,
245
- // TODO: investigate proper source map support
246
- sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,
247
- resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
248
- plugins: [
249
- createSwcPlugin({
250
- mode: 'workflow',
251
- tsBaseUrl,
252
- tsPaths,
253
- workflowManifest,
254
- }),
255
- // This plugin must run after the swc plugin to ensure dead code elimination
256
- // happens first, preventing false positives on Node.js imports in unused code paths
257
- createNodeModuleErrorPlugin(),
258
- ],
259
- });
260
- const interimBundle = await interimBundleCtx.rebuild();
261
- this.logEsbuildMessages(interimBundle, 'intermediate workflow bundle');
262
- console.log('Created intermediate workflow bundle', `${Date.now() - bundleStartTime}ms`);
263
- const partialWorkflowManifest = {
264
- workflows: workflowManifest.workflows,
265
- };
266
- await this.writeDebugFile(join(dirname(outfile), 'manifest'), partialWorkflowManifest, true);
267
- if (this.config.workflowManifestPath) {
268
- const resolvedPath = resolve(process.cwd(), this.config.workflowManifestPath);
269
- let prefix = '';
270
- if (resolvedPath.endsWith('.cjs')) {
271
- prefix = 'module.exports = ';
272
- }
273
- else if (resolvedPath.endsWith('.js') ||
274
- resolvedPath.endsWith('.mjs')) {
275
- prefix = 'export default ';
276
- }
277
- await mkdir(dirname(resolvedPath), { recursive: true });
278
- await writeFile(resolvedPath, prefix + JSON.stringify(workflowManifest.workflows, null, 2));
279
- }
280
- // Create .gitignore in .swc directory
281
- await this.createSwcGitignore();
282
- if (!interimBundle.outputFiles || interimBundle.outputFiles.length === 0) {
283
- throw new Error('No output files generated from esbuild');
284
- }
285
- const bundleFinal = async (interimBundle) => {
286
- const workflowBundleCode = interimBundle;
287
- // Create the workflow function handler with proper linter suppressions
288
- const workflowFunctionCode = `// biome-ignore-all lint: generated file
289
- /* eslint-disable */
290
- import { workflowEntrypoint } from 'workflow/runtime';
291
-
292
- const workflowCode = \`${workflowBundleCode.replace(/[\\`$]/g, '\\$&')}\`;
293
-
294
- export const POST = workflowEntrypoint(workflowCode);`;
295
- // we skip the final bundling step for Next.js so it can bundle itself
296
- if (!bundleFinalOutput) {
297
- if (!outfile) {
298
- throw new Error(`Invariant: missing outfile for workflow bundle`);
299
- }
300
- // Ensure the output directory exists
301
- const outputDir = dirname(outfile);
302
- await mkdir(outputDir, { recursive: true });
303
- await writeFile(outfile, workflowFunctionCode);
304
- return;
305
- }
306
- const bundleStartTime = Date.now();
307
- // Now bundle this so we can resolve the @workflow/core dependency
308
- // we could remove this if we do nft tracing or similar instead
309
- const finalWorkflowResult = await esbuild.build({
310
- banner: {
311
- js: '// biome-ignore-all lint: generated file\n/* eslint-disable */\n',
312
- },
313
- stdin: {
314
- contents: workflowFunctionCode,
315
- resolveDir: this.config.workingDir,
316
- sourcefile: 'virtual-entry.js',
317
- loader: 'js',
318
- },
319
- outfile,
320
- // TODO: investigate proper source map support
321
- sourcemap: EMIT_SOURCEMAPS_FOR_DEBUGGING,
322
- absWorkingDir: this.config.workingDir,
323
- bundle: true,
324
- format,
325
- platform: 'node',
326
- target: 'es2022',
327
- write: true,
328
- keepNames: true,
329
- minify: false,
330
- external: ['@aws-sdk/credential-provider-web-identity'],
331
- });
332
- this.logEsbuildMessages(finalWorkflowResult, 'final workflow bundle');
333
- console.log('Created final workflow bundle', `${Date.now() - bundleStartTime}ms`);
334
- };
335
- await bundleFinal(interimBundle.outputFiles[0].text);
336
- if (this.config.watch) {
337
- return {
338
- interimBundleCtx,
339
- bundleFinal,
340
- };
341
- }
342
- await interimBundleCtx.dispose();
343
- }
344
- async buildClientLibrary() {
345
- if (!this.config.clientBundlePath) {
346
- // Silently exit since no client bundle was requested
347
- return;
348
- }
349
- console.log('Generating a client library at', this.config.clientBundlePath);
350
- console.log('NOTE: The recommended way to use workflow with a framework like NextJS is using the loader/plugin with webpack/turbobpack/rollup');
351
- // Ensure we have the directory for the client bundle
352
- const outputDir = dirname(this.config.clientBundlePath);
353
- await mkdir(outputDir, { recursive: true });
354
- const inputFiles = await this.getInputFiles();
355
- // Create a virtual entry that imports all files
356
- const imports = inputFiles
357
- .map((file) => `export * from '${file}';`)
358
- .join('\n');
359
- // Bundle with esbuild and our custom SWC plugin
360
- const clientResult = await esbuild.build({
361
- banner: {
362
- js: '// biome-ignore-all lint: generated file\n/* eslint-disable */\n',
363
- },
364
- stdin: {
365
- contents: imports,
366
- resolveDir: this.config.workingDir,
367
- sourcefile: 'virtual-entry.js',
368
- loader: 'js',
369
- },
370
- outfile: this.config.clientBundlePath,
371
- bundle: true,
372
- format: 'esm',
373
- platform: 'node',
374
- target: 'es2022',
375
- write: true,
376
- treeShaking: true,
377
- external: ['@workflow/core'],
378
- resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
379
- plugins: [createSwcPlugin({ mode: 'client' })],
380
- });
381
- this.logEsbuildMessages(clientResult, 'client library bundle');
382
- // Create .gitignore in .swc directory
383
- await this.createSwcGitignore();
384
- }
385
- async createWebhookBundle({ outfile, bundle = false, }) {
386
- console.log('Creating webhook route');
387
- await mkdir(dirname(outfile), { recursive: true });
388
- // Create a static route that calls resumeWebhook
389
- // This route works for both Next.js and Vercel Build Output API
390
- const routeContent = `import { resumeWebhook } from 'workflow/api';
391
-
392
- async function handler(request) {
393
- const url = new URL(request.url);
394
- // Extract token from pathname: /.well-known/workflow/v1/webhook/{token}
395
- const pathParts = url.pathname.split('/');
396
- const token = decodeURIComponent(pathParts[pathParts.length - 1]);
397
-
398
- if (!token) {
399
- return new Response('Missing token', { status: 400 });
400
- }
401
-
402
- try {
403
- const response = await resumeWebhook(token, request);
404
- return response;
405
- } catch (error) {
406
- // TODO: differentiate between invalid token and other errors
407
- console.error('Error during resumeWebhook', error);
408
- return new Response(null, { status: 404 });
409
- }
410
- }
411
-
412
- export const GET = handler;
413
- export const POST = handler;
414
- export const PUT = handler;
415
- export const PATCH = handler;
416
- export const DELETE = handler;
417
- export const HEAD = handler;
418
- export const OPTIONS = handler;
419
- `;
420
- if (!bundle) {
421
- // For Next.js, just write the unbundled file
422
- await writeFile(outfile, routeContent);
423
- return;
424
- }
425
- // For Build Output API, bundle with esbuild to resolve imports
426
- const webhookBundleStart = Date.now();
427
- const result = await esbuild.build({
428
- banner: {
429
- js: '// biome-ignore-all lint: generated file\n/* eslint-disable */\n',
430
- },
431
- stdin: {
432
- contents: routeContent,
433
- resolveDir: this.config.workingDir,
434
- sourcefile: 'webhook-route.js',
435
- loader: 'js',
436
- },
437
- outfile,
438
- absWorkingDir: this.config.workingDir,
439
- bundle: true,
440
- format: 'cjs',
441
- platform: 'node',
442
- conditions: ['import', 'module', 'node', 'default'],
443
- target: 'es2022',
444
- write: true,
445
- treeShaking: true,
446
- keepNames: true,
447
- minify: false,
448
- resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
449
- sourcemap: false,
450
- mainFields: ['module', 'main'],
451
- // Don't externalize anything - bundle everything including workflow packages
452
- external: [],
453
- });
454
- this.logEsbuildMessages(result, 'webhook bundle creation');
455
- console.log('Created webhook bundle', `${Date.now() - webhookBundleStart}ms`);
456
- }
457
- async createSwcGitignore() {
458
- try {
459
- await writeFile(join(this.config.workingDir, '.swc', '.gitignore'), '*\n');
460
- }
461
- catch {
462
- // We're intentionally silently ignoring this error - creating .gitignore isn't critical
463
- }
464
- }
465
- }
466
- //# sourceMappingURL=base-builder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-builder.js","sourceRoot":"","sources":["../../../src/lib/builders/base-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,uBAAuB,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OA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b,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;YACnD,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;YACb,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;YACjE,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC9B,6EAA6E;YAC7E,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;QAEH,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CACT,wBAAwB,EACxB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,IAAI,CACvC,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,kBAAkB;QAC9B,IAAI,CAAC;YACH,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAClD,KAAK,CACN,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,wFAAwF;QAC1F,CAAC;IACH,CAAC;CACF"}
@@ -1,11 +0,0 @@
1
- import type { Plugin } from 'esbuild';
2
- export declare const jsTsRegex: RegExp;
3
- export declare const useWorkflowPattern: RegExp;
4
- export declare const useStepPattern: RegExp;
5
- export declare const importParents: Map<string, string>;
6
- export declare function parentHasChild(parent: string, childToFind: string): boolean;
7
- export declare function createDiscoverEntriesPlugin(state: {
8
- discoveredSteps: string[];
9
- discoveredWorkflows: string[];
10
- }): Plugin;
11
- //# sourceMappingURL=discover-entries-esbuild-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"discover-entries-esbuild-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/builders/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,84 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { promisify } from 'node:util';
3
- import enhancedResolveOriginal from 'enhanced-resolve';
4
- import { applySwcTransform } from './apply-swc-transform.js';
5
- const enhancedResolve = promisify(enhancedResolveOriginal);
6
- export const jsTsRegex = /\.(ts|tsx|js|jsx|mjs|cjs)$/;
7
- // Matches: 'use workflow'; "use workflow"; 'use step'; "use step"; at line start with optional whitespace
8
- export const useWorkflowPattern = /^\s*(['"])use workflow\1;?\s*$/m;
9
- export const useStepPattern = /^\s*(['"])use step\1;?\s*$/m;
10
- // parent -> child relationship
11
- export const importParents = new Map();
12
- // check if a parent has a child in it's import chain
13
- // e.g. if a dependency needs to be bundled because it has
14
- // a 'use workflow/'use step' directive in it
15
- export function parentHasChild(parent, childToFind) {
16
- let child;
17
- let currentParent = parent;
18
- const visited = new Set();
19
- do {
20
- if (currentParent) {
21
- // Detect circular imports to prevent infinite loop
22
- if (visited.has(currentParent)) {
23
- break;
24
- }
25
- visited.add(currentParent);
26
- child = importParents.get(currentParent);
27
- }
28
- if (child === childToFind) {
29
- return true;
30
- }
31
- currentParent = child;
32
- } while (child && currentParent);
33
- return false;
34
- }
35
- export function createDiscoverEntriesPlugin(state) {
36
- return {
37
- name: 'discover-entries-esbuild-plugin',
38
- setup(build) {
39
- build.onResolve({ filter: jsTsRegex }, async (args) => {
40
- try {
41
- const resolved = await enhancedResolve(args.resolveDir, args.path);
42
- if (resolved) {
43
- importParents.set(args.importer, resolved);
44
- }
45
- }
46
- catch (_) { }
47
- return null;
48
- });
49
- // Handle TypeScript and JavaScript files
50
- build.onLoad({ filter: jsTsRegex }, async (args) => {
51
- try {
52
- // Determine the loader based on the output
53
- let loader = 'js';
54
- const isTypeScript = args.path.endsWith('.ts') || args.path.endsWith('.tsx');
55
- if (!isTypeScript && args.path.endsWith('.jsx')) {
56
- loader = 'jsx';
57
- }
58
- const source = await readFile(args.path, 'utf8');
59
- const hasUseWorkflow = useWorkflowPattern.test(source);
60
- const hasUseStep = useStepPattern.test(source);
61
- if (hasUseWorkflow) {
62
- state.discoveredWorkflows.push(args.path);
63
- }
64
- if (hasUseStep) {
65
- state.discoveredSteps.push(args.path);
66
- }
67
- const { code: transformedCode } = await applySwcTransform(args.path, source, false);
68
- return {
69
- contents: transformedCode,
70
- loader,
71
- };
72
- }
73
- catch (_) {
74
- // ignore trace errors during discover phase
75
- return {
76
- contents: '',
77
- loader: 'js',
78
- };
79
- }
80
- });
81
- },
82
- };
83
- }
84
- //# sourceMappingURL=discover-entries-esbuild-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"discover-entries-esbuild-plugin.js","sourceRoot":"","sources":["../../../src/lib/builders/discover-entries-esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,uBAAuB,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,eAAe,GAAG,SAAS,CAAC,uBAAuB,CAAC,CAAC;AAE3D,MAAM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CACN,CAAC;oBAEF,OAAO;wBACL,QAAQ,EAAE,eAAe;wBACzB,MAAM;qBACP,CAAC;gBACJ,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,4CAA4C;oBAC5C,OAAO;wBACL,QAAQ,EAAE,EAAE;wBACZ,MAAM,EAAE,IAAI;qBACb,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,11 +0,0 @@
1
- import { BaseBuilder } from './base-builder.js';
2
- export declare class NextBuilder extends BaseBuilder {
3
- build(): Promise<void>;
4
- protected getInputFiles(): Promise<string[]>;
5
- private writeFunctionsConfig;
6
- private buildStepsFunction;
7
- private buildWorkflowsFunction;
8
- private buildWebhookRoute;
9
- private findAppDirectory;
10
- }
11
- //# sourceMappingURL=next-build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-build.d.ts","sourceRoot":"","sources":["../../../src/lib/builders/next-build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,WAAW;IACpC,KAAK;cAsTK,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YAUpC,oBAAoB;YAyCpB,kBAAkB;YA6BlB,sBAAsB;YA0BtB,iBAAiB;YAejB,gBAAgB;CA0B/B"}