Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@remix-run/server-runtime

Package Overview
Dependencies
Maintainers
2
Versions
1042
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/server-runtime - npm Package Compare versions

Comparing version 0.0.0-experimental-50540dc7 to 0.0.0-experimental-52edfc8c

13

cookies.d.ts

@@ -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;

25

cookies.js
/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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";

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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\`.`);
}

@@ -95,0 +95,0 @@

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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\`.`);
}

@@ -91,0 +91,0 @@

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -283,3 +283,3 @@ * Copyright (c) Remix Software Inc.

appState.error = undefined;
let routeLoaderResponses = [];
let routeLoaderResponses = {};
let loaderStatusCodes = [];

@@ -330,3 +330,3 @@ let routeData = {};

} else if (response) {
routeLoaderResponses.push(response);
routeLoaderResponses[match.route.id] = response;
loaderStatusCodes.push(response.status);

@@ -333,0 +333,0 @@

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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
*/

@@ -132,5 +142,5 @@ function createSessionStorage({

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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -22,2 +22,4 @@ * Copyright (c) Remix Software Inc.

* browser's maximum cookie size. Trade-offs!
*
* @see https://remix.run/api/remix#createcookiesessionstorage
*/

@@ -24,0 +26,0 @@ function createCookieSessionStorage({

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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({

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

{
"name": "@remix-run/server-runtime",
"description": "Server runtime for Remix",
"version": "0.0.0-experimental-50540dc7",
"version": "0.0.0-experimental-52edfc8c",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "./index.js",

/**
* 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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -287,3 +287,3 @@ * Copyright (c) Remix Software Inc.

appState.error = undefined;
let routeLoaderResponses = [];
let routeLoaderResponses = {};
let loaderStatusCodes = [];

@@ -334,3 +334,3 @@ let routeData = {};

} else if (response) {
routeLoaderResponses.push(response);
routeLoaderResponses[match.route.id] = response;
loaderStatusCodes.push(response.status);

@@ -337,0 +337,0 @@

/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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 warnOnceAboutSigningSessionCookie(cookie: Cookie): void;
/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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
*/

@@ -136,3 +146,3 @@ function createSessionStorage({

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.`);
}

@@ -139,0 +149,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 {};
/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -26,2 +26,4 @@ * Copyright (c) Remix Software Inc.

* browser's maximum cookie size. Trade-offs!
*
* @see https://remix.run/api/remix#createcookiesessionstorage
*/

@@ -28,0 +30,0 @@ function createCookieSessionStorage({

@@ -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 {};
/**
* @remix-run/server-runtime v0.0.0-experimental-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -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-50540dc7
* @remix-run/server-runtime v0.0.0-experimental-52edfc8c
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc