From a71411bce2e47479dbcf716714a584778cae9b91 Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Mon, 30 Oct 2023 19:47:59 +1100 Subject: [PATCH] fix(server-runtime): mark critical CSS arg private (#7814) --- packages/remix-dev/vite/node/adapter.ts | 2 +- packages/remix-server-runtime/server.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/remix-dev/vite/node/adapter.ts b/packages/remix-dev/vite/node/adapter.ts index 5f6effdfeef..f3a081c22c7 100644 --- a/packages/remix-dev/vite/node/adapter.ts +++ b/packages/remix-dev/vite/node/adapter.ts @@ -199,7 +199,7 @@ export let createRequestHandler = ( let handler = createBaseRequestHandler(build, mode); return async (req: IncomingMessage, res: ServerResponse) => { let request = createRequest(req); - let response = await handler(request, {}, { criticalCss }); + let response = await handler(request, {}, { __criticalCss: criticalCss }); handleNodeResponse(response, res); }; }; diff --git a/packages/remix-server-runtime/server.ts b/packages/remix-server-runtime/server.ts index c49b28b721e..471047a43b1 100644 --- a/packages/remix-server-runtime/server.ts +++ b/packages/remix-server-runtime/server.ts @@ -32,7 +32,12 @@ import { createServerHandoffString } from "./serverHandoff"; export type RequestHandler = ( request: Request, loadContext?: AppLoadContext, - args?: { criticalCss?: string } + args?: { + /** + * @private This is an internal API intended for use by the Remix Vite plugin in dev mode + */ + __criticalCss?: string; + } ) => Promise; export type CreateRequestHandlerFunction = ( @@ -78,7 +83,7 @@ export const createRequestHandler: CreateRequestHandlerFunction = ( return async function requestHandler( request, loadContext = {}, - { criticalCss } = {} + { __criticalCss: criticalCss } = {} ) { _build = typeof build === "function" ? await build() : build; if (typeof build === "function") {