@remix-run/server-runtime
Advanced tools
Comparing version 0.0.0-nightly-96b05af-20230816 to 0.0.0-nightly-96ba8a25c-20240717
@@ -1,2 +0,2 @@ | ||
import type { DataFunctionArgs } from "./routeModules"; | ||
import type { ActionFunctionArgs, LoaderFunctionArgs } from "./routeModules"; | ||
import type { AssetsManifest, EntryContext, FutureConfig } from "./entry"; | ||
@@ -15,5 +15,7 @@ import type { ServerRouteManifest } from "./routes"; | ||
assets: AssetsManifest; | ||
basename?: string; | ||
publicPath: string; | ||
assetsBuildDirectory: string; | ||
future: FutureConfig; | ||
isSpaMode: boolean; | ||
} | ||
@@ -24,6 +26,6 @@ export interface HandleDocumentRequestFunction { | ||
export interface HandleDataRequestFunction { | ||
(response: Response, args: DataFunctionArgs): Promise<Response> | Response; | ||
(response: Response, args: LoaderFunctionArgs | ActionFunctionArgs): Promise<Response> | Response; | ||
} | ||
export interface HandleErrorFunction { | ||
(error: unknown, args: DataFunctionArgs): void; | ||
(error: unknown, args: LoaderFunctionArgs | ActionFunctionArgs): void; | ||
} | ||
@@ -38,2 +40,3 @@ /** | ||
handleError?: HandleErrorFunction; | ||
streamTimeout?: number; | ||
} |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
@@ -1,5 +0,8 @@ | ||
import type { ActionFunction, DataFunctionArgs, LoaderFunction } from "./routeModules"; | ||
import type { ActionFunction, ActionFunctionArgs, LoaderFunction, LoaderFunctionArgs } from "./routeModules"; | ||
import type { ResponseStub } from "./single-fetch"; | ||
/** | ||
* An object of unknown type for route loaders and actions provided by the | ||
* server's `getLoadContext()` function. | ||
* server's `getLoadContext()` function. This is defined as an empty interface | ||
* specifically so apps can leverage declaration merging to augment this type | ||
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html | ||
*/ | ||
@@ -11,19 +14,21 @@ export interface AppLoadContext { | ||
* Data for a route that was returned from a `loader()`. | ||
* | ||
* Note: This moves to unknown in ReactRouter and eventually likely in Remix | ||
*/ | ||
export type AppData = any; | ||
export declare function callRouteActionRR({ loadContext, action, params, request, routeId, }: { | ||
export type AppData = unknown; | ||
export declare function callRouteAction({ loadContext, action, params, request, routeId, singleFetch, response, }: { | ||
request: Request; | ||
action: ActionFunction; | ||
params: DataFunctionArgs["params"]; | ||
params: ActionFunctionArgs["params"]; | ||
loadContext: AppLoadContext; | ||
routeId: string; | ||
}): Promise<Response>; | ||
export declare function callRouteLoaderRR({ loadContext, loader, params, request, routeId, }: { | ||
singleFetch: boolean; | ||
response?: ResponseStub; | ||
}): Promise<{} | Response | null>; | ||
export declare function callRouteLoader({ loadContext, loader, params, request, routeId, singleFetch, response, }: { | ||
request: Request; | ||
loader: LoaderFunction; | ||
params: DataFunctionArgs["params"]; | ||
params: LoaderFunctionArgs["params"]; | ||
loadContext: AppLoadContext; | ||
routeId: string; | ||
}): Promise<import("@remix-run/router").UNSAFE_DeferredData | Response>; | ||
singleFetch: boolean; | ||
response?: ResponseStub; | ||
}): Promise<{} | Response | null>; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -19,3 +19,5 @@ * Copyright (c) Remix Software Inc. | ||
* An object of unknown type for route loaders and actions provided by the | ||
* server's `getLoadContext()` function. | ||
* server's `getLoadContext()` function. This is defined as an empty interface | ||
* specifically so apps can leverage declaration merging to augment this type | ||
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html | ||
*/ | ||
@@ -25,7 +27,5 @@ | ||
* Data for a route that was returned from a `loader()`. | ||
* | ||
* Note: This moves to unknown in ReactRouter and eventually likely in Remix | ||
*/ | ||
async function callRouteActionRR({ | ||
async function callRouteAction({ | ||
loadContext, | ||
@@ -35,3 +35,5 @@ action, | ||
request, | ||
routeId | ||
routeId, | ||
singleFetch, | ||
response | ||
}) { | ||
@@ -41,3 +43,8 @@ let result = await action({ | ||
context: loadContext, | ||
params | ||
params, | ||
// Only provided when single fetch is enabled, and made available via | ||
// `defineAction` types, not `ActionFunctionArgs` | ||
...(singleFetch ? { | ||
response | ||
} : null) | ||
}); | ||
@@ -47,5 +54,10 @@ if (result === undefined) { | ||
} | ||
// Allow naked object returns when single fetch is enabled | ||
if (singleFetch) { | ||
return result; | ||
} | ||
return responses.isResponse(result) ? result : responses.json(result); | ||
} | ||
async function callRouteLoaderRR({ | ||
async function callRouteLoader({ | ||
loadContext, | ||
@@ -55,3 +67,5 @@ loader, | ||
request, | ||
routeId | ||
routeId, | ||
singleFetch, | ||
response | ||
}) { | ||
@@ -61,3 +75,8 @@ let result = await loader({ | ||
context: loadContext, | ||
params | ||
params, | ||
// Only provided when single fetch is enabled, and made available via | ||
// `defineLoader` types, not `LoaderFunctionArgs` | ||
...(singleFetch ? { | ||
response | ||
} : null) | ||
}); | ||
@@ -73,2 +92,7 @@ if (result === undefined) { | ||
} | ||
// Allow naked object returns when single fetch is enabled | ||
if (singleFetch) { | ||
return result; | ||
} | ||
return responses.isResponse(result) ? result : responses.json(result); | ||
@@ -95,3 +119,12 @@ } | ||
} | ||
return new Request(url.href, request); | ||
let init = { | ||
method: request.method, | ||
body: request.body, | ||
headers: request.headers, | ||
signal: request.signal | ||
}; | ||
if (init.body) { | ||
init.duplex = "half"; | ||
} | ||
return new Request(url.href, init); | ||
} | ||
@@ -101,6 +134,15 @@ function stripDataParam(request) { | ||
url.searchParams.delete("_data"); | ||
return new Request(url.href, request); | ||
let init = { | ||
method: request.method, | ||
body: request.body, | ||
headers: request.headers, | ||
signal: request.signal | ||
}; | ||
if (init.body) { | ||
init.duplex = "half"; | ||
} | ||
return new Request(url.href, init); | ||
} | ||
exports.callRouteActionRR = callRouteActionRR; | ||
exports.callRouteLoaderRR = callRouteLoaderRR; | ||
exports.callRouteAction = callRouteAction; | ||
exports.callRouteLoader = callRouteLoader; |
import type { ServerBuild } from "./build"; | ||
export declare function broadcastDevReady(build: ServerBuild, origin?: string): Promise<void>; | ||
export declare function logDevReady(build: ServerBuild): void; | ||
type DevServerHooks = { | ||
getCriticalCss?: (build: ServerBuild, pathname: string) => Promise<string | undefined>; | ||
processRequestError?: (error: unknown) => void; | ||
}; | ||
export declare function setDevServerHooks(devServerHooks: DevServerHooks): void; | ||
export declare function getDevServerHooks(): DevServerHooks | undefined; | ||
export {}; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -40,4 +40,15 @@ * Copyright (c) Remix Software Inc. | ||
} | ||
const globalDevServerHooksKey = "__remix_devServerHooks"; | ||
function setDevServerHooks(devServerHooks) { | ||
// @ts-expect-error | ||
globalThis[globalDevServerHooksKey] = devServerHooks; | ||
} | ||
function getDevServerHooks() { | ||
// @ts-expect-error | ||
return globalThis[globalDevServerHooksKey]; | ||
} | ||
exports.broadcastDevReady = broadcastDevReady; | ||
exports.getDevServerHooks = getDevServerHooks; | ||
exports.logDevReady = logDevReady; | ||
exports.setDevServerHooks = setDevServerHooks; |
@@ -8,8 +8,26 @@ import type { StaticHandlerContext } from "@remix-run/router"; | ||
routeModules: RouteModules<EntryRouteModule>; | ||
criticalCss?: string; | ||
serverHandoffString?: string; | ||
serverHandoffStream?: ReadableStream<Uint8Array>; | ||
renderMeta?: { | ||
didRenderScripts?: boolean; | ||
streamCache?: Record<number, Promise<void> & { | ||
result?: { | ||
done: boolean; | ||
value: string; | ||
}; | ||
error?: unknown; | ||
}>; | ||
}; | ||
staticHandlerContext: StaticHandlerContext; | ||
future: FutureConfig; | ||
isSpaMode: boolean; | ||
serializeError(error: Error): SerializedError; | ||
} | ||
export interface FutureConfig { | ||
v3_fetcherPersist: boolean; | ||
v3_relativeSplatPath: boolean; | ||
v3_throwAbortReason: boolean; | ||
unstable_fogOfWar: boolean; | ||
unstable_singleFetch: boolean; | ||
} | ||
@@ -16,0 +34,0 @@ export interface AssetsManifest { |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -78,2 +78,3 @@ * Copyright (c) Remix Software Inc. | ||
// https://github.com/microsoft/TypeScript/issues/15300 | ||
function serializeError(error, serverMode) { | ||
@@ -80,0 +81,0 @@ let sanitized = sanitizeError(error, serverMode); |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -15,3 +15,5 @@ * Copyright (c) Remix Software Inc. | ||
* An object of unknown type for route loaders and actions provided by the | ||
* server's `getLoadContext()` function. | ||
* server's `getLoadContext()` function. This is defined as an empty interface | ||
* specifically so apps can leverage declaration merging to augment this type | ||
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html | ||
*/ | ||
@@ -21,7 +23,5 @@ | ||
* Data for a route that was returned from a `loader()`. | ||
* | ||
* Note: This moves to unknown in ReactRouter and eventually likely in Remix | ||
*/ | ||
async function callRouteActionRR({ | ||
async function callRouteAction({ | ||
loadContext, | ||
@@ -31,3 +31,5 @@ action, | ||
request, | ||
routeId | ||
routeId, | ||
singleFetch, | ||
response | ||
}) { | ||
@@ -37,3 +39,8 @@ let result = await action({ | ||
context: loadContext, | ||
params | ||
params, | ||
// Only provided when single fetch is enabled, and made available via | ||
// `defineAction` types, not `ActionFunctionArgs` | ||
...(singleFetch ? { | ||
response | ||
} : null) | ||
}); | ||
@@ -43,5 +50,10 @@ if (result === undefined) { | ||
} | ||
// Allow naked object returns when single fetch is enabled | ||
if (singleFetch) { | ||
return result; | ||
} | ||
return isResponse(result) ? result : json(result); | ||
} | ||
async function callRouteLoaderRR({ | ||
async function callRouteLoader({ | ||
loadContext, | ||
@@ -51,3 +63,5 @@ loader, | ||
request, | ||
routeId | ||
routeId, | ||
singleFetch, | ||
response | ||
}) { | ||
@@ -57,3 +71,8 @@ let result = await loader({ | ||
context: loadContext, | ||
params | ||
params, | ||
// Only provided when single fetch is enabled, and made available via | ||
// `defineLoader` types, not `LoaderFunctionArgs` | ||
...(singleFetch ? { | ||
response | ||
} : null) | ||
}); | ||
@@ -69,2 +88,7 @@ if (result === undefined) { | ||
} | ||
// Allow naked object returns when single fetch is enabled | ||
if (singleFetch) { | ||
return result; | ||
} | ||
return isResponse(result) ? result : json(result); | ||
@@ -91,3 +115,12 @@ } | ||
} | ||
return new Request(url.href, request); | ||
let init = { | ||
method: request.method, | ||
body: request.body, | ||
headers: request.headers, | ||
signal: request.signal | ||
}; | ||
if (init.body) { | ||
init.duplex = "half"; | ||
} | ||
return new Request(url.href, init); | ||
} | ||
@@ -97,5 +130,14 @@ function stripDataParam(request) { | ||
url.searchParams.delete("_data"); | ||
return new Request(url.href, request); | ||
let init = { | ||
method: request.method, | ||
body: request.body, | ||
headers: request.headers, | ||
signal: request.signal | ||
}; | ||
if (init.body) { | ||
init.duplex = "half"; | ||
} | ||
return new Request(url.href, init); | ||
} | ||
export { callRouteActionRR, callRouteLoaderRR }; | ||
export { callRouteAction, callRouteLoader }; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -36,3 +36,12 @@ * Copyright (c) Remix Software Inc. | ||
} | ||
const globalDevServerHooksKey = "__remix_devServerHooks"; | ||
function setDevServerHooks(devServerHooks) { | ||
// @ts-expect-error | ||
globalThis[globalDevServerHooksKey] = devServerHooks; | ||
} | ||
function getDevServerHooks() { | ||
// @ts-expect-error | ||
return globalThis[globalDevServerHooksKey]; | ||
} | ||
export { broadcastDevReady, logDevReady }; | ||
export { broadcastDevReady, getDevServerHooks, logDevReady, setDevServerHooks }; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -74,2 +74,3 @@ * Copyright (c) Remix Software Inc. | ||
// https://github.com/microsoft/TypeScript/issues/15300 | ||
function serializeError(error, serverMode) { | ||
@@ -76,0 +77,0 @@ let sanitized = sanitizeError(error, serverMode); |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -13,3 +13,3 @@ * Copyright (c) Remix Software Inc. | ||
function getDocumentHeadersRR(build, context) { | ||
function getDocumentHeaders(build, context) { | ||
let boundaryIdx = context.errors ? context.matches.findIndex(m => context.errors[m.route.id]) : -1; | ||
@@ -91,2 +91,2 @@ let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches; | ||
export { getDocumentHeadersRR }; | ||
export { getDocumentHeaders }; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -14,2 +14,3 @@ * Copyright (c) Remix Software Inc. | ||
export { defer, json, redirect, redirectDocument } from './responses.js'; | ||
export { SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, defineAction as unstable_defineAction, defineLoader as unstable_defineLoader } from './single-fetch.js'; | ||
export { createRequestHandler } from './server.js'; | ||
@@ -21,2 +22,2 @@ export { createSession, createSessionStorageFactory, isSession } from './sessions.js'; | ||
export { MaxPartSizeExceededError } from './upload/errors.js'; | ||
export { broadcastDevReady, logDevReady } from './dev.js'; | ||
export { broadcastDevReady, logDevReady, setDevServerHooks as unstable_setDevServerHooks } from './dev.js'; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -16,2 +16,3 @@ * Copyright (c) Remix Software Inc. | ||
// interfaces must conform to the types they extend | ||
/** | ||
@@ -18,0 +19,0 @@ * This is a shortcut for creating `application/json` responses. Converts `data` |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -13,4 +13,4 @@ * Copyright (c) Remix Software Inc. | ||
function matchServerRoutes(routes, pathname) { | ||
let matches = matchRoutes(routes, pathname); | ||
function matchServerRoutes(routes, pathname, basename) { | ||
let matches = matchRoutes(routes, pathname, basename); | ||
if (!matches) return null; | ||
@@ -17,0 +17,0 @@ return matches.map(match => ({ |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
import { callRouteLoaderRR, callRouteActionRR } from './data.js'; | ||
import { callRouteLoader, callRouteAction } from './data.js'; | ||
@@ -48,3 +48,6 @@ // NOTE: make sure to change the Route in remix-react if you change this | ||
path: route.path, | ||
loader: route.module.loader ? args => callRouteLoaderRR({ | ||
loader: route.module.loader ? | ||
// Need to use RR's version here to permit the optional context even | ||
// though we know it'll always be provided in remix | ||
(args, dataStrategyCtx) => callRouteLoader({ | ||
request: args.request, | ||
@@ -54,5 +57,7 @@ params: args.params, | ||
loader: route.module.loader, | ||
routeId: route.id | ||
routeId: route.id, | ||
singleFetch: future.unstable_singleFetch === true, | ||
response: dataStrategyCtx === null || dataStrategyCtx === void 0 ? void 0 : dataStrategyCtx.response | ||
}) : undefined, | ||
action: route.module.action ? args => callRouteActionRR({ | ||
action: route.module.action ? (args, dataStrategyCtx) => callRouteAction({ | ||
request: args.request, | ||
@@ -62,3 +67,5 @@ params: args.params, | ||
action: route.module.action, | ||
routeId: route.id | ||
routeId: route.id, | ||
singleFetch: future.unstable_singleFetch === true, | ||
response: dataStrategyCtx === null || dataStrategyCtx === void 0 ? void 0 : dataStrategyCtx.response | ||
}) : undefined, | ||
@@ -65,0 +72,0 @@ handle: route.module.handle |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -11,18 +11,28 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
import { createStaticHandler, UNSAFE_DEFERRED_SYMBOL, isRouteErrorResponse, json, getStaticContextFromError } from '@remix-run/router'; | ||
import { UNSAFE_DEFERRED_SYMBOL, isRouteErrorResponse, json as json$1, UNSAFE_ErrorResponseImpl, getStaticContextFromError, stripBasename, createStaticHandler } from '@remix-run/router'; | ||
import { createEntryRouteModules } from './entry.js'; | ||
import { serializeError, sanitizeErrors, serializeErrors } from './errors.js'; | ||
import { getDocumentHeadersRR } from './headers.js'; | ||
import { getDocumentHeaders } from './headers.js'; | ||
import invariant from './invariant.js'; | ||
import { isServerMode, ServerMode } from './mode.js'; | ||
import { ServerMode, isServerMode } from './mode.js'; | ||
import { matchServerRoutes } from './routeMatching.js'; | ||
import { createRoutes, createStaticHandlerDataRoutes } from './routes.js'; | ||
import { isRedirectResponse, createDeferredReadableStream, isResponse } from './responses.js'; | ||
import { isRedirectResponse, json, createDeferredReadableStream, isResponse, isRedirectStatusCode } from './responses.js'; | ||
import { createServerHandoffString } from './serverHandoff.js'; | ||
import { getDevServerHooks } from './dev.js'; | ||
import { getSingleFetchRedirect, encodeViaTurboStream, SINGLE_FETCH_REDIRECT_STATUS, singleFetchAction, singleFetchLoaders, getResponseStubs, getSingleFetchDataStrategy, mergeResponseStubs, isResponseStub, convertResponseStubToErrorResponse, getSingleFetchResourceRouteDataStrategy, ResponseStubOperationsSymbol, SingleFetchRedirectSymbol } from './single-fetch.js'; | ||
import { resourceRouteJsonWarning } from './deprecations.js'; | ||
const createRequestHandler = (build, mode) => { | ||
function derive(build, mode) { | ||
var _build$future, _build$future2; | ||
let routes = createRoutes(build.routes); | ||
let dataRoutes = createStaticHandlerDataRoutes(build.routes, build.future); | ||
let serverMode = isServerMode(mode) ? mode : ServerMode.Production; | ||
let staticHandler = createStaticHandler(dataRoutes); | ||
let staticHandler = createStaticHandler(dataRoutes, { | ||
basename: build.basename, | ||
future: { | ||
v7_relativeSplatPath: ((_build$future = build.future) === null || _build$future === void 0 ? void 0 : _build$future.v3_relativeSplatPath) === true, | ||
v7_throwAbortReason: ((_build$future2 = build.future) === null || _build$future2 === void 0 ? void 0 : _build$future2.v3_throwAbortReason) === true | ||
} | ||
}); | ||
let errorHandler = build.entry.module.handleError || ((error, { | ||
@@ -32,29 +42,118 @@ request | ||
if (serverMode !== ServerMode.Test && !request.signal.aborted) { | ||
console.error(error); | ||
console.error( | ||
// @ts-expect-error This is "private" from users but intended for internal use | ||
isRouteErrorResponse(error) && error.error ? error.error : error); | ||
} | ||
}); | ||
return { | ||
routes, | ||
dataRoutes, | ||
serverMode, | ||
staticHandler, | ||
errorHandler | ||
}; | ||
} | ||
const createRequestHandler = (build, mode) => { | ||
let _build; | ||
let routes; | ||
let serverMode; | ||
let staticHandler; | ||
let errorHandler; | ||
return async function requestHandler(request, loadContext = {}) { | ||
_build = typeof build === "function" ? await build() : build; | ||
mode ??= _build.mode; | ||
if (typeof build === "function") { | ||
let derived = derive(_build, mode); | ||
routes = derived.routes; | ||
serverMode = derived.serverMode; | ||
staticHandler = derived.staticHandler; | ||
errorHandler = derived.errorHandler; | ||
} else if (!routes || !serverMode || !staticHandler || !errorHandler) { | ||
let derived = derive(_build, mode); | ||
routes = derived.routes; | ||
serverMode = derived.serverMode; | ||
staticHandler = derived.staticHandler; | ||
errorHandler = derived.errorHandler; | ||
} | ||
let url = new URL(request.url); | ||
let matches = matchServerRoutes(routes, url.pathname); | ||
let handleError = error => errorHandler(error, { | ||
context: loadContext, | ||
params: matches && matches.length > 0 ? matches[0].params : {}, | ||
request | ||
}); | ||
let params = {}; | ||
let handleError = error => { | ||
if (mode === ServerMode.Development) { | ||
var _getDevServerHooks, _getDevServerHooks$pr; | ||
(_getDevServerHooks = getDevServerHooks()) === null || _getDevServerHooks === void 0 ? void 0 : (_getDevServerHooks$pr = _getDevServerHooks.processRequestError) === null || _getDevServerHooks$pr === void 0 ? void 0 : _getDevServerHooks$pr.call(_getDevServerHooks, error); | ||
} | ||
errorHandler(error, { | ||
context: loadContext, | ||
params, | ||
request | ||
}); | ||
}; | ||
// Manifest request for fog of war | ||
let manifestUrl = `${_build.basename ?? "/"}/__manifest`.replace(/\/+/g, "/"); | ||
if (url.pathname === manifestUrl) { | ||
try { | ||
let res = await handleManifestRequest(_build, routes, url); | ||
return res; | ||
} catch (e) { | ||
handleError(e); | ||
return new Response("Unknown Server Error", { | ||
status: 500 | ||
}); | ||
} | ||
} | ||
let matches = matchServerRoutes(routes, url.pathname, _build.basename); | ||
if (matches && matches.length > 0) { | ||
Object.assign(params, matches[0].params); | ||
} | ||
let response; | ||
if (url.searchParams.has("_data")) { | ||
if (_build.future.unstable_singleFetch) { | ||
handleError(new Error("Warning: Single fetch-enabled apps should not be making ?_data requests, " + "this is likely to break in the future")); | ||
} | ||
let routeId = url.searchParams.get("_data"); | ||
response = await handleDataRequestRR(serverMode, staticHandler, routeId, request, loadContext, handleError); | ||
if (build.entry.module.handleDataRequest) { | ||
var _matches$find; | ||
response = await build.entry.module.handleDataRequest(response, { | ||
response = await handleDataRequest(serverMode, _build, staticHandler, routeId, request, loadContext, handleError); | ||
if (_build.entry.module.handleDataRequest) { | ||
response = await _build.entry.module.handleDataRequest(response, { | ||
context: loadContext, | ||
params: (matches === null || matches === void 0 ? void 0 : (_matches$find = matches.find(m => m.route.id == routeId)) === null || _matches$find === void 0 ? void 0 : _matches$find.params) || {}, | ||
params, | ||
request | ||
}); | ||
if (isRedirectResponse(response)) { | ||
response = createRemixRedirectResponse(response, _build.basename); | ||
} | ||
} | ||
} else if (_build.future.unstable_singleFetch && url.pathname.endsWith(".data")) { | ||
let handlerUrl = new URL(request.url); | ||
handlerUrl.pathname = handlerUrl.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/"); | ||
let singleFetchMatches = matchServerRoutes(routes, handlerUrl.pathname, _build.basename); | ||
response = await handleSingleFetchRequest(serverMode, _build, staticHandler, request, handlerUrl, loadContext, handleError); | ||
if (_build.entry.module.handleDataRequest) { | ||
response = await _build.entry.module.handleDataRequest(response, { | ||
context: loadContext, | ||
params: singleFetchMatches ? singleFetchMatches[0].params : {}, | ||
request | ||
}); | ||
if (isRedirectResponse(response)) { | ||
let result = getSingleFetchRedirect(response.status, response.headers); | ||
if (request.method === "GET") { | ||
result = { | ||
[SingleFetchRedirectSymbol]: result | ||
}; | ||
} | ||
let headers = new Headers(response.headers); | ||
headers.set("Content-Type", "text/x-turbo"); | ||
return new Response(encodeViaTurboStream(result, request.signal, _build.entry.module.streamTimeout, serverMode), { | ||
status: SINGLE_FETCH_REDIRECT_STATUS, | ||
headers | ||
}); | ||
} | ||
} | ||
} else if (matches && matches[matches.length - 1].route.module.default == null && matches[matches.length - 1].route.module.ErrorBoundary == null) { | ||
response = await handleResourceRequestRR(serverMode, staticHandler, matches.slice(-1)[0].route.id, request, loadContext, handleError); | ||
response = await handleResourceRequest(serverMode, _build, staticHandler, matches.slice(-1)[0].route.id, request, loadContext, handleError); | ||
} else { | ||
response = await handleDocumentRequestRR(serverMode, build, staticHandler, request, loadContext, handleError); | ||
var _getDevServerHooks2, _getDevServerHooks2$g; | ||
let criticalCss = mode === ServerMode.Development ? await ((_getDevServerHooks2 = getDevServerHooks()) === null || _getDevServerHooks2 === void 0 ? void 0 : (_getDevServerHooks2$g = _getDevServerHooks2.getCriticalCss) === null || _getDevServerHooks2$g === void 0 ? void 0 : _getDevServerHooks2$g.call(_getDevServerHooks2, _build, url.pathname)) : undefined; | ||
response = await handleDocumentRequest(serverMode, _build, staticHandler, request, loadContext, handleError, criticalCss); | ||
} | ||
@@ -71,3 +170,30 @@ if (request.method === "HEAD") { | ||
}; | ||
async function handleDataRequestRR(serverMode, staticHandler, routeId, request, loadContext, handleError) { | ||
async function handleManifestRequest(build, routes, url) { | ||
let data = { | ||
patches: {}, | ||
notFoundPaths: [] | ||
}; | ||
if (url.searchParams.has("p")) { | ||
for (let path of url.searchParams.getAll("p")) { | ||
let matches = matchServerRoutes(routes, path, build.basename); | ||
if (matches) { | ||
for (let match of matches) { | ||
let routeId = match.route.id; | ||
data.patches[routeId] = build.assets.routes[routeId]; | ||
} | ||
} else { | ||
data.notFoundPaths.push(path); | ||
} | ||
} | ||
return json(data, { | ||
headers: { | ||
"Cache-Control": "public, max-age=31536000, immutable" | ||
} | ||
}); // Override the TypedResponse stuff from json() | ||
} | ||
return new Response("Invalid Request", { | ||
status: 400 | ||
}); | ||
} | ||
async function handleDataRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) { | ||
try { | ||
@@ -79,16 +205,3 @@ let response = await staticHandler.queryRoute(request, { | ||
if (isRedirectResponse(response)) { | ||
// We don't have any way to prevent a fetch request from following | ||
// redirects. So we use the `X-Remix-Redirect` header to indicate the | ||
// next URL, and then "follow" the redirect manually on the client. | ||
let headers = new Headers(response.headers); | ||
headers.set("X-Remix-Redirect", headers.get("Location")); | ||
headers.set("X-Remix-Status", response.status); | ||
headers.delete("Location"); | ||
if (response.headers.get("Set-Cookie") !== null) { | ||
headers.set("X-Remix-Revalidate", "yes"); | ||
} | ||
return new Response(null, { | ||
status: 204, | ||
headers | ||
}); | ||
return createRemixRedirectResponse(response, build.basename); | ||
} | ||
@@ -110,18 +223,16 @@ if (UNSAFE_DEFERRED_SYMBOL in response) { | ||
// network errors that are missing this header | ||
response.headers.set("X-Remix-Response", "yes"); | ||
response = safelySetHeader(response, "X-Remix-Response", "yes"); | ||
return response; | ||
} catch (error) { | ||
if (isResponse(error)) { | ||
error.headers.set("X-Remix-Catch", "yes"); | ||
return error; | ||
let response = safelySetHeader(error, "X-Remix-Catch", "yes"); | ||
return response; | ||
} | ||
if (isRouteErrorResponse(error)) { | ||
if (error.error) { | ||
handleError(error.error); | ||
} | ||
handleError(error); | ||
return errorResponseToJson(error, serverMode); | ||
} | ||
let errorInstance = error instanceof Error ? error : new Error("Unexpected Server Error"); | ||
let errorInstance = error instanceof Error || error instanceof DOMException ? error : new Error("Unexpected Server Error"); | ||
handleError(errorInstance); | ||
return json(serializeError(errorInstance, serverMode), { | ||
return json$1(serializeError(errorInstance, serverMode), { | ||
status: 500, | ||
@@ -134,7 +245,29 @@ headers: { | ||
} | ||
async function handleDocumentRequestRR(serverMode, build, staticHandler, request, loadContext, handleError) { | ||
async function handleSingleFetchRequest(serverMode, build, staticHandler, request, handlerUrl, loadContext, handleError) { | ||
let { | ||
result, | ||
headers, | ||
status | ||
} = request.method !== "GET" ? await singleFetchAction(serverMode, staticHandler, request, handlerUrl, loadContext, handleError) : await singleFetchLoaders(serverMode, staticHandler, request, handlerUrl, loadContext, handleError); | ||
// Mark all successful responses with a header so we can identify in-flight | ||
// network errors that are missing this header | ||
let resultHeaders = new Headers(headers); | ||
resultHeaders.set("X-Remix-Response", "yes"); | ||
resultHeaders.set("Content-Type", "text/x-turbo"); | ||
// Note: Deferred data is already just Promises, so we don't have to mess | ||
// `activeDeferreds` or anything :) | ||
return new Response(encodeViaTurboStream(result, request.signal, build.entry.module.streamTimeout, serverMode), { | ||
status: status || 200, | ||
headers: resultHeaders | ||
}); | ||
} | ||
async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, criticalCss) { | ||
let context; | ||
let responseStubs = getResponseStubs(); | ||
try { | ||
context = await staticHandler.query(request, { | ||
requestContext: loadContext | ||
requestContext: loadContext, | ||
unstable_dataStrategy: build.future.unstable_singleFetch ? getSingleFetchDataStrategy(responseStubs) : undefined | ||
}); | ||
@@ -150,2 +283,25 @@ } catch (error) { | ||
} | ||
let statusCode; | ||
let headers; | ||
if (build.future.unstable_singleFetch) { | ||
let merged = mergeResponseStubs(context, responseStubs); | ||
statusCode = merged.statusCode; | ||
headers = merged.headers; | ||
if (isRedirectStatusCode(statusCode) && headers.has("Location")) { | ||
return new Response(null, { | ||
status: statusCode, | ||
headers | ||
}); | ||
} | ||
if (context.errors) { | ||
for (let [routeId, error] of Object.entries(context.errors)) { | ||
if (isResponseStub(error)) { | ||
context.errors[routeId] = convertResponseStubToErrorResponse(error); | ||
} | ||
} | ||
} | ||
} else { | ||
statusCode = context.statusCode; | ||
headers = getDocumentHeaders(build, context); | ||
} | ||
@@ -155,3 +311,4 @@ // Sanitize errors outside of development environments | ||
Object.values(context.errors).forEach(err => { | ||
if (!isRouteErrorResponse(err) || err.error) { | ||
// @ts-expect-error `err.error` is "private" from users but intended for internal use | ||
if ((!isRouteErrorResponse(err) || err.error) && !isResponseStub(err)) { | ||
handleError(err); | ||
@@ -162,3 +319,11 @@ } | ||
} | ||
let headers = getDocumentHeadersRR(build, context); | ||
// Server UI state to send to the client. | ||
// - When single fetch is enabled, this is streamed down via `serverHandoffStream` | ||
// - Otherwise it's stringified into `serverHandoffString` | ||
let state = { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: serializeErrors(context.errors, serverMode) | ||
}; | ||
let entryContext = { | ||
@@ -168,12 +333,19 @@ manifest: build.assets, | ||
staticHandlerContext: context, | ||
criticalCss, | ||
serverHandoffString: createServerHandoffString({ | ||
url: context.location.pathname, | ||
state: { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: serializeErrors(context.errors, serverMode) | ||
}, | ||
future: build.future | ||
basename: build.basename, | ||
criticalCss, | ||
future: build.future, | ||
isSpaMode: build.isSpaMode, | ||
...(!build.future.unstable_singleFetch ? { | ||
state | ||
} : null) | ||
}), | ||
...(build.future.unstable_singleFetch ? { | ||
serverHandoffStream: encodeViaTurboStream(state, request.signal, build.entry.module.streamTimeout, serverMode), | ||
renderMeta: {} | ||
} : null), | ||
future: build.future, | ||
isSpaMode: build.isSpaMode, | ||
serializeError: err => serializeError(err, serverMode) | ||
@@ -183,8 +355,20 @@ }; | ||
try { | ||
return await handleDocumentRequestFunction(request, context.statusCode, headers, entryContext, loadContext); | ||
return await handleDocumentRequestFunction(request, statusCode, headers, entryContext, loadContext); | ||
} catch (error) { | ||
handleError(error); | ||
let errorForSecondRender = error; | ||
// If they threw a response, unwrap it into an ErrorResponse like we would | ||
// have for a loader/action | ||
if (isResponse(error)) { | ||
try { | ||
let data = await unwrapResponse(error); | ||
errorForSecondRender = new UNSAFE_ErrorResponseImpl(error.status, error.statusText, data); | ||
} catch (e) { | ||
// If we can't unwrap the response - just leave it as-is | ||
} | ||
} | ||
// Get a new StaticHandlerContext that contains the error at the right boundary | ||
context = getStaticContextFromError(staticHandler.dataRoutes, context, error); | ||
context = getStaticContextFromError(staticHandler.dataRoutes, context, errorForSecondRender); | ||
@@ -196,3 +380,11 @@ // Sanitize errors outside of development environments | ||
// Update entryContext for the second render pass | ||
// Get a new entryContext for the second render pass | ||
// Server UI state to send to the client. | ||
// - When single fetch is enabled, this is streamed down via `serverHandoffStream` | ||
// - Otherwise it's stringified into `serverHandoffString` | ||
let state = { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: serializeErrors(context.errors, serverMode) | ||
}; | ||
entryContext = { | ||
@@ -203,9 +395,13 @@ ...entryContext, | ||
url: context.location.pathname, | ||
state: { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: serializeErrors(context.errors, serverMode) | ||
}, | ||
future: build.future | ||
}) | ||
basename: build.basename, | ||
future: build.future, | ||
isSpaMode: build.isSpaMode, | ||
...(!build.future.unstable_singleFetch ? { | ||
state | ||
} : null) | ||
}), | ||
...(build.future.unstable_singleFetch ? { | ||
serverHandoffStream: encodeViaTurboStream(state, request.signal, build.entry.module.streamTimeout, serverMode), | ||
renderMeta: {} | ||
} : null) | ||
}; | ||
@@ -220,4 +416,5 @@ try { | ||
} | ||
async function handleResourceRequestRR(serverMode, staticHandler, routeId, request, loadContext, handleError) { | ||
async function handleResourceRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) { | ||
try { | ||
let responseStubs = build.future.unstable_singleFetch ? getResponseStubs() : {}; | ||
// Note we keep the routeId here to align with the Remix handling of | ||
@@ -228,5 +425,41 @@ // resource routes which doesn't take ?index into account and just takes | ||
routeId, | ||
requestContext: loadContext | ||
requestContext: loadContext, | ||
...(build.future.unstable_singleFetch ? { | ||
unstable_dataStrategy: getSingleFetchResourceRouteDataStrategy({ | ||
responseStubs | ||
}) | ||
} : null) | ||
}); | ||
// callRouteLoader/callRouteAction always return responses | ||
if (typeof response === "object" && response !== null) { | ||
invariant(!(UNSAFE_DEFERRED_SYMBOL in response), `You cannot return a \`defer()\` response from a Resource Route. Did you ` + `forget to export a default UI component from the "${routeId}" route?`); | ||
} | ||
if (build.future.unstable_singleFetch) { | ||
let stub = responseStubs[routeId]; | ||
if (isResponse(response)) { | ||
// If a response was returned, we use it's status and we merge our | ||
// response stub headers onto it | ||
let ops = stub[ResponseStubOperationsSymbol]; | ||
for (let [op, ...args] of ops) { | ||
// @ts-expect-error | ||
response.headers[op](...args); | ||
} | ||
} else if (isResponseStub(response) || response == null) { | ||
// If the stub or null was returned, then there is no body so we just | ||
// proxy along the status/headers to a Response | ||
response = new Response(null, { | ||
status: stub.status, | ||
headers: stub.headers | ||
}); | ||
} else { | ||
console.warn(resourceRouteJsonWarning(request.method === "GET" ? "loader" : "action", routeId)); | ||
// Otherwise we create a json Response using the stub | ||
response = json(response, { | ||
status: stub.status, | ||
headers: stub.headers | ||
}); | ||
} | ||
} | ||
// callRouteLoader/callRouteAction always return responses (w/o single fetch). | ||
// With single fetch, users should always be Responses from resource routes | ||
invariant(isResponse(response), "Expected a Response to be returned from queryRoute"); | ||
@@ -238,8 +471,14 @@ return response; | ||
// match identically to what Remix returns | ||
error.headers.set("X-Remix-Catch", "yes"); | ||
return error; | ||
let response = safelySetHeader(error, "X-Remix-Catch", "yes"); | ||
return response; | ||
} | ||
if (isResponseStub(error)) { | ||
return new Response(null, { | ||
status: error.status, | ||
headers: error.headers | ||
}); | ||
} | ||
if (isRouteErrorResponse(error)) { | ||
if (error.error) { | ||
handleError(error.error); | ||
if (error) { | ||
handleError(error); | ||
} | ||
@@ -253,3 +492,5 @@ return errorResponseToJson(error, serverMode); | ||
function errorResponseToJson(errorResponse, serverMode) { | ||
return json(serializeError(errorResponse.error || new Error("Unexpected Server Error"), serverMode), { | ||
return json$1(serializeError( | ||
// @ts-expect-error This is "private" from users but intended for internal use | ||
errorResponse.error || new Error("Unexpected Server Error"), serverMode), { | ||
status: errorResponse.status, | ||
@@ -276,3 +517,42 @@ statusText: errorResponse.statusText, | ||
} | ||
function unwrapResponse(response) { | ||
let contentType = response.headers.get("Content-Type"); | ||
// Check between word boundaries instead of startsWith() due to the last | ||
// paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type | ||
return contentType && /\bapplication\/json\b/.test(contentType) ? response.body == null ? null : response.json() : response.text(); | ||
} | ||
function createRemixRedirectResponse(response, basename) { | ||
// We don't have any way to prevent a fetch request from following | ||
// redirects. So we use the `X-Remix-Redirect` header to indicate the | ||
// next URL, and then "follow" the redirect manually on the client. | ||
let headers = new Headers(response.headers); | ||
let redirectUrl = headers.get("Location"); | ||
headers.set("X-Remix-Redirect", basename ? stripBasename(redirectUrl, basename) || redirectUrl : redirectUrl); | ||
headers.set("X-Remix-Status", String(response.status)); | ||
headers.delete("Location"); | ||
if (response.headers.get("Set-Cookie") !== null) { | ||
headers.set("X-Remix-Revalidate", "yes"); | ||
} | ||
return new Response(null, { | ||
status: 204, | ||
headers | ||
}); | ||
} | ||
// Anytime we are setting a header on a `Response` created in the loader/action, | ||
// we have to so it in this manner since in an `undici` world, if the `Response` | ||
// came directly from a `fetch` call, the headers are immutable will throw if | ||
// we try to set a new header. This is a sort of shallow clone of the `Response` | ||
// so we can safely set our own header. | ||
function safelySetHeader(response, name, value) { | ||
let headers = new Headers(response.headers); | ||
headers.set(name, value); | ||
return new Response(response.body, { | ||
status: response.status, | ||
statusText: response.statusText, | ||
headers, | ||
duplex: response.body ? "half" : undefined | ||
}); | ||
} | ||
export { createRequestHandler }; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -123,6 +123,7 @@ * Copyright (c) Remix Software Inc. | ||
} = session; | ||
let expires = (options === null || options === void 0 ? void 0 : options.maxAge) != null ? new Date(Date.now() + options.maxAge * 1000) : (options === null || options === void 0 ? void 0 : options.expires) != null ? options.expires : cookie.expires; | ||
if (id) { | ||
await updateData(id, data, cookie.expires); | ||
await updateData(id, data, expires); | ||
} else { | ||
id = await createData(data, cookie.expires); | ||
id = await createData(data, expires); | ||
} | ||
@@ -135,2 +136,3 @@ return cookie.serialize(id, options); | ||
...options, | ||
maxAge: undefined, | ||
expires: new Date(0) | ||
@@ -137,0 +139,0 @@ }); |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -44,2 +44,3 @@ * Copyright (c) Remix Software Inc. | ||
...options, | ||
maxAge: undefined, | ||
expires: new Date(0) | ||
@@ -46,0 +47,0 @@ }); |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -23,3 +23,2 @@ * Copyright (c) Remix Software Inc. | ||
} = {}) => { | ||
let uniqueId = 0; | ||
let map = new Map(); | ||
@@ -29,3 +28,3 @@ return createSessionStorage({ | ||
async createData(data, expires) { | ||
let id = (++uniqueId).toString(); | ||
let id = Math.random().toString(36).substring(2, 10); | ||
map.set(id, { | ||
@@ -32,0 +31,0 @@ data, |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
import type { StaticHandlerContext } from "@remix-run/router"; | ||
import type { ServerBuild } from "./build"; | ||
export declare function getDocumentHeadersRR(build: ServerBuild, context: StaticHandlerContext): Headers; | ||
export declare function getDocumentHeaders(build: ServerBuild, context: StaticHandlerContext): Headers; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -17,3 +17,3 @@ * Copyright (c) Remix Software Inc. | ||
function getDocumentHeadersRR(build, context) { | ||
function getDocumentHeaders(build, context) { | ||
let boundaryIdx = context.errors ? context.matches.findIndex(m => context.errors[m.route.id]) : -1; | ||
@@ -95,2 +95,2 @@ let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches; | ||
exports.getDocumentHeadersRR = getDocumentHeadersRR; | ||
exports.getDocumentHeaders = getDocumentHeaders; |
export { createCookieFactory, isCookie } from "./cookies"; | ||
export { composeUploadHandlers as unstable_composeUploadHandlers, parseMultipartFormData as unstable_parseMultipartFormData, } from "./formData"; | ||
export { defer, json, redirect, redirectDocument } from "./responses"; | ||
export { SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, defineLoader as unstable_defineLoader, defineAction as unstable_defineAction, } from "./single-fetch"; | ||
export type { Loader as unstable_Loader, Action as unstable_Action, Serialize as unstable_Serialize, SingleFetchResult as UNSAFE_SingleFetchResult, SingleFetchResults as UNSAFE_SingleFetchResults, } from "./single-fetch"; | ||
export { createRequestHandler } from "./server"; | ||
@@ -10,4 +12,4 @@ export { createSession, createSessionStorageFactory, isSession, } from "./sessions"; | ||
export { MaxPartSizeExceededError } from "./upload/errors"; | ||
export { broadcastDevReady, logDevReady } from "./dev"; | ||
export { broadcastDevReady, logDevReady, setDevServerHooks as unstable_setDevServerHooks, } from "./dev"; | ||
export type { CreateCookieFunction, CreateCookieSessionStorageFunction, CreateMemorySessionStorageFunction, CreateRequestHandlerFunction, CreateSessionFunction, CreateSessionStorageFunction, IsCookieFunction, IsSessionFunction, JsonFunction, RedirectFunction, } from "./interface"; | ||
export type { ActionArgs, ActionFunction, AppData, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, FlashSessionData, HandleDataRequestFunction, HandleDocumentRequestFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, LinkDescriptor, LinksFunction, LoaderArgs, LoaderFunction, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, HandleErrorFunction, PageLinkDescriptor, RequestHandler, RouteHandle, SerializeFrom, ServerBuild, ServerEntryModule, ServerRuntimeMetaArgs, ServerRuntimeMetaDescriptor, ServerRuntimeMetaFunction, Session, SessionData, SessionIdStorageStrategy, SessionStorage, SignFunction, TypedDeferredData, TypedResponse, UnsignFunction, UploadHandler, UploadHandlerPart, } from "./reexport"; | ||
export type { ActionFunction, ActionFunctionArgs, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, DataFunctionArgs, EntryContext, ErrorResponse, FlashSessionData, HandleDataRequestFunction, HandleDocumentRequestFunction, HeadersArgs, HeadersFunction, HtmlLinkDescriptor, LinkDescriptor, LinksFunction, LoaderFunction, LoaderFunctionArgs, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, HandleErrorFunction, PageLinkDescriptor, RequestHandler, SerializeFrom, ServerBuild, ServerEntryModule, ServerRuntimeMetaArgs, ServerRuntimeMetaDescriptor, ServerRuntimeMetaFunction, Session, SessionData, SessionIdStorageStrategy, SessionStorage, SignFunction, TypedDeferredData, TypedResponse, UnsignFunction, UploadHandler, UploadHandlerPart, } from "./reexport"; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -18,2 +18,3 @@ * Copyright (c) Remix Software Inc. | ||
var responses = require('./responses.js'); | ||
var singleFetch = require('./single-fetch.js'); | ||
var server = require('./server.js'); | ||
@@ -37,2 +38,5 @@ var sessions = require('./sessions.js'); | ||
exports.redirectDocument = responses.redirectDocument; | ||
exports.UNSAFE_SingleFetchRedirectSymbol = singleFetch.SingleFetchRedirectSymbol; | ||
exports.unstable_defineAction = singleFetch.defineAction; | ||
exports.unstable_defineLoader = singleFetch.defineLoader; | ||
exports.createRequestHandler = server.createRequestHandler; | ||
@@ -48,1 +52,2 @@ exports.createSession = sessions.createSession; | ||
exports.logDevReady = dev.logDevReady; | ||
exports.unstable_setDevServerHooks = dev.setDevServerHooks; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
@@ -0,1 +1,2 @@ | ||
export type { ErrorResponse } from "@remix-run/router"; | ||
export type { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule, } from "./build"; | ||
@@ -6,9 +7,9 @@ export type { UploadHandlerPart, UploadHandler } from "./formData"; | ||
export type { SignFunction, UnsignFunction } from "./crypto"; | ||
export type { AppLoadContext, AppData } from "./data"; | ||
export type { AppLoadContext } from "./data"; | ||
export type { EntryContext } from "./entry"; | ||
export type { HtmlLinkDescriptor, LinkDescriptor, PageLinkDescriptor, } from "./links"; | ||
export type { TypedDeferredData, TypedResponse } from "./responses"; | ||
export type { ActionArgs, ActionFunction, DataFunctionArgs, HeadersArgs, HeadersFunction, LinksFunction, LoaderArgs, LoaderFunction, RouteHandle, ServerRuntimeMetaArgs, ServerRuntimeMetaDescriptor, ServerRuntimeMetaFunction, } from "./routeModules"; | ||
export type { ActionFunction, ActionFunctionArgs, DataFunctionArgs, HeadersArgs, HeadersFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, ServerRuntimeMetaArgs, ServerRuntimeMetaDescriptor, ServerRuntimeMetaFunction, } from "./routeModules"; | ||
export type { SerializeFrom } from "./serialize"; | ||
export type { RequestHandler } from "./server"; | ||
export type { Session, SessionData, SessionIdStorageStrategy, SessionStorage, FlashSessionData, } from "./sessions"; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -20,2 +20,3 @@ * Copyright (c) Remix Software Inc. | ||
// interfaces must conform to the types they extend | ||
/** | ||
@@ -22,0 +23,0 @@ * This is a shortcut for creating `application/json` responses. Converts `data` |
@@ -8,2 +8,2 @@ import type { Params } from "@remix-run/router"; | ||
} | ||
export declare function matchServerRoutes(routes: ServerRoute[], pathname: string): RouteMatch<ServerRoute>[] | null; | ||
export declare function matchServerRoutes(routes: ServerRoute[], pathname: string, basename?: string): RouteMatch<ServerRoute>[] | null; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -17,4 +17,4 @@ * Copyright (c) Remix Software Inc. | ||
function matchServerRoutes(routes, pathname) { | ||
let matches = router.matchRoutes(routes, pathname); | ||
function matchServerRoutes(routes, pathname, basename) { | ||
let matches = router.matchRoutes(routes, pathname, basename); | ||
if (!matches) return null; | ||
@@ -21,0 +21,0 @@ return matches.map(match => ({ |
@@ -1,29 +0,63 @@ | ||
import type { AgnosticRouteMatch, Location, Params } from "@remix-run/router"; | ||
import type { AppLoadContext, AppData } from "./data"; | ||
import type { ActionFunction as RRActionFunction, ActionFunctionArgs as RRActionFunctionArgs, AgnosticRouteMatch, LoaderFunction as RRLoaderFunction, LoaderFunctionArgs as RRLoaderFunctionArgs, Location, Params } from "@remix-run/router"; | ||
import type { AppData, AppLoadContext } from "./data"; | ||
import type { LinkDescriptor } from "./links"; | ||
import type { SerializeFrom } from "./serialize"; | ||
import type { ResponseStub } from "./single-fetch"; | ||
export interface RouteModules<RouteModule> { | ||
[routeId: string]: RouteModule; | ||
[routeId: string]: RouteModule | undefined; | ||
} | ||
/** | ||
* The arguments passed to ActionFunction and LoaderFunction. | ||
* | ||
* Note this is almost identical to React Router's version but over there the | ||
* context is optional since it's only there during static handler invocations. | ||
* Keeping Remix's own definition for now so it can differentiate between | ||
* client/server | ||
* @deprecated Use `LoaderFunctionArgs`/`ActionFunctionArgs` instead | ||
*/ | ||
export interface DataFunctionArgs { | ||
request: Request; | ||
export type DataFunctionArgs = RRActionFunctionArgs<AppLoadContext> & RRLoaderFunctionArgs<AppLoadContext> & { | ||
context: AppLoadContext; | ||
params: Params; | ||
} | ||
export type LoaderArgs = DataFunctionArgs; | ||
export type ActionArgs = DataFunctionArgs; | ||
}; | ||
/** | ||
* A function that handles data mutations for a route. | ||
* A function that handles data mutations for a route on the server | ||
*/ | ||
export interface ActionFunction { | ||
(args: DataFunctionArgs): Promise<Response> | Response | Promise<AppData> | AppData; | ||
} | ||
export type ActionFunction = (args: ActionFunctionArgs) => ReturnType<RRActionFunction>; | ||
/** | ||
* Arguments passed to a route `action` function | ||
*/ | ||
export type ActionFunctionArgs = RRActionFunctionArgs<AppLoadContext> & { | ||
context: AppLoadContext; | ||
response?: ResponseStub; | ||
}; | ||
/** | ||
* A function that handles data mutations for a route on the client | ||
* @private Public API is exported from @remix-run/react | ||
*/ | ||
type ClientActionFunction = (args: ClientActionFunctionArgs) => ReturnType<RRActionFunction>; | ||
/** | ||
* Arguments passed to a route `clientAction` function | ||
* @private Public API is exported from @remix-run/react | ||
*/ | ||
export type ClientActionFunctionArgs = RRActionFunctionArgs<undefined> & { | ||
serverAction: <T = AppData>() => Promise<SerializeFrom<T>>; | ||
}; | ||
/** | ||
* A function that loads data for a route on the server | ||
*/ | ||
export type LoaderFunction = (args: LoaderFunctionArgs) => ReturnType<RRLoaderFunction>; | ||
/** | ||
* Arguments passed to a route `loader` function | ||
*/ | ||
export type LoaderFunctionArgs = RRLoaderFunctionArgs<AppLoadContext> & { | ||
context: AppLoadContext; | ||
response?: ResponseStub; | ||
}; | ||
/** | ||
* A function that loads data for a route on the client | ||
* @private Public API is exported from @remix-run/react | ||
*/ | ||
type ClientLoaderFunction = ((args: ClientLoaderFunctionArgs) => ReturnType<RRLoaderFunction>) & { | ||
hydrate?: boolean; | ||
}; | ||
/** | ||
* Arguments passed to a route `clientLoader` function | ||
* @private Public API is exported from @remix-run/react | ||
*/ | ||
export type ClientLoaderFunctionArgs = RRLoaderFunctionArgs<undefined> & { | ||
serverLoader: <T = AppData>() => Promise<SerializeFrom<T>>; | ||
}; | ||
export type HeadersArgs = { | ||
@@ -50,8 +84,2 @@ loaderHeaders: Headers; | ||
/** | ||
* A function that loads data for a route. | ||
*/ | ||
export interface LoaderFunction { | ||
(args: DataFunctionArgs): Promise<Response> | Response | Promise<AppData> | AppData; | ||
} | ||
/** | ||
* A function that returns an array of data objects to use for rendering | ||
@@ -114,3 +142,3 @@ * metadata HTML tags in a route. These tags are not rendered on descendant | ||
*/ | ||
export interface ServerRuntimeMetaFunction<Loader extends LoaderFunction | unknown = unknown, ParentsLoaders extends Record<string, LoaderFunction> = {}> { | ||
export interface ServerRuntimeMetaFunction<Loader extends LoaderFunction | unknown = unknown, ParentsLoaders extends Record<string, LoaderFunction | unknown> = Record<string, unknown>> { | ||
(args: ServerRuntimeMetaArgs<Loader, ParentsLoaders>): ServerRuntimeMetaDescriptor[]; | ||
@@ -122,10 +150,11 @@ } | ||
data: Loader extends LoaderFunction ? SerializeFrom<Loader> : unknown; | ||
handle?: unknown; | ||
handle?: RouteHandle; | ||
params: AgnosticRouteMatch["params"]; | ||
meta: ServerRuntimeMetaDescriptor[]; | ||
error?: unknown; | ||
} | ||
type ServerRuntimeMetaMatches<MatchLoaders extends Record<string, unknown> = Record<string, unknown>> = Array<{ | ||
type ServerRuntimeMetaMatches<MatchLoaders extends Record<string, LoaderFunction | unknown> = Record<string, unknown>> = Array<{ | ||
[K in keyof MatchLoaders]: ServerRuntimeMetaMatch<Exclude<K, number | symbol>, MatchLoaders[K]>; | ||
}[keyof MatchLoaders]>; | ||
export interface ServerRuntimeMetaArgs<Loader extends LoaderFunction | unknown = unknown, MatchLoaders extends Record<string, unknown> = Record<string, unknown>> { | ||
export interface ServerRuntimeMetaArgs<Loader extends LoaderFunction | unknown = unknown, MatchLoaders extends Record<string, LoaderFunction | unknown> = Record<string, unknown>> { | ||
data: (Loader extends LoaderFunction ? SerializeFrom<Loader> : AppData) | undefined; | ||
@@ -135,2 +164,3 @@ params: Params; | ||
matches: ServerRuntimeMetaMatches<MatchLoaders>; | ||
error?: unknown; | ||
} | ||
@@ -169,5 +199,9 @@ export type ServerRuntimeMetaDescriptor = { | ||
*/ | ||
export type RouteHandle = any; | ||
export type RouteHandle = unknown; | ||
export interface EntryRouteModule { | ||
clientAction?: ClientActionFunction; | ||
clientLoader?: ClientLoaderFunction; | ||
ErrorBoundary?: any; | ||
HydrateFallback?: any; | ||
Layout?: any; | ||
default: any; | ||
@@ -174,0 +208,0 @@ handle?: RouteHandle; |
@@ -18,4 +18,7 @@ import type { AgnosticDataRouteObject } from "@remix-run/router"; | ||
hasLoader: boolean; | ||
hasClientAction: boolean; | ||
hasClientLoader: boolean; | ||
hasErrorBoundary: boolean; | ||
imports?: string[]; | ||
css?: string[]; | ||
module: string; | ||
@@ -22,0 +25,0 @@ parentId?: string; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -51,3 +51,6 @@ * Copyright (c) Remix Software Inc. | ||
path: route.path, | ||
loader: route.module.loader ? args => data.callRouteLoaderRR({ | ||
loader: route.module.loader ? | ||
// Need to use RR's version here to permit the optional context even | ||
// though we know it'll always be provided in remix | ||
(args, dataStrategyCtx) => data.callRouteLoader({ | ||
request: args.request, | ||
@@ -57,5 +60,7 @@ params: args.params, | ||
loader: route.module.loader, | ||
routeId: route.id | ||
routeId: route.id, | ||
singleFetch: future.unstable_singleFetch === true, | ||
response: dataStrategyCtx === null || dataStrategyCtx === void 0 ? void 0 : dataStrategyCtx.response | ||
}) : undefined, | ||
action: route.module.action ? args => data.callRouteActionRR({ | ||
action: route.module.action ? (args, dataStrategyCtx) => data.callRouteAction({ | ||
request: args.request, | ||
@@ -65,3 +70,5 @@ params: args.params, | ||
action: route.module.action, | ||
routeId: route.id | ||
routeId: route.id, | ||
singleFetch: future.unstable_singleFetch === true, | ||
response: dataStrategyCtx === null || dataStrategyCtx === void 0 ? void 0 : dataStrategyCtx.response | ||
}) : undefined, | ||
@@ -68,0 +75,0 @@ handle: route.module.handle |
@@ -1,7 +0,8 @@ | ||
import type { Jsonify } from "type-fest"; | ||
import type { AppData } from "./data"; | ||
import type { Jsonify } from "./jsonify"; | ||
import type { TypedDeferredData, TypedResponse } from "./responses"; | ||
type Fn = (...args: any[]) => any; | ||
import type { ClientActionFunctionArgs, ClientLoaderFunctionArgs } from "./routeModules"; | ||
/** | ||
* Infer JSON serialized data type returned by a loader or action. | ||
* Infer JSON serialized data type returned by a loader or action, while | ||
* avoiding deserialization if the input type if it's a clientLoader or | ||
* clientAction that returns a non-Response | ||
* | ||
@@ -11,8 +12,15 @@ * For example: | ||
*/ | ||
export type SerializeFrom<T extends AppData | Fn> = T extends (...args: any[]) => infer Output ? Awaited<Output> extends TypedResponse<infer U> ? Jsonify<U> : Awaited<Output> extends TypedDeferredData<infer U> ? { | ||
export type SerializeFrom<T> = T extends (...args: any[]) => infer Output ? Parameters<T> extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? SerializeClient<Awaited<Output>> : Serialize<Awaited<Output>> : Jsonify<Awaited<T>>; | ||
type SerializeClient<Output> = Output extends TypedDeferredData<infer U> ? { | ||
[K in keyof U as K extends symbol ? never : Promise<any> extends U[K] ? K : never]: DeferValueClient<U[K]>; | ||
} & { | ||
[K in keyof U as Promise<any> extends U[K] ? never : K]: U[K]; | ||
} : Output extends TypedResponse<infer U> ? Jsonify<U> : Awaited<Output>; | ||
type DeferValueClient<T> = T extends undefined ? undefined : T extends Promise<unknown> ? Promise<Awaited<T>> : T; | ||
type Serialize<Output> = Output extends TypedDeferredData<infer U> ? { | ||
[K in keyof U as K extends symbol ? never : Promise<any> extends U[K] ? K : never]: DeferValue<U[K]>; | ||
} & Jsonify<{ | ||
[K in keyof U as Promise<any> extends U[K] ? never : K]: U[K]; | ||
}> : Jsonify<Awaited<Output>> : Jsonify<Awaited<T>>; | ||
}> : Output extends TypedResponse<infer U> ? Jsonify<U> : Jsonify<Output>; | ||
type DeferValue<T> = T extends undefined ? undefined : T extends Promise<unknown> ? Promise<Jsonify<Awaited<T>>> : Jsonify<T>; | ||
export {}; |
import type { AppLoadContext } from "./data"; | ||
import type { ServerBuild } from "./build"; | ||
export type RequestHandler = (request: Request, loadContext?: AppLoadContext) => Promise<Response>; | ||
export type CreateRequestHandlerFunction = (build: ServerBuild, mode?: string) => RequestHandler; | ||
export type CreateRequestHandlerFunction = (build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>), mode?: string) => RequestHandler; | ||
export declare const createRequestHandler: CreateRequestHandlerFunction; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -25,8 +25,18 @@ * Copyright (c) Remix Software Inc. | ||
var serverHandoff = require('./serverHandoff.js'); | ||
var dev = require('./dev.js'); | ||
var singleFetch = require('./single-fetch.js'); | ||
var deprecations = require('./deprecations.js'); | ||
const createRequestHandler = (build, mode$1) => { | ||
function derive(build, mode$1) { | ||
var _build$future, _build$future2; | ||
let routes$1 = routes.createRoutes(build.routes); | ||
let dataRoutes = routes.createStaticHandlerDataRoutes(build.routes, build.future); | ||
let serverMode = mode.isServerMode(mode$1) ? mode$1 : mode.ServerMode.Production; | ||
let staticHandler = router.createStaticHandler(dataRoutes); | ||
let staticHandler = router.createStaticHandler(dataRoutes, { | ||
basename: build.basename, | ||
future: { | ||
v7_relativeSplatPath: ((_build$future = build.future) === null || _build$future === void 0 ? void 0 : _build$future.v3_relativeSplatPath) === true, | ||
v7_throwAbortReason: ((_build$future2 = build.future) === null || _build$future2 === void 0 ? void 0 : _build$future2.v3_throwAbortReason) === true | ||
} | ||
}); | ||
let errorHandler = build.entry.module.handleError || ((error, { | ||
@@ -36,29 +46,118 @@ request | ||
if (serverMode !== mode.ServerMode.Test && !request.signal.aborted) { | ||
console.error(error); | ||
console.error( | ||
// @ts-expect-error This is "private" from users but intended for internal use | ||
router.isRouteErrorResponse(error) && error.error ? error.error : error); | ||
} | ||
}); | ||
return { | ||
routes: routes$1, | ||
dataRoutes, | ||
serverMode, | ||
staticHandler, | ||
errorHandler | ||
}; | ||
} | ||
const createRequestHandler = (build, mode$1) => { | ||
let _build; | ||
let routes; | ||
let serverMode; | ||
let staticHandler; | ||
let errorHandler; | ||
return async function requestHandler(request, loadContext = {}) { | ||
_build = typeof build === "function" ? await build() : build; | ||
mode$1 ??= _build.mode; | ||
if (typeof build === "function") { | ||
let derived = derive(_build, mode$1); | ||
routes = derived.routes; | ||
serverMode = derived.serverMode; | ||
staticHandler = derived.staticHandler; | ||
errorHandler = derived.errorHandler; | ||
} else if (!routes || !serverMode || !staticHandler || !errorHandler) { | ||
let derived = derive(_build, mode$1); | ||
routes = derived.routes; | ||
serverMode = derived.serverMode; | ||
staticHandler = derived.staticHandler; | ||
errorHandler = derived.errorHandler; | ||
} | ||
let url = new URL(request.url); | ||
let matches = routeMatching.matchServerRoutes(routes$1, url.pathname); | ||
let handleError = error => errorHandler(error, { | ||
context: loadContext, | ||
params: matches && matches.length > 0 ? matches[0].params : {}, | ||
request | ||
}); | ||
let params = {}; | ||
let handleError = error => { | ||
if (mode$1 === mode.ServerMode.Development) { | ||
var _getDevServerHooks, _getDevServerHooks$pr; | ||
(_getDevServerHooks = dev.getDevServerHooks()) === null || _getDevServerHooks === void 0 ? void 0 : (_getDevServerHooks$pr = _getDevServerHooks.processRequestError) === null || _getDevServerHooks$pr === void 0 ? void 0 : _getDevServerHooks$pr.call(_getDevServerHooks, error); | ||
} | ||
errorHandler(error, { | ||
context: loadContext, | ||
params, | ||
request | ||
}); | ||
}; | ||
// Manifest request for fog of war | ||
let manifestUrl = `${_build.basename ?? "/"}/__manifest`.replace(/\/+/g, "/"); | ||
if (url.pathname === manifestUrl) { | ||
try { | ||
let res = await handleManifestRequest(_build, routes, url); | ||
return res; | ||
} catch (e) { | ||
handleError(e); | ||
return new Response("Unknown Server Error", { | ||
status: 500 | ||
}); | ||
} | ||
} | ||
let matches = routeMatching.matchServerRoutes(routes, url.pathname, _build.basename); | ||
if (matches && matches.length > 0) { | ||
Object.assign(params, matches[0].params); | ||
} | ||
let response; | ||
if (url.searchParams.has("_data")) { | ||
if (_build.future.unstable_singleFetch) { | ||
handleError(new Error("Warning: Single fetch-enabled apps should not be making ?_data requests, " + "this is likely to break in the future")); | ||
} | ||
let routeId = url.searchParams.get("_data"); | ||
response = await handleDataRequestRR(serverMode, staticHandler, routeId, request, loadContext, handleError); | ||
if (build.entry.module.handleDataRequest) { | ||
var _matches$find; | ||
response = await build.entry.module.handleDataRequest(response, { | ||
response = await handleDataRequest(serverMode, _build, staticHandler, routeId, request, loadContext, handleError); | ||
if (_build.entry.module.handleDataRequest) { | ||
response = await _build.entry.module.handleDataRequest(response, { | ||
context: loadContext, | ||
params: (matches === null || matches === void 0 ? void 0 : (_matches$find = matches.find(m => m.route.id == routeId)) === null || _matches$find === void 0 ? void 0 : _matches$find.params) || {}, | ||
params, | ||
request | ||
}); | ||
if (responses.isRedirectResponse(response)) { | ||
response = createRemixRedirectResponse(response, _build.basename); | ||
} | ||
} | ||
} else if (_build.future.unstable_singleFetch && url.pathname.endsWith(".data")) { | ||
let handlerUrl = new URL(request.url); | ||
handlerUrl.pathname = handlerUrl.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/"); | ||
let singleFetchMatches = routeMatching.matchServerRoutes(routes, handlerUrl.pathname, _build.basename); | ||
response = await handleSingleFetchRequest(serverMode, _build, staticHandler, request, handlerUrl, loadContext, handleError); | ||
if (_build.entry.module.handleDataRequest) { | ||
response = await _build.entry.module.handleDataRequest(response, { | ||
context: loadContext, | ||
params: singleFetchMatches ? singleFetchMatches[0].params : {}, | ||
request | ||
}); | ||
if (responses.isRedirectResponse(response)) { | ||
let result = singleFetch.getSingleFetchRedirect(response.status, response.headers); | ||
if (request.method === "GET") { | ||
result = { | ||
[singleFetch.SingleFetchRedirectSymbol]: result | ||
}; | ||
} | ||
let headers = new Headers(response.headers); | ||
headers.set("Content-Type", "text/x-turbo"); | ||
return new Response(singleFetch.encodeViaTurboStream(result, request.signal, _build.entry.module.streamTimeout, serverMode), { | ||
status: singleFetch.SINGLE_FETCH_REDIRECT_STATUS, | ||
headers | ||
}); | ||
} | ||
} | ||
} else if (matches && matches[matches.length - 1].route.module.default == null && matches[matches.length - 1].route.module.ErrorBoundary == null) { | ||
response = await handleResourceRequestRR(serverMode, staticHandler, matches.slice(-1)[0].route.id, request, loadContext, handleError); | ||
response = await handleResourceRequest(serverMode, _build, staticHandler, matches.slice(-1)[0].route.id, request, loadContext, handleError); | ||
} else { | ||
response = await handleDocumentRequestRR(serverMode, build, staticHandler, request, loadContext, handleError); | ||
var _getDevServerHooks2, _getDevServerHooks2$g; | ||
let criticalCss = mode$1 === mode.ServerMode.Development ? await ((_getDevServerHooks2 = dev.getDevServerHooks()) === null || _getDevServerHooks2 === void 0 ? void 0 : (_getDevServerHooks2$g = _getDevServerHooks2.getCriticalCss) === null || _getDevServerHooks2$g === void 0 ? void 0 : _getDevServerHooks2$g.call(_getDevServerHooks2, _build, url.pathname)) : undefined; | ||
response = await handleDocumentRequest(serverMode, _build, staticHandler, request, loadContext, handleError, criticalCss); | ||
} | ||
@@ -75,3 +174,30 @@ if (request.method === "HEAD") { | ||
}; | ||
async function handleDataRequestRR(serverMode, staticHandler, routeId, request, loadContext, handleError) { | ||
async function handleManifestRequest(build, routes, url) { | ||
let data = { | ||
patches: {}, | ||
notFoundPaths: [] | ||
}; | ||
if (url.searchParams.has("p")) { | ||
for (let path of url.searchParams.getAll("p")) { | ||
let matches = routeMatching.matchServerRoutes(routes, path, build.basename); | ||
if (matches) { | ||
for (let match of matches) { | ||
let routeId = match.route.id; | ||
data.patches[routeId] = build.assets.routes[routeId]; | ||
} | ||
} else { | ||
data.notFoundPaths.push(path); | ||
} | ||
} | ||
return responses.json(data, { | ||
headers: { | ||
"Cache-Control": "public, max-age=31536000, immutable" | ||
} | ||
}); // Override the TypedResponse stuff from json() | ||
} | ||
return new Response("Invalid Request", { | ||
status: 400 | ||
}); | ||
} | ||
async function handleDataRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) { | ||
try { | ||
@@ -83,16 +209,3 @@ let response = await staticHandler.queryRoute(request, { | ||
if (responses.isRedirectResponse(response)) { | ||
// We don't have any way to prevent a fetch request from following | ||
// redirects. So we use the `X-Remix-Redirect` header to indicate the | ||
// next URL, and then "follow" the redirect manually on the client. | ||
let headers = new Headers(response.headers); | ||
headers.set("X-Remix-Redirect", headers.get("Location")); | ||
headers.set("X-Remix-Status", response.status); | ||
headers.delete("Location"); | ||
if (response.headers.get("Set-Cookie") !== null) { | ||
headers.set("X-Remix-Revalidate", "yes"); | ||
} | ||
return new Response(null, { | ||
status: 204, | ||
headers | ||
}); | ||
return createRemixRedirectResponse(response, build.basename); | ||
} | ||
@@ -114,16 +227,14 @@ if (router.UNSAFE_DEFERRED_SYMBOL in response) { | ||
// network errors that are missing this header | ||
response.headers.set("X-Remix-Response", "yes"); | ||
response = safelySetHeader(response, "X-Remix-Response", "yes"); | ||
return response; | ||
} catch (error) { | ||
if (responses.isResponse(error)) { | ||
error.headers.set("X-Remix-Catch", "yes"); | ||
return error; | ||
let response = safelySetHeader(error, "X-Remix-Catch", "yes"); | ||
return response; | ||
} | ||
if (router.isRouteErrorResponse(error)) { | ||
if (error.error) { | ||
handleError(error.error); | ||
} | ||
handleError(error); | ||
return errorResponseToJson(error, serverMode); | ||
} | ||
let errorInstance = error instanceof Error ? error : new Error("Unexpected Server Error"); | ||
let errorInstance = error instanceof Error || error instanceof DOMException ? error : new Error("Unexpected Server Error"); | ||
handleError(errorInstance); | ||
@@ -138,7 +249,29 @@ return router.json(errors.serializeError(errorInstance, serverMode), { | ||
} | ||
async function handleDocumentRequestRR(serverMode, build, staticHandler, request, loadContext, handleError) { | ||
async function handleSingleFetchRequest(serverMode, build, staticHandler, request, handlerUrl, loadContext, handleError) { | ||
let { | ||
result, | ||
headers, | ||
status | ||
} = request.method !== "GET" ? await singleFetch.singleFetchAction(serverMode, staticHandler, request, handlerUrl, loadContext, handleError) : await singleFetch.singleFetchLoaders(serverMode, staticHandler, request, handlerUrl, loadContext, handleError); | ||
// Mark all successful responses with a header so we can identify in-flight | ||
// network errors that are missing this header | ||
let resultHeaders = new Headers(headers); | ||
resultHeaders.set("X-Remix-Response", "yes"); | ||
resultHeaders.set("Content-Type", "text/x-turbo"); | ||
// Note: Deferred data is already just Promises, so we don't have to mess | ||
// `activeDeferreds` or anything :) | ||
return new Response(singleFetch.encodeViaTurboStream(result, request.signal, build.entry.module.streamTimeout, serverMode), { | ||
status: status || 200, | ||
headers: resultHeaders | ||
}); | ||
} | ||
async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, criticalCss) { | ||
let context; | ||
let responseStubs = singleFetch.getResponseStubs(); | ||
try { | ||
context = await staticHandler.query(request, { | ||
requestContext: loadContext | ||
requestContext: loadContext, | ||
unstable_dataStrategy: build.future.unstable_singleFetch ? singleFetch.getSingleFetchDataStrategy(responseStubs) : undefined | ||
}); | ||
@@ -154,2 +287,25 @@ } catch (error) { | ||
} | ||
let statusCode; | ||
let headers$1; | ||
if (build.future.unstable_singleFetch) { | ||
let merged = singleFetch.mergeResponseStubs(context, responseStubs); | ||
statusCode = merged.statusCode; | ||
headers$1 = merged.headers; | ||
if (responses.isRedirectStatusCode(statusCode) && headers$1.has("Location")) { | ||
return new Response(null, { | ||
status: statusCode, | ||
headers: headers$1 | ||
}); | ||
} | ||
if (context.errors) { | ||
for (let [routeId, error] of Object.entries(context.errors)) { | ||
if (singleFetch.isResponseStub(error)) { | ||
context.errors[routeId] = singleFetch.convertResponseStubToErrorResponse(error); | ||
} | ||
} | ||
} | ||
} else { | ||
statusCode = context.statusCode; | ||
headers$1 = headers.getDocumentHeaders(build, context); | ||
} | ||
@@ -159,3 +315,4 @@ // Sanitize errors outside of development environments | ||
Object.values(context.errors).forEach(err => { | ||
if (!router.isRouteErrorResponse(err) || err.error) { | ||
// @ts-expect-error `err.error` is "private" from users but intended for internal use | ||
if ((!router.isRouteErrorResponse(err) || err.error) && !singleFetch.isResponseStub(err)) { | ||
handleError(err); | ||
@@ -166,3 +323,11 @@ } | ||
} | ||
let headers$1 = headers.getDocumentHeadersRR(build, context); | ||
// Server UI state to send to the client. | ||
// - When single fetch is enabled, this is streamed down via `serverHandoffStream` | ||
// - Otherwise it's stringified into `serverHandoffString` | ||
let state = { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: errors.serializeErrors(context.errors, serverMode) | ||
}; | ||
let entryContext = { | ||
@@ -172,12 +337,19 @@ manifest: build.assets, | ||
staticHandlerContext: context, | ||
criticalCss, | ||
serverHandoffString: serverHandoff.createServerHandoffString({ | ||
url: context.location.pathname, | ||
state: { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: errors.serializeErrors(context.errors, serverMode) | ||
}, | ||
future: build.future | ||
basename: build.basename, | ||
criticalCss, | ||
future: build.future, | ||
isSpaMode: build.isSpaMode, | ||
...(!build.future.unstable_singleFetch ? { | ||
state | ||
} : null) | ||
}), | ||
...(build.future.unstable_singleFetch ? { | ||
serverHandoffStream: singleFetch.encodeViaTurboStream(state, request.signal, build.entry.module.streamTimeout, serverMode), | ||
renderMeta: {} | ||
} : null), | ||
future: build.future, | ||
isSpaMode: build.isSpaMode, | ||
serializeError: err => errors.serializeError(err, serverMode) | ||
@@ -187,8 +359,20 @@ }; | ||
try { | ||
return await handleDocumentRequestFunction(request, context.statusCode, headers$1, entryContext, loadContext); | ||
return await handleDocumentRequestFunction(request, statusCode, headers$1, entryContext, loadContext); | ||
} catch (error) { | ||
handleError(error); | ||
let errorForSecondRender = error; | ||
// If they threw a response, unwrap it into an ErrorResponse like we would | ||
// have for a loader/action | ||
if (responses.isResponse(error)) { | ||
try { | ||
let data = await unwrapResponse(error); | ||
errorForSecondRender = new router.UNSAFE_ErrorResponseImpl(error.status, error.statusText, data); | ||
} catch (e) { | ||
// If we can't unwrap the response - just leave it as-is | ||
} | ||
} | ||
// Get a new StaticHandlerContext that contains the error at the right boundary | ||
context = router.getStaticContextFromError(staticHandler.dataRoutes, context, error); | ||
context = router.getStaticContextFromError(staticHandler.dataRoutes, context, errorForSecondRender); | ||
@@ -200,3 +384,11 @@ // Sanitize errors outside of development environments | ||
// Update entryContext for the second render pass | ||
// Get a new entryContext for the second render pass | ||
// Server UI state to send to the client. | ||
// - When single fetch is enabled, this is streamed down via `serverHandoffStream` | ||
// - Otherwise it's stringified into `serverHandoffString` | ||
let state = { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: errors.serializeErrors(context.errors, serverMode) | ||
}; | ||
entryContext = { | ||
@@ -207,9 +399,13 @@ ...entryContext, | ||
url: context.location.pathname, | ||
state: { | ||
loaderData: context.loaderData, | ||
actionData: context.actionData, | ||
errors: errors.serializeErrors(context.errors, serverMode) | ||
}, | ||
future: build.future | ||
}) | ||
basename: build.basename, | ||
future: build.future, | ||
isSpaMode: build.isSpaMode, | ||
...(!build.future.unstable_singleFetch ? { | ||
state | ||
} : null) | ||
}), | ||
...(build.future.unstable_singleFetch ? { | ||
serverHandoffStream: singleFetch.encodeViaTurboStream(state, request.signal, build.entry.module.streamTimeout, serverMode), | ||
renderMeta: {} | ||
} : null) | ||
}; | ||
@@ -224,4 +420,5 @@ try { | ||
} | ||
async function handleResourceRequestRR(serverMode, staticHandler, routeId, request, loadContext, handleError) { | ||
async function handleResourceRequest(serverMode, build, staticHandler, routeId, request, loadContext, handleError) { | ||
try { | ||
let responseStubs = build.future.unstable_singleFetch ? singleFetch.getResponseStubs() : {}; | ||
// Note we keep the routeId here to align with the Remix handling of | ||
@@ -232,5 +429,41 @@ // resource routes which doesn't take ?index into account and just takes | ||
routeId, | ||
requestContext: loadContext | ||
requestContext: loadContext, | ||
...(build.future.unstable_singleFetch ? { | ||
unstable_dataStrategy: singleFetch.getSingleFetchResourceRouteDataStrategy({ | ||
responseStubs | ||
}) | ||
} : null) | ||
}); | ||
// callRouteLoader/callRouteAction always return responses | ||
if (typeof response === "object" && response !== null) { | ||
invariant["default"](!(router.UNSAFE_DEFERRED_SYMBOL in response), `You cannot return a \`defer()\` response from a Resource Route. Did you ` + `forget to export a default UI component from the "${routeId}" route?`); | ||
} | ||
if (build.future.unstable_singleFetch) { | ||
let stub = responseStubs[routeId]; | ||
if (responses.isResponse(response)) { | ||
// If a response was returned, we use it's status and we merge our | ||
// response stub headers onto it | ||
let ops = stub[singleFetch.ResponseStubOperationsSymbol]; | ||
for (let [op, ...args] of ops) { | ||
// @ts-expect-error | ||
response.headers[op](...args); | ||
} | ||
} else if (singleFetch.isResponseStub(response) || response == null) { | ||
// If the stub or null was returned, then there is no body so we just | ||
// proxy along the status/headers to a Response | ||
response = new Response(null, { | ||
status: stub.status, | ||
headers: stub.headers | ||
}); | ||
} else { | ||
console.warn(deprecations.resourceRouteJsonWarning(request.method === "GET" ? "loader" : "action", routeId)); | ||
// Otherwise we create a json Response using the stub | ||
response = responses.json(response, { | ||
status: stub.status, | ||
headers: stub.headers | ||
}); | ||
} | ||
} | ||
// callRouteLoader/callRouteAction always return responses (w/o single fetch). | ||
// With single fetch, users should always be Responses from resource routes | ||
invariant["default"](responses.isResponse(response), "Expected a Response to be returned from queryRoute"); | ||
@@ -242,8 +475,14 @@ return response; | ||
// match identically to what Remix returns | ||
error.headers.set("X-Remix-Catch", "yes"); | ||
return error; | ||
let response = safelySetHeader(error, "X-Remix-Catch", "yes"); | ||
return response; | ||
} | ||
if (singleFetch.isResponseStub(error)) { | ||
return new Response(null, { | ||
status: error.status, | ||
headers: error.headers | ||
}); | ||
} | ||
if (router.isRouteErrorResponse(error)) { | ||
if (error.error) { | ||
handleError(error.error); | ||
if (error) { | ||
handleError(error); | ||
} | ||
@@ -257,3 +496,5 @@ return errorResponseToJson(error, serverMode); | ||
function errorResponseToJson(errorResponse, serverMode) { | ||
return router.json(errors.serializeError(errorResponse.error || new Error("Unexpected Server Error"), serverMode), { | ||
return router.json(errors.serializeError( | ||
// @ts-expect-error This is "private" from users but intended for internal use | ||
errorResponse.error || new Error("Unexpected Server Error"), serverMode), { | ||
status: errorResponse.status, | ||
@@ -280,3 +521,42 @@ statusText: errorResponse.statusText, | ||
} | ||
function unwrapResponse(response) { | ||
let contentType = response.headers.get("Content-Type"); | ||
// Check between word boundaries instead of startsWith() due to the last | ||
// paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type | ||
return contentType && /\bapplication\/json\b/.test(contentType) ? response.body == null ? null : response.json() : response.text(); | ||
} | ||
function createRemixRedirectResponse(response, basename) { | ||
// We don't have any way to prevent a fetch request from following | ||
// redirects. So we use the `X-Remix-Redirect` header to indicate the | ||
// next URL, and then "follow" the redirect manually on the client. | ||
let headers = new Headers(response.headers); | ||
let redirectUrl = headers.get("Location"); | ||
headers.set("X-Remix-Redirect", basename ? router.stripBasename(redirectUrl, basename) || redirectUrl : redirectUrl); | ||
headers.set("X-Remix-Status", String(response.status)); | ||
headers.delete("Location"); | ||
if (response.headers.get("Set-Cookie") !== null) { | ||
headers.set("X-Remix-Revalidate", "yes"); | ||
} | ||
return new Response(null, { | ||
status: 204, | ||
headers | ||
}); | ||
} | ||
// Anytime we are setting a header on a `Response` created in the loader/action, | ||
// we have to so it in this manner since in an `undici` world, if the `Response` | ||
// came directly from a `fetch` call, the headers are immutable will throw if | ||
// we try to set a new header. This is a sort of shallow clone of the `Response` | ||
// so we can safely set our own header. | ||
function safelySetHeader(response, name, value) { | ||
let headers = new Headers(response.headers); | ||
headers.set(name, value); | ||
return new Response(response.body, { | ||
status: response.status, | ||
statusText: response.statusText, | ||
headers, | ||
duplex: response.body ? "half" : undefined | ||
}); | ||
} | ||
exports.createRequestHandler = createRequestHandler; |
@@ -5,6 +5,9 @@ import type { HydrationState } from "@remix-run/router"; | ||
export declare function createServerHandoffString<T>(serverHandoff: { | ||
state: ValidateShape<T, HydrationState>; | ||
state?: ValidateShape<T, HydrationState>; | ||
criticalCss?: string; | ||
url: string; | ||
basename: string | undefined; | ||
future: FutureConfig; | ||
isSpaMode: boolean; | ||
}): string; | ||
export {}; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -127,6 +127,7 @@ * Copyright (c) Remix Software Inc. | ||
} = session; | ||
let expires = (options === null || options === void 0 ? void 0 : options.maxAge) != null ? new Date(Date.now() + options.maxAge * 1000) : (options === null || options === void 0 ? void 0 : options.expires) != null ? options.expires : cookie.expires; | ||
if (id) { | ||
await updateData(id, data, cookie.expires); | ||
await updateData(id, data, expires); | ||
} else { | ||
id = await createData(data, cookie.expires); | ||
id = await createData(data, expires); | ||
} | ||
@@ -139,2 +140,3 @@ return cookie.serialize(id, options); | ||
...options, | ||
maxAge: undefined, | ||
expires: new Date(0) | ||
@@ -141,0 +143,0 @@ }); |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -48,2 +48,3 @@ * Copyright (c) Remix Software Inc. | ||
...options, | ||
maxAge: undefined, | ||
expires: new Date(0) | ||
@@ -50,0 +51,0 @@ }); |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -27,3 +27,2 @@ * Copyright (c) Remix Software Inc. | ||
} = {}) => { | ||
let uniqueId = 0; | ||
let map = new Map(); | ||
@@ -33,3 +32,3 @@ return createSessionStorage({ | ||
async createData(data, expires) { | ||
let id = (++uniqueId).toString(); | ||
let id = Math.random().toString(36).substring(2, 10); | ||
map.set(id, { | ||
@@ -36,0 +35,0 @@ data, |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
@@ -1,2 +0,2 @@ | ||
import type { UploadHandler } from "@remix-run/server-runtime"; | ||
import type { UploadHandler } from "../formData"; | ||
export type MemoryUploadHandlerFilterArgs = { | ||
@@ -3,0 +3,0 @@ filename?: string; |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-nightly-96b05af-20230816 | ||
* @remix-run/server-runtime v0.0.0-nightly-96ba8a25c-20240717 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
MIT License | ||
Copyright (c) Remix Software Inc. 2020-2021 | ||
Copyright (c) Shopify Inc. 2022-2023 | ||
Copyright (c) Shopify Inc. 2022-2024 | ||
@@ -6,0 +6,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "@remix-run/server-runtime", | ||
"version": "0.0.0-nightly-96b05af-20230816", | ||
"version": "0.0.0-nightly-96ba8a25c-20240717", | ||
"description": "Server runtime for Remix", | ||
@@ -19,12 +19,11 @@ "bugs": { | ||
"dependencies": { | ||
"@remix-run/router": "0.0.0-experimental-ad6954b7", | ||
"@types/cookie": "^0.4.1", | ||
"@remix-run/router": "1.18.0", | ||
"@types/cookie": "^0.6.0", | ||
"@web3-storage/multipart-parser": "^1.0.0", | ||
"cookie": "^0.4.1", | ||
"cookie": "^0.6.0", | ||
"set-cookie-parser": "^2.4.8", | ||
"source-map": "^0.7.3", | ||
"type-fest": "^4.0.0" | ||
"turbo-stream": "2.2.0" | ||
}, | ||
"devDependencies": { | ||
"@remix-run/web-file": "^3.0.3", | ||
"@types/set-cookie-parser": "^2.4.1", | ||
@@ -49,3 +48,6 @@ "typescript": "^5.1.6" | ||
"README.md" | ||
] | ||
} | ||
], | ||
"scripts": { | ||
"tsc": "tsc" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
84
5644
218627
+ Addedturbo-stream@2.2.0
+ Added@remix-run/router@1.18.0(transitive)
+ Added@types/cookie@0.6.0(transitive)
+ Addedcookie@0.6.0(transitive)
+ Addedturbo-stream@2.2.0(transitive)
- Removedtype-fest@^4.0.0
- Removed@remix-run/router@0.0.0-experimental-ad6954b7(transitive)
- Removed@types/cookie@0.4.1(transitive)
- Removedcookie@0.4.2(transitive)
- Removedtype-fest@4.32.0(transitive)
Updated@remix-run/router@1.18.0
Updated@types/cookie@^0.6.0
Updatedcookie@^0.6.0