@remix-run/server-runtime
Advanced tools
Comparing version 0.0.0-experimental-f88eb375 to 0.0.0-experimental-fb9e523a
@@ -23,2 +23,4 @@ import type { CookieParseOptions, CookieSerializeOptions } from "cookie"; | ||
* parsing/encoding multiple different values. | ||
* | ||
* @see https://remix.run/api/remix#cookie-api | ||
*/ | ||
@@ -53,5 +55,12 @@ export interface Cookie { | ||
/** | ||
* Creates and returns a new Cookie. | ||
* Creates a logical container for managing a browser cookie from the server. | ||
* | ||
* @see https://remix.run/api/remix#createcookie | ||
*/ | ||
export declare function createCookie(name: string, { secrets, ...options }?: CookieOptions): Cookie; | ||
export declare function createCookie(name: string, cookieOptions?: CookieOptions): Cookie; | ||
/** | ||
* Returns true if an object is a Remix cookie container. | ||
* | ||
* @see https://remix.run/api/remix#iscookie | ||
*/ | ||
export declare function isCookie(object: any): object is Cookie; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -18,8 +18,15 @@ * Copyright (c) Remix Software Inc. | ||
/** | ||
* Creates and returns a new Cookie. | ||
* Creates a logical container for managing a browser cookie from the server. | ||
* | ||
* @see https://remix.run/api/remix#createcookie | ||
*/ | ||
function createCookie(name, { | ||
secrets = [], | ||
...options | ||
} = {}) { | ||
function createCookie(name, cookieOptions = {}) { | ||
let { | ||
secrets, | ||
...options | ||
} = { | ||
secrets: [], | ||
path: "/", | ||
...cookieOptions | ||
}; | ||
return { | ||
@@ -55,2 +62,8 @@ get name() { | ||
} | ||
/** | ||
* Returns true if an object is a Remix cookie container. | ||
* | ||
* @see https://remix.run/api/remix#iscookie | ||
*/ | ||
function isCookie(object) { | ||
@@ -57,0 +70,0 @@ return object != null && typeof object.name === "string" && typeof object.isSigned === "boolean" && typeof object.parse === "function" && typeof object.serialize === "function"; |
@@ -12,3 +12,3 @@ import type { RouteMatch } from "./routeMatching"; | ||
export declare type AppData = any; | ||
export declare function callRouteAction({ loadContext, match, request }: { | ||
export declare function callRouteAction({ loadContext, match, request, }: { | ||
loadContext: unknown; | ||
@@ -18,3 +18,3 @@ match: RouteMatch<ServerRoute>; | ||
}): Promise<Response>; | ||
export declare function callRouteLoader({ loadContext, match, request }: { | ||
export declare function callRouteLoader({ loadContext, match, request, }: { | ||
request: Request; | ||
@@ -21,0 +21,0 @@ match: RouteMatch<ServerRoute>; |
10
data.js
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -37,3 +37,3 @@ * Copyright (c) Remix Software Inc. | ||
result = await action({ | ||
request: stripDataParam(stripIndexParam(request.clone())), | ||
request: stripDataParam(stripIndexParam(request)), | ||
context: loadContext, | ||
@@ -92,3 +92,3 @@ params: match.params | ||
if (result === undefined) { | ||
throw new Error(`You defined an action for route "${match.route.id}" but didn't return ` + `anything from your \`action\` function. Please return a value or \`null\`.`); | ||
throw new Error(`You defined a loader for route "${match.route.id}" but didn't return ` + `anything from your \`loader\` function. Please return a value or \`null\`.`); | ||
} | ||
@@ -115,3 +115,3 @@ | ||
return new Request(url.toString(), request); | ||
return new Request(url.href, request); | ||
} | ||
@@ -122,3 +122,3 @@ | ||
url.searchParams.delete("_data"); | ||
return new Request(url.toString(), request); | ||
return new Request(url.href, request); | ||
} | ||
@@ -125,0 +125,0 @@ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -14,8 +14,15 @@ * Copyright (c) Remix Software Inc. | ||
/** | ||
* Creates and returns a new Cookie. | ||
* Creates a logical container for managing a browser cookie from the server. | ||
* | ||
* @see https://remix.run/api/remix#createcookie | ||
*/ | ||
function createCookie(name, { | ||
secrets = [], | ||
...options | ||
} = {}) { | ||
function createCookie(name, cookieOptions = {}) { | ||
let { | ||
secrets, | ||
...options | ||
} = { | ||
secrets: [], | ||
path: "/", | ||
...cookieOptions | ||
}; | ||
return { | ||
@@ -51,2 +58,8 @@ get name() { | ||
} | ||
/** | ||
* Returns true if an object is a Remix cookie container. | ||
* | ||
* @see https://remix.run/api/remix#iscookie | ||
*/ | ||
function isCookie(object) { | ||
@@ -53,0 +66,0 @@ return object != null && typeof object.name === "string" && typeof object.isSigned === "boolean" && typeof object.parse === "function" && typeof object.serialize === "function"; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -33,3 +33,3 @@ * Copyright (c) Remix Software Inc. | ||
result = await action({ | ||
request: stripDataParam(stripIndexParam(request.clone())), | ||
request: stripDataParam(stripIndexParam(request)), | ||
context: loadContext, | ||
@@ -88,3 +88,3 @@ params: match.params | ||
if (result === undefined) { | ||
throw new Error(`You defined an action for route "${match.route.id}" but didn't return ` + `anything from your \`action\` function. Please return a value or \`null\`.`); | ||
throw new Error(`You defined a loader for route "${match.route.id}" but didn't return ` + `anything from your \`loader\` function. Please return a value or \`null\`.`); | ||
} | ||
@@ -111,3 +111,3 @@ | ||
return new Request(url.toString(), request); | ||
return new Request(url.href, request); | ||
} | ||
@@ -118,3 +118,3 @@ | ||
url.searchParams.delete("_data"); | ||
return new Request(url.toString(), request); | ||
return new Request(url.href, request); | ||
} | ||
@@ -121,0 +121,0 @@ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -16,3 +16,4 @@ * Copyright (c) Remix Software Inc. | ||
let routeModule = build.routes[match.route.id].module; | ||
let loaderHeaders = routeLoaderResponses[index] ? routeLoaderResponses[index].headers : new Headers(); | ||
let routeLoaderResponse = routeLoaderResponses[match.route.id]; | ||
let loaderHeaders = routeLoaderResponse ? routeLoaderResponse.headers : new Headers(); | ||
let actionHeaders = actionResponse ? actionResponse.headers : new Headers(); | ||
@@ -19,0 +20,0 @@ let headers = new Headers(routeModule.headers ? typeof routeModule.headers === "function" ? routeModule.headers({ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -12,3 +12,6 @@ * Copyright (c) Remix Software Inc. | ||
/** | ||
* A JSON response. Converts `data` to JSON and sets the `Content-Type` header. | ||
* This is a shortcut for creating `application/json` responses. Converts `data` | ||
* to JSON and sets the `Content-Type` header. | ||
* | ||
* @see https://remix.run/api/remix#json | ||
*/ | ||
@@ -37,2 +40,4 @@ function json(data, init = {}) { | ||
* Defaults to "302 Found". | ||
* | ||
* @see https://remix.run/api/remix#redirect | ||
*/ | ||
@@ -39,0 +44,0 @@ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -105,3 +105,3 @@ * Copyright (c) Remix Software Inc. | ||
if (isActionRequest(request)) { | ||
match = getActionRequestMatch(url, matches); | ||
match = getRequestMatch(url, matches); | ||
response = await callRouteAction({ | ||
@@ -210,3 +210,3 @@ loadContext, | ||
if (matches && isActionRequest(request)) { | ||
actionMatch = getActionRequestMatch(url, matches); | ||
actionMatch = getRequestMatch(url, matches); | ||
@@ -285,3 +285,3 @@ try { | ||
appState.error = undefined; | ||
let routeLoaderResponses = []; | ||
let routeLoaderResponses = {}; | ||
let loaderStatusCodes = []; | ||
@@ -332,3 +332,3 @@ let routeData = {}; | ||
} else if (response) { | ||
routeLoaderResponses.push(response); | ||
routeLoaderResponses[match.route.id] = response; | ||
loaderStatusCodes.push(response.status); | ||
@@ -374,3 +374,3 @@ | ||
if (root && root.module.CatchBoundary) { | ||
if (root !== null && root !== void 0 && root.module.CatchBoundary) { | ||
appState.catchBoundaryRouteId = "root"; | ||
@@ -526,14 +526,17 @@ renderableMatches.push({ | ||
function isIndexRequestUrl(url) { | ||
let indexRequest = false; | ||
for (let param of url.searchParams.getAll("index")) { | ||
if (!param) { | ||
indexRequest = true; | ||
// only use bare `?index` params without a value | ||
// ✅ /foo?index | ||
// ✅ /foo?index&index=123 | ||
// ✅ /foo?index=123&index | ||
// ❌ /foo?index=123 | ||
if (param === "") { | ||
return true; | ||
} | ||
} | ||
return indexRequest; | ||
return false; | ||
} | ||
function getActionRequestMatch(url, matches) { | ||
function getRequestMatch(url, matches) { | ||
let match = matches.slice(-1)[0]; | ||
@@ -540,0 +543,0 @@ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -26,2 +26,4 @@ * Copyright (c) Remix Software Inc. | ||
* Instead, use a `SessionStorage` object's `getSession` method. | ||
* | ||
* @see https://remix.run/api/remix#createsession | ||
*/ | ||
@@ -72,2 +74,8 @@ | ||
} | ||
/** | ||
* Returns true if an object is a Remix session. | ||
* | ||
* @see https://remix.run/api/remix#issession | ||
*/ | ||
function isSession(object) { | ||
@@ -89,2 +97,4 @@ return object != null && typeof object.id === "string" && typeof object.data !== "undefined" && typeof object.has === "function" && typeof object.get === "function" && typeof object.set === "function" && typeof object.flash === "function" && typeof object.unset === "function"; | ||
* existing session storage options meet your requirements. | ||
* | ||
* @see https://remix.run/api/remix#createsessionstorage | ||
*/ | ||
@@ -98,3 +108,3 @@ function createSessionStorage({ | ||
}) { | ||
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg && cookieArg.name || "__session", cookieArg); | ||
let cookie = isCookie(cookieArg) ? cookieArg : createCookie((cookieArg === null || cookieArg === void 0 ? void 0 : cookieArg.name) || "__session", cookieArg); | ||
warnOnceAboutSigningSessionCookie(cookie); | ||
@@ -133,5 +143,5 @@ return { | ||
function warnOnceAboutSigningSessionCookie(cookie) { | ||
warnOnce(cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be ` + `signed to prevent tampering on the client before they are sent back to the ` + `server. See https://remix.run/docs/en/v1/api/remix#signing-cookies ` + `for more information.`); | ||
warnOnce(cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be ` + `signed to prevent tampering on the client before they are sent back to the ` + `server. See https://remix.run/api/remix#signing-cookies ` + `for more information.`); | ||
} | ||
export { createSession, createSessionStorage, isSession, warnOnceAboutSigningSessionCookie }; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -22,2 +22,4 @@ * Copyright (c) Remix Software Inc. | ||
* browser's maximum cookie size. Trade-offs! | ||
* | ||
* @see https://remix.run/api/remix#createcookiesessionstorage | ||
*/ | ||
@@ -27,3 +29,3 @@ function createCookieSessionStorage({ | ||
} = {}) { | ||
let cookie = isCookie(cookieArg) ? cookieArg : createCookie(cookieArg && cookieArg.name || "__session", cookieArg); | ||
let cookie = isCookie(cookieArg) ? cookieArg : createCookie((cookieArg === null || cookieArg === void 0 ? void 0 : cookieArg.name) || "__session", cookieArg); | ||
warnOnceAboutSigningSessionCookie(cookie); | ||
@@ -30,0 +32,0 @@ return { |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -19,2 +19,4 @@ * Copyright (c) Remix Software Inc. | ||
* suitable for most production scenarios. | ||
* | ||
* @see https://remix.run/api/remix#creatememorysessionstorage | ||
*/ | ||
@@ -21,0 +23,0 @@ function createMemorySessionStorage({ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
import type { ServerBuild } from "./build"; | ||
import type { ServerRoute } from "./routes"; | ||
import type { RouteMatch } from "./routeMatching"; | ||
export declare function getDocumentHeaders(build: ServerBuild, matches: RouteMatch<ServerRoute>[], routeLoaderResponses: Response[], actionResponse?: Response): Headers; | ||
export declare function getDocumentHeaders(build: ServerBuild, matches: RouteMatch<ServerRoute>[], routeLoaderResponses: Record<string, Response>, actionResponse?: Response): Headers; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -20,3 +20,4 @@ * Copyright (c) Remix Software Inc. | ||
let routeModule = build.routes[match.route.id].module; | ||
let loaderHeaders = routeLoaderResponses[index] ? routeLoaderResponses[index].headers : new Headers(); | ||
let routeLoaderResponse = routeLoaderResponses[match.route.id]; | ||
let loaderHeaders = routeLoaderResponse ? routeLoaderResponse.headers : new Headers(); | ||
let actionHeaders = actionResponse ? actionResponse.headers : new Headers(); | ||
@@ -23,0 +24,0 @@ let headers = new Headers(routeModule.headers ? typeof routeModule.headers === "function" ? routeModule.headers({ |
@@ -1,15 +0,15 @@ | ||
export type { ServerBuild, ServerEntryModule, HandleDataRequestFunction, HandleDocumentRequestFunction } from "./build"; | ||
export type { CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, CookieOptions, Cookie } from "./cookies"; | ||
export type { ServerBuild, ServerEntryModule, HandleDataRequestFunction, HandleDocumentRequestFunction, } from "./build"; | ||
export type { CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, CookieOptions, Cookie, } from "./cookies"; | ||
export { createCookie, isCookie } from "./cookies"; | ||
export type { AppLoadContext, AppData } from "./data"; | ||
export type { EntryContext } from "./entry"; | ||
export type { LinkDescriptor, HtmlLinkDescriptor, PageLinkDescriptor } from "./links"; | ||
export type { LinkDescriptor, HtmlLinkDescriptor, PageLinkDescriptor, } from "./links"; | ||
export type { ServerPlatform } from "./platform"; | ||
export type { ActionFunction, DataFunctionArgs, ErrorBoundaryComponent, HeadersFunction, HtmlMetaDescriptor, LinksFunction, LoaderFunction, MetaDescriptor, MetaFunction, RouteComponent, RouteHandle } from "./routeModules"; | ||
export type { ActionFunction, DataFunctionArgs, ErrorBoundaryComponent, HeadersFunction, HtmlMetaDescriptor, LinksFunction, LoaderFunction, MetaDescriptor, MetaFunction, RouteComponent, RouteHandle, } from "./routeModules"; | ||
export { json, redirect } from "./responses"; | ||
export type { RequestHandler } from "./server"; | ||
export { createRequestHandler } from "./server"; | ||
export type { SessionData, Session, SessionStorage, SessionIdStorageStrategy } from "./sessions"; | ||
export type { SessionData, Session, SessionStorage, SessionIdStorageStrategy, } from "./sessions"; | ||
export { createSession, isSession, createSessionStorage } from "./sessions"; | ||
export { createCookieSessionStorage } from "./sessions/cookieStorage"; | ||
export { createMemorySessionStorage } from "./sessions/memoryStorage"; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
{ | ||
"name": "@remix-run/server-runtime", | ||
"description": "Server runtime for Remix", | ||
"version": "0.0.0-experimental-f88eb375", | ||
"version": "0.0.0-experimental-fb9e523a", | ||
"license": "MIT", | ||
@@ -20,3 +20,3 @@ "main": "./index.js", | ||
"jsesc": "^3.0.1", | ||
"react-router-dom": "^6.1.1", | ||
"react-router-dom": "^6.2.2", | ||
"set-cookie-parser": "^2.4.8", | ||
@@ -23,0 +23,0 @@ "source-map": "^0.7.3" |
@@ -7,5 +7,6 @@ /** | ||
* | ||
* An example of this is error beautification as it depends on loading sourcemaps from | ||
* the file system in node, while functions hosted on cloudflare workers will not need | ||
* to format as they have built in sourcemap support. | ||
* The origional use of this was error beautification as it depends on loading sourcemaps | ||
* from the file system in node, while functions hosted on cloudflare workers will not | ||
* need to format as they have built in sourcemap support. This is no longer needed though | ||
* as we utlize the `source-map-support` library to do this for us. | ||
*/ | ||
@@ -16,3 +17,2 @@ /** | ||
export interface ServerPlatform { | ||
formatServerError?(error: Error): Promise<Error>; | ||
} |
/** | ||
* A JSON response. Converts `data` to JSON and sets the `Content-Type` header. | ||
* This is a shortcut for creating `application/json` responses. Converts `data` | ||
* to JSON and sets the `Content-Type` header. | ||
* | ||
* @see https://remix.run/api/remix#json | ||
*/ | ||
@@ -8,2 +11,4 @@ export declare function json<Data>(data: Data, init?: number | ResponseInit): Response; | ||
* Defaults to "302 Found". | ||
* | ||
* @see https://remix.run/api/remix#redirect | ||
*/ | ||
@@ -10,0 +15,0 @@ export declare function redirect(url: string, init?: number | ResponseInit): Response; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -16,3 +16,6 @@ * Copyright (c) Remix Software Inc. | ||
/** | ||
* A JSON response. Converts `data` to JSON and sets the `Content-Type` header. | ||
* This is a shortcut for creating `application/json` responses. Converts `data` | ||
* to JSON and sets the `Content-Type` header. | ||
* | ||
* @see https://remix.run/api/remix#json | ||
*/ | ||
@@ -41,2 +44,4 @@ function json(data, init = {}) { | ||
* Defaults to "302 Found". | ||
* | ||
* @see https://remix.run/api/remix#redirect | ||
*/ | ||
@@ -43,0 +48,0 @@ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -109,3 +109,3 @@ * Copyright (c) Remix Software Inc. | ||
if (isActionRequest(request)) { | ||
match = getActionRequestMatch(url, matches); | ||
match = getRequestMatch(url, matches); | ||
response = await data.callRouteAction({ | ||
@@ -214,3 +214,3 @@ loadContext, | ||
if (matches && isActionRequest(request)) { | ||
actionMatch = getActionRequestMatch(url, matches); | ||
actionMatch = getRequestMatch(url, matches); | ||
@@ -289,3 +289,3 @@ try { | ||
appState.error = undefined; | ||
let routeLoaderResponses = []; | ||
let routeLoaderResponses = {}; | ||
let loaderStatusCodes = []; | ||
@@ -336,3 +336,3 @@ let routeData = {}; | ||
} else if (response) { | ||
routeLoaderResponses.push(response); | ||
routeLoaderResponses[match.route.id] = response; | ||
loaderStatusCodes.push(response.status); | ||
@@ -378,3 +378,3 @@ | ||
if (root && root.module.CatchBoundary) { | ||
if (root !== null && root !== void 0 && root.module.CatchBoundary) { | ||
appState.catchBoundaryRouteId = "root"; | ||
@@ -530,14 +530,17 @@ renderableMatches.push({ | ||
function isIndexRequestUrl(url) { | ||
let indexRequest = false; | ||
for (let param of url.searchParams.getAll("index")) { | ||
if (!param) { | ||
indexRequest = true; | ||
// only use bare `?index` params without a value | ||
// ✅ /foo?index | ||
// ✅ /foo?index&index=123 | ||
// ✅ /foo?index=123&index | ||
// ❌ /foo?index=123 | ||
if (param === "") { | ||
return true; | ||
} | ||
} | ||
return indexRequest; | ||
return false; | ||
} | ||
function getActionRequestMatch(url, matches) { | ||
function getRequestMatch(url, matches) { | ||
let match = matches.slice(-1)[0]; | ||
@@ -544,0 +547,0 @@ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
@@ -11,2 +11,4 @@ import type { CookieParseOptions, CookieSerializeOptions } from "cookie"; | ||
* Session persists data across HTTP requests. | ||
* | ||
* @see https://remix.run/api/remix#session-api | ||
*/ | ||
@@ -56,4 +58,11 @@ export interface Session { | ||
* Instead, use a `SessionStorage` object's `getSession` method. | ||
* | ||
* @see https://remix.run/api/remix#createsession | ||
*/ | ||
export declare function createSession(initialData?: SessionData, id?: string): Session; | ||
/** | ||
* Returns true if an object is a Remix session. | ||
* | ||
* @see https://remix.run/api/remix#issession | ||
*/ | ||
export declare function isSession(object: any): object is Session; | ||
@@ -124,4 +133,6 @@ /** | ||
* existing session storage options meet your requirements. | ||
* | ||
* @see https://remix.run/api/remix#createsessionstorage | ||
*/ | ||
export declare function createSessionStorage({ cookie: cookieArg, createData, readData, updateData, deleteData }: SessionIdStorageStrategy): SessionStorage; | ||
export declare function createSessionStorage({ cookie: cookieArg, createData, readData, updateData, deleteData, }: SessionIdStorageStrategy): SessionStorage; | ||
export declare function warnOnceAboutSigningSessionCookie(cookie: Cookie): void; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -30,2 +30,4 @@ * Copyright (c) Remix Software Inc. | ||
* Instead, use a `SessionStorage` object's `getSession` method. | ||
* | ||
* @see https://remix.run/api/remix#createsession | ||
*/ | ||
@@ -76,2 +78,8 @@ | ||
} | ||
/** | ||
* Returns true if an object is a Remix session. | ||
* | ||
* @see https://remix.run/api/remix#issession | ||
*/ | ||
function isSession(object) { | ||
@@ -93,2 +101,4 @@ return object != null && typeof object.id === "string" && typeof object.data !== "undefined" && typeof object.has === "function" && typeof object.get === "function" && typeof object.set === "function" && typeof object.flash === "function" && typeof object.unset === "function"; | ||
* existing session storage options meet your requirements. | ||
* | ||
* @see https://remix.run/api/remix#createsessionstorage | ||
*/ | ||
@@ -102,3 +112,3 @@ function createSessionStorage({ | ||
}) { | ||
let cookie = cookies.isCookie(cookieArg) ? cookieArg : cookies.createCookie(cookieArg && cookieArg.name || "__session", cookieArg); | ||
let cookie = cookies.isCookie(cookieArg) ? cookieArg : cookies.createCookie((cookieArg === null || cookieArg === void 0 ? void 0 : cookieArg.name) || "__session", cookieArg); | ||
warnOnceAboutSigningSessionCookie(cookie); | ||
@@ -137,3 +147,3 @@ return { | ||
function warnOnceAboutSigningSessionCookie(cookie) { | ||
warnings.warnOnce(cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be ` + `signed to prevent tampering on the client before they are sent back to the ` + `server. See https://remix.run/docs/en/v1/api/remix#signing-cookies ` + `for more information.`); | ||
warnings.warnOnce(cookie.isSigned, `The "${cookie.name}" cookie is not signed, but session cookies should be ` + `signed to prevent tampering on the client before they are sent back to the ` + `server. See https://remix.run/api/remix#signing-cookies ` + `for more information.`); | ||
} | ||
@@ -140,0 +150,0 @@ |
@@ -17,4 +17,6 @@ import type { SessionStorage, SessionIdStorageStrategy } from "../sessions"; | ||
* browser's maximum cookie size. Trade-offs! | ||
* | ||
* @see https://remix.run/api/remix#createcookiesessionstorage | ||
*/ | ||
export declare function createCookieSessionStorage({ cookie: cookieArg }?: CookieSessionStorageOptions): SessionStorage; | ||
export declare function createCookieSessionStorage({ cookie: cookieArg, }?: CookieSessionStorageOptions): SessionStorage; | ||
export {}; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -26,2 +26,4 @@ * Copyright (c) Remix Software Inc. | ||
* browser's maximum cookie size. Trade-offs! | ||
* | ||
* @see https://remix.run/api/remix#createcookiesessionstorage | ||
*/ | ||
@@ -31,3 +33,3 @@ function createCookieSessionStorage({ | ||
} = {}) { | ||
let cookie = cookies.isCookie(cookieArg) ? cookieArg : cookies.createCookie(cookieArg && cookieArg.name || "__session", cookieArg); | ||
let cookie = cookies.isCookie(cookieArg) ? cookieArg : cookies.createCookie((cookieArg === null || cookieArg === void 0 ? void 0 : cookieArg.name) || "__session", cookieArg); | ||
sessions.warnOnceAboutSigningSessionCookie(cookie); | ||
@@ -34,0 +36,0 @@ return { |
@@ -15,4 +15,6 @@ import type { SessionStorage, SessionIdStorageStrategy } from "../sessions"; | ||
* suitable for most production scenarios. | ||
* | ||
* @see https://remix.run/api/remix#creatememorysessionstorage | ||
*/ | ||
export declare function createMemorySessionStorage({ cookie }?: MemorySessionStorageOptions): SessionStorage; | ||
export declare function createMemorySessionStorage({ cookie, }?: MemorySessionStorageOptions): SessionStorage; | ||
export {}; |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -23,2 +23,4 @@ * Copyright (c) Remix Software Inc. | ||
* suitable for most production scenarios. | ||
* | ||
* @see https://remix.run/api/remix#creatememorysessionstorage | ||
*/ | ||
@@ -25,0 +27,0 @@ function createMemorySessionStorage({ |
/** | ||
* @remix-run/server-runtime v0.0.0-experimental-f88eb375 | ||
* @remix-run/server-runtime v0.0.0-experimental-fb9e523a | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
114761
3224
Updatedreact-router-dom@^6.2.2