Add lazy workflow and step discovery in Next.js#640
Conversation
🦋 Changeset detectedLatest commit: 60eaeb3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🪟 Windows (27 failed)nextjs-turbopack (27 failed):
🌍 Community Worlds (11 failed)mongodb (1 failed):
redis (1 failed):
starter (8 failed):
turso (1 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
❌ 🪟 Windows
❌ 🌍 Community Worlds
|
| dirs: ['.'], // Different apps that use nitro have different directories | ||
| }), | ||
| buildTarget: 'next', // Placeholder, not actually used | ||
| buildTarget: 'nitro' as any, // Placeholder, not actually used |
| */ | ||
| // Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning. | ||
| // The workflow builder injects this as a builtin module available in the workflow runtime sandbox. | ||
| export * from '../stdlib.js'; |
There was a problem hiding this comment.
jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?
There was a problem hiding this comment.
Those will this one is just special since it's implicit not explicit/imported directly by the user.
There was a problem hiding this comment.
stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.
There was a problem hiding this comment.
Ah ya seems fine without it so must have only been needed from different issue early on in this PR.
@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore. |
This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.
closes: #523
closes: #469