@@ -9,15 +9,15 @@ 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
+ use turbo_tasks_backend:: { NoopBackingStorage , TurboTasksBackend } ;
16
17
use turbo_tasks_malloc:: TurboMalloc ;
17
- use turbo_tasks_memory:: MemoryBackend ;
18
18
19
19
pub async fn main_inner (
20
- tt : & TurboTasks < MemoryBackend > ,
20
+ tt : & TurboTasks < TurboTasksBackend < NoopBackingStorage > > ,
21
21
strat : Strategy ,
22
22
factor : usize ,
23
23
limit : usize ,
@@ -158,7 +158,7 @@ pub fn shuffle<'a, T: 'a>(items: impl Iterator<Item = T>) -> impl Iterator<Item
158
158
}
159
159
160
160
pub async fn render_routes (
161
- tt : & TurboTasks < MemoryBackend > ,
161
+ tt : & TurboTasks < TurboTasksBackend < NoopBackingStorage > > ,
162
162
routes : impl Iterator < Item = ( RcStr , Route ) > ,
163
163
strategy : Strategy ,
164
164
factor : usize ,
@@ -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,7 +242,27 @@ pub async fn render_routes(
242
242
Ok ( stream. len ( ) )
243
243
}
244
244
245
- async fn hmr ( tt : & TurboTasks < MemoryBackend > , project : Vc < ProjectContainer > ) -> Result < ( ) > {
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
+
262
+ async fn hmr (
263
+ tt : & TurboTasks < TurboTasksBackend < NoopBackingStorage > > ,
264
+ project : Vc < ProjectContainer > ,
265
+ ) -> Result < ( ) > {
246
266
tracing:: info!( "HMR..." ) ;
247
267
let session = TransientInstance :: new ( ( ) ) ;
248
268
let idents = tt
0 commit comments