(ctx: FetchEvent)
| 142 | } |
| 143 | |
| 144 | export async function createPageEvent(ctx: FetchEvent) { |
| 145 | ctx.response.headers.set("Content-Type", "text/html"); |
| 146 | // const prevPath = ctx.request.headers.get("x-solid-referrer"); |
| 147 | // const mutation = ctx.request.headers.get("x-solid-mutation") === "true"; |
| 148 | const manifest = getSsrManifest(import.meta.env.SSR && import.meta.env.DEV ? "ssr" : "client"); |
| 149 | |
| 150 | // Handle Vite build.cssCodeSplit |
| 151 | // When build.cssCodeSplit is false, a single CSS file is generated with the key style.css |
| 152 | const mergedCSS = import.meta.env.PROD ? await manifest.getAssets("style.css") : []; |
| 153 | |
| 154 | const assets = [ |
| 155 | ...mergedCSS, |
| 156 | ...(await manifest.getAssets(import.meta.env.START_CLIENT_ENTRY)), |
| 157 | ...(await manifest.getAssets(import.meta.env.START_APP_ENTRY)), |
| 158 | // ...(import.meta.env.START_ISLANDS |
| 159 | // ? (await serverManifest.inputs[serverManifest.handler]!.assets()).filter( |
| 160 | // s => (s as any).attrs.rel !== "modulepreload" |
| 161 | // ) |
| 162 | // : []) |
| 163 | ]; |
| 164 | const pageEvent: PageEvent = Object.assign(ctx, { |
| 165 | assets, |
| 166 | router: { |
| 167 | submission: initFromFlash(ctx) as any, |
| 168 | }, |
| 169 | routes: createRoutes(), |
| 170 | // prevUrl: prevPath || "", |
| 171 | // mutation: mutation, |
| 172 | // $type: FETCH_EVENT, |
| 173 | complete: false, |
| 174 | $islands: new Set<string>(), |
| 175 | }); |
| 176 | |
| 177 | return pageEvent; |
| 178 | } |
| 179 | |
| 180 | function initFromFlash(ctx: FetchEvent) { |
| 181 | const flash = getCookie(ctx.nativeEvent, "flash"); |
no test coverage detected