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

@remix-run/express

Package Overview
Dependencies
Maintainers
0
Versions
1030
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/express - npm Package Compare versions

Comparing version 0.0.0-nightly-81ec1b7-20220830 to 0.0.0-nightly-825f70ebd-20240914

457

CHANGELOG.md
# `@remix-run/express`
## 2.12.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.12.0`
## 2.11.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.11.2`
## 2.11.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.11.1`
## 2.11.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.11.0`
## 2.10.3
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.10.3`
## 2.10.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.10.2`
## 2.10.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.10.1`
## 2.10.0
### Patch Changes
- Upgrade `express` dependency to `^4.19.2` ([#9184](https://github.com/remix-run/remix/pull/9184))
- Updated dependencies:
- `@remix-run/node@2.10.0`
## 2.9.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.9.2`
## 2.9.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.9.1`
## 2.9.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.9.0`
## 2.8.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.8.1`
## 2.8.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.8.0`
## 2.7.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.7.2`
## 2.7.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.7.1`
## 2.7.0
### Minor Changes
- Vite: Add a new `basename` option to the Vite plugin, allowing users to set the internal React Router [`basename`](https://reactrouter.com/en/main/routers/create-browser-router#basename) in order to to serve their applications underneath a subpath ([#8145](https://github.com/remix-run/remix/pull/8145))
### Patch Changes
- Use `req.originalUrl` instead of `req.url` so that Remix sees the full URL ([#8145](https://github.com/remix-run/remix/pull/8145))
- Remix relies on the knowing the full URL to ensure that server and client code can function together, and does not support URL rewriting prior to the Remix handler
- Updated dependencies:
- `@remix-run/node@2.7.0`
## 2.6.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.6.0`
## 2.5.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.5.1`
## 2.5.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.5.0`
## 2.4.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.4.1`
## 2.4.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.4.0`
## 2.3.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.3.1`
## 2.3.0
### Patch Changes
- Fix flash of unstyled content on initial page load in Vite dev when using a custom Express server ([#7937](https://github.com/remix-run/remix/pull/7937))
- Updated dependencies:
- `@remix-run/node@2.3.0`
## 2.2.0
### Patch Changes
- Allow the `@remix-run/express` adapter to work behind a proxy when using `app.enable('trust proxy')` ([#7323](https://github.com/remix-run/remix/pull/7323))
- Previously, this used `req.get('host')` to construct the Remix `Request`, but that does not respect `X-Forwarded-Host`
- This now uses `req.hostname` which will respect `X-Forwarded-Host`
- Updated dependencies:
- `@remix-run/node@2.2.0`
## 2.1.0
### Patch Changes
- Flush headers for `text/event-stream` responses ([#7619](https://github.com/remix-run/remix/pull/7619))
- Updated dependencies:
- `@remix-run/node@2.1.0`
## 2.0.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.0.1`
## 2.0.0
### Major Changes
- Require Node >=18.0.0 ([#6939](https://github.com/remix-run/remix/pull/6939))
- 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
- If you are using your own app server, you will need to install the globals yourself
```js filename=server.js
import { installGlobals } from "@remix-run/node";
installGlobals();
```
- `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
- 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.
```sh
npm i source-map-support
```
```js filename=server.js
import sourceMapSupport from "source-map-support";
sourceMapSupport.install();
```
### Patch Changes
- Switch to `headers.entries()` instead of non-spec-compliant `headers.raw()` in `sendRemixResponse` ([#7150](https://github.com/remix-run/remix/pull/7150))
- Remove references to fetch polyfills in node and arc adapters ([#7230](https://github.com/remix-run/remix/pull/7230))
- Updated dependencies:
- `@remix-run/node@2.0.0`
- `@remix-run/web-fetch@4.4.0`
- `@remix-run/web-file@3.1.0`
- `@remix-run/web-stream@1.1.0`
## 1.19.3
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.19.3`
## 1.19.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.19.2`
## 1.19.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.19.1`
## 1.19.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.19.0`
## 1.18.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.18.1`
## 1.18.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.18.0`
## 1.17.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.17.1`
## 1.17.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.17.0`
## 1.16.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.16.1`
## 1.16.0
### Patch Changes
- feat: support async `getLoadContext` in all adapters ([#6170](https://github.com/remix-run/remix/pull/6170))
- Updated dependencies:
- `@remix-run/node@1.16.0`
## 1.15.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.15.0`
## 1.14.3
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.14.3`
## 1.14.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.14.2`
## 1.14.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.14.1`
## 1.14.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.14.0`
## 1.13.0
### Patch Changes
- Fix fetch `Request` creation for incoming URLs with double slashes ([#5336](https://github.com/remix-run/remix/pull/5336))
- Updated dependencies:
- `@remix-run/node@1.13.0`
## 1.12.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.12.0`
## 1.11.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.11.1`
## 1.11.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.11.0`
## 1.10.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.10.1`
## 1.10.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.10.0`
## 1.9.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.9.0`
## 1.8.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.8.2`
## 1.8.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.8.1`
## 1.8.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.8.0`
## 1.7.6
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.7.6`
## 1.7.5
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.7.5`
## 1.7.4
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.7.4`
## 1.7.3
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.7.3`
## 1.7.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.7.2`
## 1.7.1
### Patch Changes
- Ensured that requests are properly aborted on closing of a `Response` instead of `Request` ([#3626](https://github.com/remix-run/remix/pull/3626))
- Updated dependencies:
- `@remix-run/node@1.7.1`
## 1.7.0

@@ -4,0 +461,0 @@

1

dist/index.d.ts

@@ -1,3 +0,2 @@

import "./globals";
export type { GetLoadContextFunction, RequestHandler } from "./server";
export { createRequestHandler } from "./server";
/**
* @remix-run/express v0.0.0-nightly-81ec1b7-20220830
* @remix-run/express v0.0.0-nightly-825f70ebd-20240914
*

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

require('./globals.js');
var server = require('./server.js');

@@ -18,0 +17,0 @@

@@ -0,4 +1,4 @@

/// <reference lib="dom.iterable" />
import type * as express from "express";
import type { AppLoadContext, ServerBuild, Response as NodeResponse } from "@remix-run/node";
import { Headers as NodeHeaders, Request as NodeRequest } from "@remix-run/node";
import type { AppLoadContext, ServerBuild } from "@remix-run/node";
/**

@@ -12,4 +12,4 @@ * A function that returns the value to use as `context` in route `loader` and

*/
export declare type GetLoadContextFunction = (req: express.Request, res: express.Response) => AppLoadContext;
export declare type RequestHandler = (req: express.Request, res: express.Response, next: express.NextFunction) => Promise<void>;
export type GetLoadContextFunction = (req: express.Request, res: express.Response) => Promise<AppLoadContext> | AppLoadContext;
export type RequestHandler = (req: express.Request, res: express.Response, next: express.NextFunction) => Promise<void>;
/**

@@ -19,8 +19,8 @@ * Returns a request handler for Express that serves the response using Remix.

export declare function createRequestHandler({ build, getLoadContext, mode, }: {
build: ServerBuild;
build: ServerBuild | (() => Promise<ServerBuild>);
getLoadContext?: GetLoadContextFunction;
mode?: string;
}): RequestHandler;
export declare function createRemixHeaders(requestHeaders: express.Request["headers"]): NodeHeaders;
export declare function createRemixRequest(req: express.Request, res: express.Response): NodeRequest;
export declare function sendRemixResponse(res: express.Response, nodeResponse: NodeResponse): Promise<void>;
export declare function createRemixHeaders(requestHeaders: express.Request["headers"]): Headers;
export declare function createRemixRequest(req: express.Request, res: express.Response): Request;
export declare function sendRemixResponse(res: express.Response, nodeResponse: Response): Promise<void>;
/**
* @remix-run/express v0.0.0-nightly-81ec1b7-20220830
* @remix-run/express v0.0.0-nightly-825f70ebd-20240914
*

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

// IDK why this is needed when it's in the tsconfig..........
/**

@@ -39,3 +41,3 @@ * A function that returns the value to use as `context` in route `loader` and

let request = createRemixRequest(req, res);
let loadContext = getLoadContext === null || getLoadContext === void 0 ? void 0 : getLoadContext(req, res);
let loadContext = await (getLoadContext === null || getLoadContext === void 0 ? void 0 : getLoadContext(req, res));
let response = await handleRequest(request, loadContext);

@@ -51,4 +53,3 @@ await sendRemixResponse(res, response);

function createRemixHeaders(requestHeaders) {
let headers = new node.Headers();
let headers = new Headers();
for (let [key, values] of Object.entries(requestHeaders)) {

@@ -65,10 +66,18 @@ if (values) {

}
return headers;
}
function createRemixRequest(req, res) {
let origin = `${req.protocol}://${req.get("host")}`;
let url = new URL(req.url, origin); // Abort action/loaders once we can no longer write a response
var _req$get, _req$get2;
// req.hostname doesn't include port information so grab that from
// `X-Forwarded-Host` or `Host`
let [, hostnamePort] = ((_req$get = req.get("X-Forwarded-Host")) === null || _req$get === void 0 ? void 0 : _req$get.split(":")) ?? [];
let [, hostPort] = ((_req$get2 = req.get("host")) === null || _req$get2 === void 0 ? void 0 : _req$get2.split(":")) ?? [];
let port = hostnamePort || hostPort;
// Use req.hostname here as it respects the "trust proxy" setting
let resolvedHost = `${req.hostname}${port ? `:${port}` : ""}`;
// Use `req.originalUrl` so Remix is aware of the full path
let url = new URL(`${req.protocol}://${resolvedHost}${req.originalUrl}`);
let controller = new node.AbortController();
// Abort action/loaders once we can no longer write a response
let controller = new AbortController();
res.on("close", () => controller.abort());

@@ -80,19 +89,18 @@ let init = {

};
if (req.method !== "GET" && req.method !== "HEAD") {
init.body = req;
init.body = node.createReadableStreamFromReadable(req);
init.duplex = "half";
}
return new node.Request(url.href, init);
return new Request(url.href, init);
}
async function sendRemixResponse(res, nodeResponse) {
var _nodeResponse$headers;
res.statusMessage = nodeResponse.statusText;
res.status(nodeResponse.status);
for (let [key, values] of Object.entries(nodeResponse.headers.raw())) {
for (let value of values) {
res.append(key, value);
}
for (let [key, value] of nodeResponse.headers.entries()) {
res.append(key, value);
}
if ((_nodeResponse$headers = nodeResponse.headers.get("Content-Type")) !== null && _nodeResponse$headers !== void 0 && _nodeResponse$headers.match(/text\/event-stream/i)) {
res.flushHeaders();
}
if (nodeResponse.body) {

@@ -99,0 +107,0 @@ await node.writeReadableStreamToWritable(nodeResponse.body, res);

@@ -1,7 +0,22 @@

Copyright 2021 Remix Software Inc.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) Remix Software Inc. 2020-2021
Copyright (c) Shopify Inc. 2022-2024
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
{
"name": "@remix-run/express",
"version": "0.0.0-nightly-81ec1b7-20220830",
"version": "0.0.0-nightly-825f70ebd-20240914",
"description": "Express server request handler for Remix",

@@ -17,16 +17,24 @@ "bugs": {

"dependencies": {
"@remix-run/node": "0.0.0-nightly-81ec1b7-20220830"
"@remix-run/node": "0.0.0-nightly-825f70ebd-20240914"
},
"devDependencies": {
"@types/express": "^4.17.9",
"@types/node": "^18.17.1",
"@types/supertest": "^2.0.10",
"express": "^4.17.1",
"express": "^4.19.2",
"node-mocks-http": "^1.10.1",
"supertest": "^6.1.5"
"supertest": "^6.3.3",
"typescript": "^5.1.6"
},
"peerDependencies": {
"express": "^4.17.1"
"express": "^4.19.2",
"typescript": "^5.1.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"engines": {
"node": ">=14"
"node": ">=18.0.0"
},

@@ -38,3 +46,6 @@ "files": [

"README.md"
]
}
],
"scripts": {
"tsc": "tsc"
}
}
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