@@ -68,8 +68,6 @@ const resolveDiscoveryProjectMock = vi.fn(async (appRoot: string) => ({
6868 layout : "nested" as const ,
6969} ) ) ;
7070const runVercelBuildPrewarmMock = vi . fn ( async ( ) => undefined ) ;
71- const workflowBuilderBuildVercelOutputMock = vi . fn ( async ( _options : unknown ) => undefined ) ;
72- const workflowBuilderConstructors : unknown [ ] = [ ] ;
7371
7472vi . mock ( "nitro/builder" , ( ) => ( {
7573 build : buildNitroMock ,
@@ -94,18 +92,6 @@ vi.mock("./vercel-build-prewarm.js", () => ({
9492 runVercelBuildPrewarm : runVercelBuildPrewarmMock ,
9593} ) ) ;
9694
97- vi . mock ( "../../workflow-bundle/builder.js" , ( ) => ( {
98- WorkflowBundleBuilder : class WorkflowBundleBuilder {
99- constructor ( options : unknown ) {
100- workflowBuilderConstructors . push ( options ) ;
101- }
102-
103- async buildVercelOutput ( options : unknown ) : Promise < void > {
104- await workflowBuilderBuildVercelOutputMock ( options ) ;
105- }
106- } ,
107- } ) ) ;
108-
10995const createScratchDirectory = useTemporaryDirectories ( ) ;
11096const DEPLOYABLE_BUILD_OPTIONS = { skipVercelSandboxPrewarm : false } as const ;
11197
@@ -177,7 +163,6 @@ describe("buildApplication", () => {
177163 beforeEach ( ( ) => {
178164 vi . resetModules ( ) ;
179165 vi . clearAllMocks ( ) ;
180- workflowBuilderConstructors . length = 0 ;
181166 } ) ;
182167
183168 afterEach ( ( ) => {
@@ -223,7 +208,6 @@ describe("buildApplication", () => {
223208 2 ,
224209 ) } \n`,
225210 ) ;
226- expect ( workflowBuilderBuildVercelOutputMock ) . not . toHaveBeenCalled ( ) ;
227211 expect ( runVercelBuildPrewarmMock ) . not . toHaveBeenCalled ( ) ;
228212 await expect (
229213 readFile ( join ( appRoot , ".eve" , "compile" , "compiled-agent-manifest.json" ) , "utf8" ) ,
@@ -265,7 +249,7 @@ describe("buildApplication", () => {
265249 expect ( profile . phases ) . toEqual (
266250 expect . arrayContaining ( [
267251 expect . objectContaining ( { name : "host.prepare" } ) ,
268- expect . objectContaining ( { name : "nitro.all. bundle" } ) ,
252+ expect . objectContaining ( { name : "nitro.bundle" } ) ,
269253 expect . objectContaining ( { name : "output.publish" } ) ,
270254 expect . objectContaining ( { name : "workspace.remove" } ) ,
271255 ] ) ,
@@ -384,27 +368,17 @@ describe("buildApplication", () => {
384368 await expect ( readFile ( summaryPath , "utf8" ) ) . resolves . toBe ( "last-good-summary\n" ) ;
385369 } ) ;
386370
387- it ( "builds isolated Vercel Nitro surfaces and stitches workflow functions" , async ( ) => {
371+ it ( "builds one Vercel Nitro output and normalizes eve functions" , async ( ) => {
388372 vi . stubEnv ( "VERCEL" , "1" ) ;
389373 const appRoot = await createScratchDirectory ( "eve-build-application-vercel-" ) ;
390374 const profilePath = join ( appRoot , ".eve" , "profiles" , "vercel-build.json" ) ;
391- const stableFlowOutputDir = join ( appRoot , ".eve" , "nitro-output" , "flow" ) ;
392- const staleFlowOutputPath = join ( stableFlowOutputDir , "stale-flow.txt" ) ;
393375
394376 prepareProductionApplicationHostMock . mockImplementationOnce ( prepareHostBuildWorkspace ) ;
395377 createProductionApplicationNitroMock . mockImplementation (
396378 async ( _preparedHost : PreparedApplicationHost , options : { outputDir : string } ) =>
397379 createNitroStub ( options . outputDir ) ,
398380 ) ;
399- await mkdir ( stableFlowOutputDir , { recursive : true } ) ;
400- await Promise . all ( [
401- writeFile (
402- join ( stableFlowOutputDir , "eve-cache.json" ) ,
403- `${ JSON . stringify ( { eveVersion : "old" } ) } \n` ,
404- ) ,
405- writeFile ( staleFlowOutputPath , "stale\n" ) ,
406- mkdir ( join ( appRoot , ".vercel" , "output" ) , { recursive : true } ) ,
407- ] ) ;
381+ await mkdir ( join ( appRoot , ".vercel" , "output" ) , { recursive : true } ) ;
408382 await writeFile (
409383 join ( appRoot , ".vercel" , "output" , "config.json" ) ,
410384 `${ JSON . stringify (
@@ -437,20 +411,14 @@ describe("buildApplication", () => {
437411 } ) ;
438412
439413 expect ( outputDir ) . toBe ( join ( appRoot , ".vercel" , "output" ) ) ;
440- expect ( createProductionApplicationNitroMock ) . toHaveBeenCalledTimes ( 2 ) ;
441- expect ( createProductionApplicationNitroMock . mock . calls . map ( ( call ) => call [ 1 ] ?. surface ) ) . toEqual (
442- [ "app" , "flow" ] ,
443- ) ;
444- const flowOutputDir = createProductionApplicationNitroMock . mock . calls . find (
445- ( call ) => call [ 1 ] ?. surface === "flow" ,
446- ) ?. [ 1 ] ?. outputDir ;
447- expect ( flowOutputDir ) . toEqual ( expect . stringContaining ( join ( appRoot , ".eve" , "builds" ) ) ) ;
448- expect ( workflowBuilderConstructors ) . toHaveLength ( 1 ) ;
449- expect ( workflowBuilderBuildVercelOutputMock ) . toHaveBeenCalledWith ( {
450- flowNitroOutputDir : flowOutputDir ,
451- outputDir : expect . stringContaining ( join ( appRoot , ".eve" , "builds" ) ) ,
452- runtime : "nodejs24.x" ,
453- } ) ;
414+ expect ( createProductionApplicationNitroMock ) . toHaveBeenCalledTimes ( 1 ) ;
415+ expect ( createProductionApplicationNitroMock ) . toHaveBeenCalledWith (
416+ expect . objectContaining ( { appRoot } ) ,
417+ {
418+ buildDir : expect . stringContaining ( join ( appRoot , ".eve" , "builds" ) ) ,
419+ outputDir : expect . stringContaining ( join ( appRoot , ".eve" , "builds" ) ) ,
420+ } ,
421+ ) ;
454422 const nestedFunctionStats = await lstat (
455423 join ( appRoot , ".vercel" , "output" , "functions" , "eve" , "v1" , "health.func" ) ,
456424 ) ;
@@ -491,7 +459,6 @@ describe("buildApplication", () => {
491459 src : "^/eve/v1/session/(?<sessionId>[^/]+)/stream$" ,
492460 } ,
493461 ] ) ;
494- await expect ( readFile ( staleFlowOutputPath , "utf8" ) ) . resolves . toBe ( "stale\n" ) ;
495462 expect ( runVercelBuildPrewarmMock ) . toHaveBeenCalledWith (
496463 expect . objectContaining ( {
497464 appRoot,
@@ -533,20 +500,18 @@ describe("buildApplication", () => {
533500
534501 expect ( outputDir ) . toBe ( join ( appRoot , ".vercel" , "output" ) ) ;
535502 expect ( runVercelBuildPrewarmMock ) . not . toHaveBeenCalled ( ) ;
536- expect ( workflowBuilderBuildVercelOutputMock ) . toHaveBeenCalledTimes ( 1 ) ;
503+ expect ( buildNitroMock ) . toHaveBeenCalledTimes ( 1 ) ;
537504 } ) ;
538505
539506 it ( "normalizes eve function output behind a non-Next host service" , async ( ) => {
540507 vi . stubEnv ( "VERCEL" , "1" ) ;
541508 const appRoot = await createScratchDirectory ( "eve-build-application-vercel-nuxt-" ) ;
542- const flowOutputDir = join ( appRoot , ".eve" , "nitro-output" , "flow" ) ;
543509
544510 prepareProductionApplicationHostMock . mockImplementationOnce ( prepareHostBuildWorkspace ) ;
545511 createProductionApplicationNitroMock . mockImplementation (
546512 async ( _preparedHost : PreparedApplicationHost , options : { outputDir : string } ) =>
547513 createNitroStub ( options . outputDir ) ,
548514 ) ;
549- await mkdir ( flowOutputDir , { recursive : true } ) ;
550515 await writeFile (
551516 join ( appRoot , "vercel.json" ) ,
552517 `${ JSON . stringify (
@@ -705,40 +670,36 @@ describe("buildApplication", () => {
705670 } ) ;
706671 } ) ;
707672
708- it ( "builds isolated Vercel Nitro surfaces from legacy root service config" , async ( ) => {
673+ it ( "normalizes eve function output from legacy root service config" , async ( ) => {
709674 vi . stubEnv ( "VERCEL" , "1" ) ;
710675 const appRoot = await createScratchDirectory ( "eve-build-application-vercel-root-config-" ) ;
711- const flowOutputDir = join ( appRoot , ".eve" , "nitro-output" , "flow" ) ;
712676
713677 prepareProductionApplicationHostMock . mockImplementationOnce ( prepareHostBuildWorkspace ) ;
714678 createProductionApplicationNitroMock . mockImplementation (
715679 async ( _preparedHost : PreparedApplicationHost , options : { outputDir : string } ) =>
716680 createNitroStub ( options . outputDir ) ,
717681 ) ;
718- await Promise . all ( [
719- mkdir ( flowOutputDir , { recursive : true } ) ,
720- writeFile (
721- join ( appRoot , "vercel.json" ) ,
722- `${ JSON . stringify (
723- {
724- experimentalServices : {
725- eve : {
726- entrypoint : "." ,
727- framework : "eve" ,
728- routePrefix : "/_eve_internal/eve" ,
729- } ,
730- web : {
731- entrypoint : "." ,
732- framework : "nextjs" ,
733- routePrefix : "/" ,
734- } ,
682+ await writeFile (
683+ join ( appRoot , "vercel.json" ) ,
684+ `${ JSON . stringify (
685+ {
686+ experimentalServices : {
687+ eve : {
688+ entrypoint : "." ,
689+ framework : "eve" ,
690+ routePrefix : "/_eve_internal/eve" ,
691+ } ,
692+ web : {
693+ entrypoint : "." ,
694+ framework : "nextjs" ,
695+ routePrefix : "/" ,
735696 } ,
736697 } ,
737- null ,
738- 2 ,
739- ) } \n` ,
740- ) ,
741- ] ) ;
698+ } ,
699+ null ,
700+ 2 ,
701+ ) } \n` ,
702+ ) ;
742703
743704 const { buildApplication } = await import ( "#internal/nitro/host/build-application.js" ) ;
744705 const outputDir = await buildApplication ( appRoot , DEPLOYABLE_BUILD_OPTIONS ) ;
0 commit comments