@@ -14,38 +14,35 @@ pub async fn compute_export_usage_info(
14
14
) -> Result < Vc < ExportUsageInfo > > {
15
15
let mut used_exports = FxHashMap :: < _ , ModuleExportUsageInfo > :: default ( ) ;
16
16
let graph = graph. read_graphs ( ) . await ?;
17
- graph
18
- . traverse_all_edges_unordered ( |( _, ref_data) , target| {
19
- let e = used_exports. entry ( target. module ) . or_default ( ) ;
17
+ graph. traverse_all_edges_unordered ( |( _, ref_data) , target| {
18
+ let e = used_exports. entry ( target. module ) . or_default ( ) ;
20
19
21
- e. add ( & ref_data. export ) ;
20
+ e. add ( & ref_data. export ) ;
21
+
22
+ Ok ( ( ) )
23
+ } ) ?;
22
24
23
- Ok ( ( ) )
24
- } )
25
- . await ?;
26
25
// Compute cycles and select modules to be 'circuit breakers'
27
26
// A circuit breaker module will need to eagerly export lazy getters for its exports to break an
28
27
// evaluation cycle all other modules can export values after defining them
29
28
let mut circuit_breakers = FxHashSet :: default ( ) ;
30
- graph
31
- . traverse_cycles (
32
- |e| e. chunking_type . is_parallel ( ) ,
33
- |cycle| {
34
- // To break cycles we need to ensure that no importing module can observe a
35
- // partially populated exports object.
36
-
37
- // We could compute this based on the module graph via a DFS from each entry point
38
- // to the cycle. Whatever node is hit first is an entry point to the cycle.
39
- // (scope hoisting does something similar) and then we would only need to
40
- // mark 'entry' modules (basically the targets of back edges in the export graph) as
41
- // circuit breakers. For now we just mark everything on the theory that cycles are
42
- // rare. For vercel-site on 8/22/2025 there were 106 cycles covering 800 modules
43
- // (or 1.2% of all modules). So with this analysis we could potentially drop 80% of
44
- // the cycle breaker modules.
45
- circuit_breakers. extend ( cycle. iter ( ) . map ( |n| n. module ) ) ;
46
- } ,
47
- )
48
- . await ?;
29
+ graph. traverse_cycles (
30
+ |e| e. chunking_type . is_parallel ( ) ,
31
+ |cycle| {
32
+ // To break cycles we need to ensure that no importing module can observe a
33
+ // partially populated exports object.
34
+
35
+ // We could compute this based on the module graph via a DFS from each entry point
36
+ // to the cycle. Whatever node is hit first is an entry point to the cycle.
37
+ // (scope hoisting does something similar) and then we would only need to
38
+ // mark 'entry' modules (basically the targets of back edges in the export graph) as
39
+ // circuit breakers. For now we just mark everything on the theory that cycles are
40
+ // rare. For vercel-site on 8/22/2025 there were 106 cycles covering 800 modules
41
+ // (or 1.2% of all modules). So with this analysis we could potentially drop 80% of
42
+ // the cycle breaker modules.
43
+ circuit_breakers. extend ( cycle. iter ( ) . map ( |n| n. module ) ) ;
44
+ } ,
45
+ ) ?;
49
46
50
47
Ok ( ExportUsageInfo {
51
48
used_exports,
0 commit comments