@@ -9,10 +9,10 @@ use anyhow::{Context, Result};
9
9
use futures_util:: { StreamExt , TryStreamExt } ;
10
10
use next_api:: {
11
11
project:: { ProjectContainer , ProjectOptions } ,
12
- route:: { endpoint_write_to_disk, Route } ,
12
+ route:: { endpoint_write_to_disk, Endpoint , EndpointOutputPaths , Route } ,
13
13
} ;
14
14
use turbo_rcstr:: RcStr ;
15
- use turbo_tasks:: { ReadConsistency , TransientInstance , TurboTasks , Vc } ;
15
+ use turbo_tasks:: { get_effects , ReadConsistency , ResolvedVc , TransientInstance , TurboTasks , Vc } ;
16
16
use turbo_tasks_backend:: { NoopBackingStorage , TurboTasksBackend } ;
17
17
use turbo_tasks_malloc:: TurboMalloc ;
18
18
@@ -185,21 +185,21 @@ pub async fn render_routes(
185
185
html_endpoint,
186
186
data_endpoint : _,
187
187
} => {
188
- endpoint_write_to_disk ( * html_endpoint) . await ?;
188
+ endpoint_write_to_disk_with_effects ( * html_endpoint) . await ?;
189
189
}
190
190
Route :: PageApi { endpoint } => {
191
- endpoint_write_to_disk ( * endpoint) . await ?;
191
+ endpoint_write_to_disk_with_effects ( * endpoint) . await ?;
192
192
}
193
193
Route :: AppPage ( routes) => {
194
194
for route in routes {
195
- endpoint_write_to_disk ( * route. html_endpoint ) . await ?;
195
+ endpoint_write_to_disk_with_effects ( * route. html_endpoint ) . await ?;
196
196
}
197
197
}
198
198
Route :: AppRoute {
199
199
original_name : _,
200
200
endpoint,
201
201
} => {
202
- endpoint_write_to_disk ( * endpoint) . await ?;
202
+ endpoint_write_to_disk_with_effects ( * endpoint) . await ?;
203
203
}
204
204
Route :: Conflict => {
205
205
tracing:: info!( "WARN: conflict {}" , name) ;
@@ -242,6 +242,23 @@ pub async fn render_routes(
242
242
Ok ( stream. len ( ) )
243
243
}
244
244
245
+ #[ turbo_tasks:: function]
246
+ async fn endpoint_write_to_disk_with_effects (
247
+ endpoint : ResolvedVc < Box < dyn Endpoint > > ,
248
+ ) -> Result < Vc < EndpointOutputPaths > > {
249
+ let op = endpoint_write_to_disk_operation ( endpoint) ;
250
+ let result = op. resolve_strongly_consistent ( ) . await ?;
251
+ get_effects ( op) . await ?. apply ( ) . await ?;
252
+ Ok ( * result)
253
+ }
254
+
255
+ #[ turbo_tasks:: function( operation) ]
256
+ pub fn endpoint_write_to_disk_operation (
257
+ endpoint : ResolvedVc < Box < dyn Endpoint > > ,
258
+ ) -> Vc < EndpointOutputPaths > {
259
+ endpoint_write_to_disk ( * endpoint)
260
+ }
261
+
245
262
async fn hmr (
246
263
tt : & TurboTasks < TurboTasksBackend < NoopBackingStorage > > ,
247
264
project : Vc < ProjectContainer > ,
0 commit comments