MCPcopy Index your code
hub / github.com/solidjs/solid-start / createPageEvent

Function createPageEvent

packages/start/src/server/handler.ts:144–178  ·  view source on GitHub ↗
(ctx: FetchEvent)

Source from the content-addressed store, hash-verified

142}
143
144export 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
180function initFromFlash(ctx: FetchEvent) {
181 const flash = getCookie(ctx.nativeEvent, "flash");

Callers 2

handleSingleFlightFunction · 0.90
createBaseHandlerFunction · 0.70

Calls 4

getSsrManifestFunction · 0.90
createRoutesFunction · 0.90
initFromFlashFunction · 0.85
getAssetsMethod · 0.80

Tested by

no test coverage detected