You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@react-router/node

Package Overview
Dependencies
Maintainers
1
Versions
682
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-router/node - npm Package Compare versions

Comparing version
0.0.0-experimental-5509a3c42
to
0.0.0-experimental-56b72276e
+250
-11
CHANGELOG.md
# `@react-router/node`
## 7.13.0
### Patch Changes
- Updated dependencies:
- `react-router@7.13.0`
## 7.12.0
### Patch Changes
- Updated dependencies:
- `react-router@7.12.0`
## 7.11.0
### Patch Changes
- Updated dependencies:
- `react-router@7.11.0`
## 7.10.1
### Patch Changes
- Updated dependencies:
- `react-router@7.10.1`
## 7.10.0
### Patch Changes
- Updated dependencies:
- `react-router@7.10.0`
## 7.9.6
### Patch Changes
- Updated dependencies:
- `react-router@7.9.6`
## 7.9.5
### Patch Changes
- Updated dependencies:
- `react-router@7.9.5`
## 7.9.4
### Patch Changes
- Validate format of incoming session ids in `createFileSessionStorage` ([#14426](https://github.com/remix-run/react-router/pull/14426))
- Updated dependencies:
- `react-router@7.9.4`
## 7.9.3
### Patch Changes
- Updated dependencies:
- `react-router@7.9.3`
## 7.9.2
### Patch Changes
- Updated dependencies:
- `react-router@7.9.2`
## 7.9.1
### Patch Changes
- Updated dependencies:
- `react-router@7.9.1`
## 7.9.0
### Minor Changes
- Stabilize middleware and context APIs. ([#14215](https://github.com/remix-run/react-router/pull/14215))
We have removed the `unstable_` prefix from the following APIs and they are now considered stable and ready for production use:
- [`RouterContextProvider`](https://reactrouter.com/api/utils/RouterContextProvider)
- [`createContext`](https://reactrouter.com/api/utils/createContext)
- `createBrowserRouter` [`getContext`](https://reactrouter.com/api/data-routers/createBrowserRouter#optsgetcontext) option
- `<HydratedRouter>` [`getContext`](https://reactrouter.com/api/framework-routers/HydratedRouter#getcontext) prop
Please see the [Middleware Docs](https://reactrouter.com/how-to/middleware), the [Middleware RFC](https://github.com/remix-run/remix/discussions/7642), and the [Client-side Context RFC](https://github.com/remix-run/react-router/discussions/9856) for more information.
### Patch Changes
- Updated dependencies:
- `react-router@7.9.0`
## 7.8.2
### Patch Changes
- Updated dependencies:
- `react-router@7.8.2`
## 7.8.1
### Patch Changes
- Updated dependencies:
- `react-router@7.8.1`
## 7.8.0
### Patch Changes
- \[UNSTABLE] Change `getLoadContext` signature (`type GetLoadContextFunction`) when `future.unstable_middleware` is enabled so that it returns an `unstable_RouterContextProvider` instance instead of a `Map` used to contruct the instance internally ([#14097](https://github.com/remix-run/react-router/pull/14097))
- This also removes the `type unstable_InitialContext` export
- ⚠️ This is a breaking change if you have adopted middleware and are using a custom server with a `getLoadContext` function
- Updated dependencies:
- `react-router@7.8.0`
## 7.7.1
### Patch Changes
- Updated dependencies:
- `react-router@7.7.1`
## 7.7.0
### Patch Changes
- Updated dependencies:
- `react-router@7.7.0`
## 7.6.3
### Patch Changes
- Remove old "install" package exports ([#13762](https://github.com/remix-run/react-router/pull/13762))
- Updated dependencies:
- `react-router@7.6.3`
## 7.6.2
### Patch Changes
- Updated dependencies:
- `react-router@7.6.2`
## 7.6.1
### Patch Changes
- Updated dependencies:
- `react-router@7.6.1`
## 7.6.0
### Patch Changes
- Updated dependencies:
- `react-router@7.6.0`
## 7.5.3
### Patch Changes
- Updated dependencies:
- `react-router@7.5.3`
## 7.5.2
### Patch Changes
- Updated dependencies:
- `react-router@7.5.2`
## 7.5.1
### Patch Changes
- Updated dependencies:
- `react-router@7.5.1`
## 7.5.0
### Patch Changes
- Updated dependencies:
- `react-router@7.5.0`
## 7.4.1
### Patch Changes
- Updated dependencies:
- `react-router@7.4.1`
## 7.4.0
### Patch Changes
- Updated dependencies:
- `react-router@7.4.0`
## 7.3.0
### Patch Changes
- Updated dependencies:
- `react-router@7.3.0`
## 7.2.0
### Patch Changes
- Updated dependencies:
- `react-router@7.2.0`
## 7.1.5
### Patch Changes
- Updated dependencies:
- `react-router@7.1.5`
## 7.1.4
### Patch Changes
- Updated dependencies:
- `react-router@7.1.4`
## 7.1.3
### Patch Changes
- Updated dependencies:
- `react-router@7.1.3`
## 7.1.2
### Patch Changes
- Updated dependencies:
- `react-router@7.1.2`
## 7.1.1

@@ -35,6 +284,5 @@

- Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
- Remove single fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
- For Remix consumers migrating to React Router, the `crypto` global from the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) is now required when using cookie and session APIs. This means that the following APIs are provided from `react-router` rather than platform-specific packages: ([#11837](https://github.com/remix-run/react-router/pull/11837))
- `createCookie`

@@ -48,3 +296,2 @@ - `createCookieSessionStorage`

Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
- `createCookieFactory`

@@ -62,3 +309,2 @@ - `createSessionStorageFactory`

- Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
- Remove `installGlobals()` as this should no longer be necessary

@@ -210,3 +456,2 @@

- Removed/adjusted types to prefer `unknown` over `any` and to align with underlying React Router types ([#7319](https://github.com/remix-run/remix/pull/7319), [#7354](https://github.com/remix-run/remix/pull/7354)):
- Renamed the `useMatches()` return type from `RouteMatch` to `UIMatch`

@@ -223,7 +468,5 @@ - Renamed `LoaderArgs`/`ActionArgs` to `LoaderFunctionArgs`/`ActionFunctionArgs`

- The route `meta` API now defaults to the new "V2 Meta" API ([#6958](https://github.com/remix-run/remix/pull/6958))
- Please refer to the ([docs](https://remix.run/docs/en/2.0.0/route/meta) and [Preparing for V2](https://remix.run/docs/en/2.0.0/start/v2#route-meta) guide for more information.
- For preparation of using Node's built in fetch implementation, installing the fetch globals is now a responsibility of the app server ([#7009](https://github.com/remix-run/remix/pull/7009))
- If you are using `remix-serve`, nothing is required

@@ -239,3 +482,2 @@ - If you are using your own app server, you will need to install the globals yourself

- `source-map-support` is now a responsibility of the app server ([#7009](https://github.com/remix-run/remix/pull/7009))
- If you are using `remix-serve`, nothing is required

@@ -374,3 +616,2 @@ - If you are using your own app server, you will need to install [`source-map-support`](https://www.npmjs.com/package/source-map-support) yourself.

- We have made a few changes to the API for route module `meta` functions when using the `future.v2_meta` flag. **These changes are _only_ breaking for users who have opted in.** ([#5746](https://github.com/remix-run/remix/pull/5746))
- `V2_HtmlMetaDescriptor` has been renamed to `V2_MetaDescriptor`

@@ -468,3 +709,2 @@ - The `meta` function's arguments have been simplified

Informational Resources:
- <https://gist.github.com/jacob-ebey/9bde9546c1aafaa6bc8c242054b1be26>

@@ -474,3 +714,2 @@ - <https://github.com/remix-run/remix/blob/main/decisions/0004-streaming-apis.md>

Documentation Resources (better docs specific to Remix are in the works):
- <https://reactrouter.com/en/main/utils/defer>

@@ -477,0 +716,0 @@ - <https://reactrouter.com/en/main/components/await>

+5
-4
import { RequestListener } from 'node:http';
import { ServerBuild, AppLoadContext, SessionData, SessionStorage, SessionIdStorageStrategy } from 'react-router';
import { ServerBuild, UNSAFE_MiddlewareEnabled, RouterContextProvider, AppLoadContext, SessionData, SessionIdStorageStrategy, SessionStorage } from 'react-router';
import { ClientAddress } from '@mjackson/node-fetch-server';
import { Writable, Readable } from 'node:stream';
import { Readable, Writable } from 'node:stream';
type MaybePromise<T> = T | Promise<T>;
interface RequestListenerOptions {
build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>);
getLoadContext?: (request: Request, client: ClientAddress) => AppLoadContext | Promise<AppLoadContext>;
getLoadContext?: (request: Request, client: ClientAddress) => UNSAFE_MiddlewareEnabled extends true ? MaybePromise<RouterContextProvider> : MaybePromise<AppLoadContext>;
mode?: string;

@@ -36,3 +37,3 @@ }

*
* @see https://remix.run/utils/sessions#createfilesessionstorage-node
* @see https://api.reactrouter.com/v7/functions/_react_router_node.createFileSessionStorage
*/

@@ -39,0 +40,0 @@ declare function createFileSessionStorage<Data = SessionData, FlashData = Data>({ cookie, dir, }: FileSessionStorageOptions): SessionStorage<Data, FlashData>;

import { RequestListener } from 'node:http';
import { ServerBuild, AppLoadContext, SessionData, SessionStorage, SessionIdStorageStrategy } from 'react-router';
import { ServerBuild, UNSAFE_MiddlewareEnabled, RouterContextProvider, AppLoadContext, SessionData, SessionIdStorageStrategy, SessionStorage } from 'react-router';
import { ClientAddress } from '@mjackson/node-fetch-server';
import { Writable, Readable } from 'node:stream';
import { Readable, Writable } from 'node:stream';
type MaybePromise<T> = T | Promise<T>;
interface RequestListenerOptions {
build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>);
getLoadContext?: (request: Request, client: ClientAddress) => AppLoadContext | Promise<AppLoadContext>;
getLoadContext?: (request: Request, client: ClientAddress) => UNSAFE_MiddlewareEnabled extends true ? MaybePromise<RouterContextProvider> : MaybePromise<AppLoadContext>;
mode?: string;

@@ -36,3 +37,3 @@ }

*
* @see https://remix.run/utils/sessions#createfilesessionstorage-node
* @see https://api.reactrouter.com/v7/functions/_react_router_node.createFileSessionStorage
*/

@@ -39,0 +40,0 @@ declare function createFileSessionStorage<Data = SessionData, FlashData = Data>({ cookie, dir, }: FileSessionStorageOptions): SessionStorage<Data, FlashData>;

/**
* @react-router/node v0.0.0-experimental-5509a3c42
* @react-router/node v0.0.0-experimental-56b72276e
*

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

// index.ts
var react_router_node_exports = {};
__export(react_router_node_exports, {
var index_exports = {};
__export(index_exports, {
createFileSessionStorage: () => createFileSessionStorage,

@@ -51,3 +51,3 @@ createReadableStreamFromReadable: () => createReadableStreamFromReadable,

});
module.exports = __toCommonJS(react_router_node_exports);
module.exports = __toCommonJS(index_exports);

@@ -82,2 +82,5 @@ // server.ts

let file = getFile(dir, id);
if (!file) {
throw new Error("Error generating session");
}
await import_node_fs.promises.mkdir(path.dirname(file), { recursive: true });

@@ -94,2 +97,5 @@ await import_node_fs.promises.writeFile(file, content, { encoding: "utf-8", flag: "wx" });

let file = getFile(dir, id);
if (!file) {
return null;
}
let content = JSON.parse(await import_node_fs.promises.readFile(file, "utf-8"));

@@ -111,2 +117,5 @@ let data = content.data;

let file = getFile(dir, id);
if (!file) {
return;
}
await import_node_fs.promises.mkdir(path.dirname(file), { recursive: true });

@@ -119,4 +128,8 @@ await import_node_fs.promises.writeFile(file, content, "utf-8");

}
let file = getFile(dir, id);
if (!file) {
return;
}
try {
await import_node_fs.promises.unlink(getFile(dir, id));
await import_node_fs.promises.unlink(file);
} catch (error) {

@@ -129,2 +142,5 @@ if (error.code !== "ENOENT") throw error;

function getFile(dir, id) {
if (!/^[0-9a-f]{16}$/i.test(id)) {
return null;
}
return path.join(dir, id.slice(0, 4), id.slice(4));

@@ -187,3 +203,3 @@ }

highWaterMark;
accumalatedSize;
accumulatedSize;
stream;

@@ -193,3 +209,3 @@ controller;

this.highWaterMark = stream.readableHighWaterMark || new import_node_stream.Stream.Readable().readableHighWaterMark;
this.accumalatedSize = 0;
this.accumulatedSize = 0;
this.stream = stream;

@@ -196,0 +212,0 @@ this.enqueue = this.enqueue.bind(this);

/**
* @react-router/node v0.0.0-experimental-5509a3c42
* @react-router/node v0.0.0-experimental-56b72276e
*

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

// sessions/fileStorage.ts
import { promises as fsp } from "node:fs";
import * as path from "node:path";
import { promises as fsp } from "fs";
import * as path from "path";
import { createSessionStorage } from "react-router";

@@ -41,2 +41,5 @@ function createFileSessionStorage({

let file = getFile(dir, id);
if (!file) {
throw new Error("Error generating session");
}
await fsp.mkdir(path.dirname(file), { recursive: true });

@@ -53,2 +56,5 @@ await fsp.writeFile(file, content, { encoding: "utf-8", flag: "wx" });

let file = getFile(dir, id);
if (!file) {
return null;
}
let content = JSON.parse(await fsp.readFile(file, "utf-8"));

@@ -70,2 +76,5 @@ let data = content.data;

let file = getFile(dir, id);
if (!file) {
return;
}
await fsp.mkdir(path.dirname(file), { recursive: true });

@@ -78,4 +87,8 @@ await fsp.writeFile(file, content, "utf-8");

}
let file = getFile(dir, id);
if (!file) {
return;
}
try {
await fsp.unlink(getFile(dir, id));
await fsp.unlink(file);
} catch (error) {

@@ -88,2 +101,5 @@ if (error.code !== "ENOENT") throw error;

function getFile(dir, id) {
if (!/^[0-9a-f]{16}$/i.test(id)) {
return null;
}
return path.join(dir, id.slice(0, 4), id.slice(4));

@@ -93,3 +109,3 @@ }

// stream.ts
import { Stream } from "node:stream";
import { Stream } from "stream";
async function writeReadableStreamToWritable(stream, writable) {

@@ -147,3 +163,3 @@ let reader = stream.getReader();

highWaterMark;
accumalatedSize;
accumulatedSize;
stream;

@@ -153,3 +169,3 @@ controller;

this.highWaterMark = stream.readableHighWaterMark || new Stream.Readable().readableHighWaterMark;
this.accumalatedSize = 0;
this.accumulatedSize = 0;
this.stream = stream;

@@ -156,0 +172,0 @@ this.enqueue = this.enqueue.bind(this);

{
"name": "@react-router/node",
"version": "0.0.0-experimental-5509a3c42",
"version": "0.0.0-experimental-56b72276e",
"description": "Node.js platform abstractions for React Router",

@@ -32,23 +32,4 @@ "bugs": {

},
"./install": {
"node": {
"types": "./dist/install.d.ts",
"module-sync": "./dist/install.mjs",
"default": "./dist/install.js"
},
"import": {
"types": "./dist/install.d.mts",
"default": "./dist/install.mjs"
},
"default": {
"types": "./dist/install.d.ts",
"default": "./dist/install.js"
}
},
"./package.json": "./package.json"
},
"sideEffects": [
"./dist/install.js",
"./dist/install.mjs"
],
"wireit": {

@@ -58,2 +39,3 @@ "build": {

"files": [
"../../pnpm-workspace.yaml",
"sessions/**",

@@ -70,17 +52,13 @@ "*.ts",

"dependencies": {
"@mjackson/node-fetch-server": "^0.2.0",
"source-map-support": "^0.5.21",
"stream-slice": "^0.1.2",
"undici": "^6.19.2"
"@mjackson/node-fetch-server": "^0.2.0"
},
"devDependencies": {
"@types/source-map-support": "^0.5.4",
"tsup": "^8.3.0",
"typescript": "^5.1.6",
"typescript": "^5.4.5",
"wireit": "0.14.9",
"react-router": "0.0.0-experimental-5509a3c42"
"react-router": "0.0.0-experimental-56b72276e"
},
"peerDependencies": {
"typescript": "^5.1.0",
"react-router": "0.0.0-experimental-5509a3c42"
"react-router": "0.0.0-experimental-56b72276e"
},

@@ -97,5 +75,2 @@ "peerDependenciesMeta": {

"dist/",
"globals.d.ts",
"install.d.ts",
"install.js",
"CHANGELOG.md",

@@ -106,4 +81,5 @@ "LICENSE.md",

"scripts": {
"build": "wireit"
"build": "wireit",
"typecheck": "tsc"
}
}