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

@remix-run/serve

Package Overview
Dependencies
Maintainers
0
Versions
1028
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/serve - npm Package Compare versions

Comparing version 0.0.0-nightly-dbb690a-20230403 to 0.0.0-nightly-dc3c3e929-20240831

369

CHANGELOG.md
# `@remix-run/serve`
## 2.11.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.11.2`
- `@remix-run/express@2.11.2`
## 2.11.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.11.1`
- `@remix-run/express@2.11.1`
## 2.11.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.11.0`
- `@remix-run/express@2.11.0`
## 2.10.3
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.10.3`
- `@remix-run/node@2.10.3`
## 2.10.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.10.2`
- `@remix-run/express@2.10.2`
## 2.10.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.10.1`
- `@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/express@2.10.0`
- `@remix-run/node@2.10.0`
## 2.9.2
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.9.2`
- `@remix-run/express@2.9.2`
## 2.9.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.9.1`
- `@remix-run/node@2.9.1`
## 2.9.0
### Minor Changes
- Put `undici` fetch polyfill behind a new `installGlobals({ nativeFetch: true })` parameter ([#9198](https://github.com/remix-run/remix/pull/9198))
- `remix-serve` will default to using `undici` for the fetch polyfill if `future.unstable_singleFetch` is enabled because the single fetch implementation relies on the `undici` polyfill
- Any users opting into Single Fetch and managing their own polyfill will need to pass the flag to `installGlobals` on their own to avoid runtime errors with Single Fetch
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.9.0`
- `@remix-run/express@2.9.0`
## 2.8.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.8.1`
- `@remix-run/node@2.8.1`
## 2.8.0
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.8.0`
- `@remix-run/node@2.8.0`
## 2.7.2
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.7.2`
- `@remix-run/node@2.7.2`
## 2.7.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.7.1`
- `@remix-run/node@2.7.1`
## 2.7.0
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.7.0`
- `@remix-run/node@2.7.0`
## 2.6.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@2.6.0`
- `@remix-run/express@2.6.0`
## 2.5.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.5.1`
- `@remix-run/node@2.5.1`
## 2.5.0
### Patch Changes
- Don't try to load sourcemaps if they don't exist on disk ([#8446](https://github.com/remix-run/remix/pull/8446))
- Updated dependencies:
- `@remix-run/node@2.5.0`
- `@remix-run/express@2.5.0`
## 2.4.1
### Patch Changes
- Use node `fileURLToPath` to convert source map URL to path ([#8321](https://github.com/remix-run/remix/pull/8321))
- Updated dependencies:
- `@remix-run/node@2.4.1`
- `@remix-run/express@2.4.1`
## 2.4.0
### Patch Changes
- Fix source map loading when file has `?t=timestamp` suffix (rebuilds) ([#8174](https://github.com/remix-run/remix/pull/8174))
- Updated dependencies:
- `@remix-run/node@2.4.0`
- `@remix-run/express@2.4.0`
## 2.3.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.3.1`
- `@remix-run/node@2.3.1`
## 2.3.0
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.3.0`
- `@remix-run/node@2.3.0`
## 2.2.0
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.2.0`
- `@remix-run/node@2.2.0`
## 2.1.0
### Patch Changes
- Updated dependencies:
- `@remix-run/express@2.1.0`
- `@remix-run/node@2.1.0`
## 2.0.1
### Patch Changes
- Fix HMR for CJS projects using `remix-serve` and manual mode (`remix dev --manual`) ([#7487](https://github.com/remix-run/remix/pull/7487))
- By explicitly busting the `require` cache, `remix-serve` now correctly re-imports new server changes in CJS
- ESM projects were already working correctly and are not affected by this.
- Fix error caused by partially written server build ([#7470](https://github.com/remix-run/remix/pull/7470))
- Previously, it was possible to trigger a reimport of the app server code before the new server build had completely been written. Reimporting the partially written server build caused issues related to `build.assets` being undefined and crashing when reading `build.assets.version`
- Updated dependencies:
- `@remix-run/node@2.0.1`
- `@remix-run/express@2.0.1`
## 2.0.0
### Major Changes
- `remix-serve` now picks an open port if 3000 is taken ([#7278](https://github.com/remix-run/remix/pull/7278))
- If `PORT` env var is set, `remix-serve` will use that port
- Otherwise, `remix-serve` picks an open port (3000 unless that is already taken)
- Integrate manual mode in `remix-serve` ([#7231](https://github.com/remix-run/remix/pull/7231))
- Remove undocumented `createApp` Node API ([#7229](https://github.com/remix-run/remix/pull/7229))
- `remix-serve` is a CLI, not a library
- Require Node >=18.0.0 ([#6939](https://github.com/remix-run/remix/pull/6939))
- Promote the `future.v2_dev` flag in `remix.config.js` to a root level `dev` config ([#7002](https://github.com/remix-run/remix/pull/7002))
- Default to `serverModuleFormat: "esm"` and update `remix-serve` to use dynamic import to support ESM and CJS build outputs ([#6949](https://github.com/remix-run/remix/pull/6949))
- Preserve dynamic imports in `remix-serve` for external bundle ([#7173](https://github.com/remix-run/remix/pull/7173))
- 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
- Update `remix-serve` usage error message to support ESM projects ([#7400](https://github.com/remix-run/remix/pull/7400))
- Updated dependencies:
- `@remix-run/node@2.0.0`
- `@remix-run/express@2.0.0`
## 1.19.3
### Patch Changes
- Updated dependencies:
- `@remix-run/express@1.19.3`
- `@remix-run/node@1.19.3`
## 1.19.2
### Patch Changes
- Install `source-map-support` ([#7039](https://github.com/remix-run/remix/pull/7039))
- Updated dependencies:
- `@remix-run/node@1.19.2`
- `@remix-run/express@1.19.2`
## 1.19.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@1.19.1`
- `@remix-run/node@1.19.1`
## 1.19.0
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.19.0`
- `@remix-run/express@1.19.0`
## 1.18.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.18.1`
- `@remix-run/express@1.18.1`
## 1.18.0
### Minor Changes
- stabilize v2 dev server ([#6615](https://github.com/remix-run/remix/pull/6615))
### Patch Changes
- fix(types): better tuple serialization types ([#6616](https://github.com/remix-run/remix/pull/6616))
- Updated dependencies:
- `@remix-run/node@1.18.0`
- `@remix-run/express@1.18.0`
## 1.17.1
### Patch Changes
- Updated dependencies:
- `@remix-run/express@1.17.1`
- `@remix-run/node@1.17.1`
## 1.17.0
### Patch Changes
- Add `HeadersArgs` type to be consistent with loaders/actions/meta and allows for using a `function` declaration in addition to an arrow function expression ([#6247](https://github.com/remix-run/remix/pull/6247))
```tsx
import type { HeadersArgs } from "@remix-run/node"; // or cloudflare/deno
export function headers({ loaderHeaders }: HeadersArgs) {
return {
"x-my-custom-thing": loaderHeaders.get("x-my-custom-thing") || "fallback",
};
}
```
- Updated dependencies:
- `@remix-run/node@1.17.0`
- `@remix-run/express@1.17.0`
## 1.16.1
### Patch Changes
- Updated dependencies:
- `@remix-run/node@1.16.1`
- `@remix-run/express@1.16.1`
## 1.16.0
### Patch Changes
- add `@remix-run/node/install` side-effect to allow `node --require @remix-run/node/install` ([#6132](https://github.com/remix-run/remix/pull/6132))
- Updated dependencies:
- `@remix-run/express@1.16.0`
- `@remix-run/node@1.16.0`
## 1.15.0

@@ -4,0 +373,0 @@

2

dist/cli.d.ts

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

import "./env";
import "@remix-run/node/install";
#!/usr/bin/env node
/**
* @remix-run/serve v0.0.0-nightly-dbb690a-20230403
* @remix-run/serve v0.0.0-nightly-dc3c3e929-20240831
*

@@ -14,35 +14,135 @@ * Copyright (c) Remix Software Inc.

require('./env');
var path = require('path');
var os = require('os');
var index = require('./index');
require('@remix-run/node/install');
var fs = require('node:fs');
var os = require('node:os');
var path = require('node:path');
var url = require('node:url');
var node = require('@remix-run/node');
var express$1 = require('@remix-run/express');
var chokidar = require('chokidar');
var compression = require('compression');
var express = require('express');
var morgan = require('morgan');
var sourceMapSupport = require('source-map-support');
var getPort = require('get-port');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
var url__default = /*#__PURE__*/_interopDefaultLegacy(url);
var chokidar__default = /*#__PURE__*/_interopDefaultLegacy(chokidar);
var compression__default = /*#__PURE__*/_interopDefaultLegacy(compression);
var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
var morgan__default = /*#__PURE__*/_interopDefaultLegacy(morgan);
var sourceMapSupport__default = /*#__PURE__*/_interopDefaultLegacy(sourceMapSupport);
var getPort__default = /*#__PURE__*/_interopDefaultLegacy(getPort);
let port = process.env.PORT ? Number(process.env.PORT) : 3000;
if (Number.isNaN(port)) port = 3000;
let buildPathArg = process.argv[2];
if (!buildPathArg) {
console.error(`
Usage: remix-serve <build-dir>`);
process.exit(1);
process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
sourceMapSupport__default["default"].install({
retrieveSourceMap: function (source) {
let match = source.startsWith("file://");
if (match) {
let filePath = url__default["default"].fileURLToPath(source);
let sourceMapPath = `${filePath}.map`;
if (fs__default["default"].existsSync(sourceMapPath)) {
return {
url: source,
map: fs__default["default"].readFileSync(sourceMapPath, "utf8")
};
}
}
return null;
}
});
run();
function parseNumber(raw) {
if (raw === undefined) return undefined;
let maybe = Number(raw);
if (Number.isNaN(maybe)) return undefined;
return maybe;
}
let buildPath = path__default["default"].resolve(process.cwd(), buildPathArg);
let onListen = () => {
var _Object$values$flat$f;
let address = process.env.HOST || ((_Object$values$flat$f = Object.values(os__default["default"].networkInterfaces()).flat().find(ip => String(ip === null || ip === void 0 ? void 0 : ip.family).includes("4") && !(ip !== null && ip !== void 0 && ip.internal))) === null || _Object$values$flat$f === void 0 ? void 0 : _Object$values$flat$f.address);
if (!address) {
console.log(`Remix App Server started at http://localhost:${port}`);
} else {
console.log(`Remix App Server started at http://localhost:${port} (http://${address}:${port})`);
async function run() {
let port = parseNumber(process.env.PORT) ?? (await getPort__default["default"]({
port: 3000
}));
let buildPathArg = process.argv[2];
if (!buildPathArg) {
console.error(`
Usage: remix-serve <server-build-path> - e.g. remix-serve build/index.js`);
process.exit(1);
}
};
let build = require(buildPath);
let app = index.createApp(buildPath, process.env.NODE_ENV, build.publicPath, build.assetsBuildDirectory);
let server = process.env.HOST ? app.listen(port, process.env.HOST, onListen) : app.listen(port, onListen);
["SIGTERM", "SIGINT"].forEach(signal => {
process.once(signal, () => server === null || server === void 0 ? void 0 : server.close(console.error));
});
let buildPath = path__default["default"].resolve(buildPathArg);
let versionPath = path__default["default"].resolve(buildPath, "..", "version.txt");
async function reimportServer() {
Object.keys(require.cache).forEach(key => {
if (key.startsWith(buildPath)) {
delete require.cache[key];
}
});
let stat = fs__default["default"].statSync(buildPath);
// use a timestamp query parameter to bust the import cache
return import(url__default["default"].pathToFileURL(buildPath).href + "?t=" + stat.mtimeMs);
}
function createDevRequestHandler(initialBuild) {
let build = initialBuild;
async function handleServerUpdate() {
// 1. re-import the server build
build = await reimportServer();
// 2. tell Remix that this app server is now up-to-date and ready
node.broadcastDevReady(build);
}
chokidar__default["default"].watch(versionPath, {
ignoreInitial: true
}).on("add", handleServerUpdate).on("change", handleServerUpdate);
// wrap request handler to make sure its recreated with the latest build for every request
return async (req, res, next) => {
try {
return express$1.createRequestHandler({
build,
mode: "development"
})(req, res, next);
} catch (error) {
next(error);
}
};
}
let build = await reimportServer();
node.installGlobals({
nativeFetch: build.future.unstable_singleFetch
});
let onListen = () => {
var _Object$values$flat$f;
let address = process.env.HOST || ((_Object$values$flat$f = Object.values(os__default["default"].networkInterfaces()).flat().find(ip => String(ip === null || ip === void 0 ? void 0 : ip.family).includes("4") && !(ip !== null && ip !== void 0 && ip.internal))) === null || _Object$values$flat$f === void 0 ? void 0 : _Object$values$flat$f.address);
if (!address) {
console.log(`[remix-serve] http://localhost:${port}`);
} else {
console.log(`[remix-serve] http://localhost:${port} (http://${address}:${port})`);
}
if (process.env.NODE_ENV === "development") {
void node.broadcastDevReady(build);
}
};
let app = express__default["default"]();
app.disable("x-powered-by");
app.use(compression__default["default"]());
app.use(build.publicPath, express__default["default"].static(build.assetsBuildDirectory, {
immutable: true,
maxAge: "1y"
}));
app.use(express__default["default"].static("public", {
maxAge: "1h"
}));
app.use(morgan__default["default"]("tiny"));
app.all("*", process.env.NODE_ENV === "development" ? createDevRequestHandler(build) : express$1.createRequestHandler({
build,
mode: process.env.NODE_ENV
}));
let server = process.env.HOST ? app.listen(port, process.env.HOST, onListen) : app.listen(port, onListen);
["SIGTERM", "SIGINT"].forEach(signal => {
process.once(signal, () => server === null || server === void 0 ? void 0 : server.close(console.error));
});
}

@@ -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/serve",
"version": "0.0.0-nightly-dbb690a-20230403",
"version": "0.0.0-nightly-dc3c3e929-20240831",
"description": "Production application server for Remix",

@@ -14,4 +14,2 @@ "bugs": {

"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"bin": {

@@ -21,6 +19,10 @@ "remix-serve": "dist/cli.js"

"dependencies": {
"@remix-run/express": "0.0.0-nightly-dbb690a-20230403",
"@remix-run/express": "0.0.0-nightly-dc3c3e929-20240831",
"@remix-run/node": "0.0.0-nightly-dc3c3e929-20240831",
"chokidar": "^3.5.3",
"compression": "^1.7.4",
"express": "^4.17.1",
"morgan": "^1.10.0"
"express": "^4.19.2",
"get-port": "5.1.1",
"morgan": "^1.10.0",
"source-map-support": "^0.5.21"
},

@@ -30,6 +32,7 @@ "devDependencies": {

"@types/express": "^4.17.9",
"@types/morgan": "^1.9.2"
"@types/morgan": "^1.9.2",
"@types/source-map-support": "^0.5.6"
},
"engines": {
"node": ">=14"
"node": ">=18.0.0"
},

@@ -41,3 +44,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