@@ -77,12 +77,12 @@ async function analyse({ manifest_path, manifest_data, env }) {
7777 /** @type {(import('types').HttpMethod | '*')[] } */
7878 const api_methods = [ ] ;
7979
80- /** @type {import('types').PrerenderOption | undefined } */
81- let prerender = undefined ;
82- /** @type {any } */
83- let config = undefined ;
84- /** @type {import('types').PrerenderEntryGenerator | undefined } */
85- let entries = undefined ;
80+ /** @type {{ endpoint?: import('types').PrerenderOption, page?: import('types').PrerenderOption } } */
81+ const prerender_option = { } ;
82+ /** @type {{ endpoint?: unknown, page?: unknown } } */
83+ const config_option = { } ;
84+ /** @type {{ endpoint?: import('types').PrerenderEntryGenerator | undefined, page?: import('types').PrerenderEntryGenerator | undefined } } */
85+ const entries_option = { } ;
8686
8787 if ( route . endpoint ) {
8888 const mod = await route . endpoint ( ) ;
@@ -98,7 +98,7 @@ async function analyse({ manifest_path, manifest_data, env }) {
9898 ) ;
9999 }
100100
101- prerender = mod . prerender ;
101+ prerender_option . endpoint = mod . prerender ;
102102 }
103103
104104 Object . values ( mod ) . forEach ( ( /** @type {import('types').HttpMethod } */ method ) => {
@@ -109,8 +109,8 @@ async function analyse({ manifest_path, manifest_data, env }) {
109109 }
110110 } ) ;
111111
112- config = mod . config ;
113- entries = mod . entries ;
112+ config_option . endpoint = mod . config ;
113+ entries_option . endpoint = mod . entries ;
114114 }
115115
116116 if ( route . page ) {
@@ -138,13 +138,17 @@ async function analyse({ manifest_path, manifest_data, env }) {
138138 validate_page_exports ( page . universal , page . universal_id ) ;
139139 }
140140
141- prerender = get_option ( nodes , 'prerender' ) ?? prerender ?? false ;
141+ prerender_option . page = get_option ( nodes , 'prerender' ) ;
142142
143- config = get_config ( nodes ) ;
144- entries = get_option ( nodes , 'entries' ) ?? entries ;
143+ config_option . page = get_config ( nodes ) ;
144+ entries_option . page = get_option ( nodes , 'entries' ) ;
145145 }
146146
147- if ( prerender && route . endpoint && route . page ) {
147+ const prerender = prerender_option . page ?? prerender_option . endpoint ?? false ;
148+ const config = config_option . page ?? entries_option . endpoint ;
149+ const entries = entries_option . page ?? entries_option . endpoint ;
150+
151+ if ( prerender === true && route . endpoint && route . page ) {
148152 const page = /** @type {string } */ (
149153 route_data . leaf ?. component ?? route_data . leaf ?. universal ?? route_data . leaf ?. server
150154 ) ;
0 commit comments