@@ -102,14 +102,14 @@ pub async fn get_app_page_entry(
102
102
let file = File :: from ( result. build ( ) ) ;
103
103
let source = VirtualSource :: new ( source. ident ( ) . path ( ) , AssetContent :: file ( file. into ( ) ) ) ;
104
104
105
- let rsc_entry = context. process (
105
+ let mut rsc_entry = context. process (
106
106
Vc :: upcast ( source) ,
107
107
Value :: new ( ReferenceType :: Internal ( Vc :: cell ( inner_assets) ) ) ,
108
108
) ;
109
109
110
110
if is_edge {
111
- todo ! ( "edge pages are not supported yet" )
112
- }
111
+ rsc_entry = wrap_edge_entry ( context , project_root , rsc_entry ) . await ? ;
112
+ } ;
113
113
114
114
let Some ( rsc_entry) =
115
115
Vc :: try_resolve_downcast :: < Box < dyn EcmascriptChunkPlaceable > > ( rsc_entry) . await ?
@@ -125,3 +125,30 @@ pub async fn get_app_page_entry(
125
125
}
126
126
. cell ( ) )
127
127
}
128
+
129
+ async fn wrap_edge_entry (
130
+ context : Vc < ModuleAssetContext > ,
131
+ project_root : Vc < FileSystemPath > ,
132
+ entry : Vc < Box < dyn Module > > ,
133
+ ) -> Result < Vc < Box < dyn Module > > > {
134
+ const INNER : & str = "INNER_RSC_ENTRY" ;
135
+
136
+ let source = load_next_js_template (
137
+ "edge-app-route.js" ,
138
+ project_root,
139
+ indexmap ! {
140
+ "VAR_USERLAND" => INNER . to_string( ) ,
141
+ } ,
142
+ indexmap ! { } ,
143
+ )
144
+ . await ?;
145
+
146
+ let inner_assets = indexmap ! {
147
+ INNER . to_string( ) => entry
148
+ } ;
149
+
150
+ Ok ( context. process (
151
+ Vc :: upcast ( source) ,
152
+ Value :: new ( ReferenceType :: Internal ( Vc :: cell ( inner_assets) ) ) ,
153
+ ) )
154
+ }
0 commit comments