Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@remix-run/node
Advanced tools
@remix-run/node is a package that provides utilities for building server-side applications with Remix. It includes tools for handling HTTP requests and responses, managing sessions, and working with cookies, among other things.
Handling HTTP Requests and Responses
This feature allows you to create a request handler for your Remix application. The `createRequestHandler` function sets up the necessary context for handling HTTP requests and responses.
const { createRequestHandler } = require('@remix-run/node');
const handler = createRequestHandler({
getLoadContext() {
return { some: 'context' };
}
});
module.exports = handler;
Managing Sessions
This feature provides a way to manage user sessions using cookies. The `createCookieSessionStorage` function sets up session storage with specified cookie options.
const { createCookieSessionStorage } = require('@remix-run/node');
const sessionStorage = createCookieSessionStorage({
cookie: {
name: '__session',
secrets: ['s3cr3t'],
secure: true,
sameSite: 'lax',
path: '/',
httpOnly: true
}
});
module.exports = sessionStorage;
Working with Cookies
This feature allows you to create and manage cookies. The `createCookie` function sets up a cookie with specified options like max age and HTTP-only flag.
const { createCookie } = require('@remix-run/node');
const myCookie = createCookie('myCookie', {
maxAge: 60 * 60 * 24,
httpOnly: true
});
module.exports = myCookie;
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. Unlike @remix-run/node, which is specifically designed for use with Remix, Express is a general-purpose framework that can be used for a wide variety of web applications.
Koa is a new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. Koa uses async functions to help you write cleaner, more readable code. While @remix-run/node is tailored for Remix applications, Koa is a more general-purpose framework.
Hapi is a rich framework for building applications and services. It enables developers to focus on writing reusable application logic instead of spending time building infrastructure. Hapi is more configuration-driven compared to @remix-run/node, which is more convention-driven and integrated with Remix.
Remix is a web framework that helps you build better websites with React.
To get started, open a new shell and run:
npx create-remix@latest
Then follow the prompts you see in your terminal.
For more information about Remix, visit remix.run!
v2.6.0
Date: 2024-02-01
As we continue moving towards stabilizing the Vite plugin, we've introduced a few breaking changes to the unstable Vite plugin in this release. Please read the @remix-run/dev
changes below closely and update your app accordingly if you've opted into using the Vite plugin.
We've also removed the unstable_
prefix from the serverBundles
option as we're now confident in the API (#8596).
🎉 And last, but certainly not least - we've added much anticipated Cloudflare support in #8531! To get started with Cloudflare, you can use the unstable-vite-cloudflare
template:
npx create-remix@latest --template remix-run/remix/templates/unstable-vite-cloudflare
For more information, please refer to the docs at Future > Vite > Cloudflare and Future > Vite > Migrating > Migrating Cloudflare Functions.
@remix-run/server-runtime
- Add future.v3_throwAbortReason
flag to throw request.signal.reason
when a request is aborted instead of an Error
such as new Error("query() call aborted: GET /path")
(#8251)@remix-run/server-runtime
- Unwrap thrown Response
's from entry.server
into ErrorResponse
's and preserve the status code (#8577)
@remix-run/dev
- Vite: Add manifest
option to Vite plugin to enable writing a .remix/manifest.json
file to the build directory (#8575)
build/server/bundles.json
file has been superseded by the more general build/.remix/manifest.json
manifest
option@remix-run/dev
- Vite: Rely on Vite plugin ordering (#8627)
⚠️ This is a breaking change for projects using the unstable Vite plugin
The Remix plugin expects to process JavaScript or TypeScript files, so any transpilation from other languages must be done first.
For example, that means putting the MDX plugin before the Remix plugin:
import mdx from "@mdx-js/rollup";
import { unstable_vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
+ mdx(),
remix()
- mdx(),
],
});
Previously, the Remix plugin misused enforce: "post"
from Vite's plugin API to ensure that it ran last
However, this caused other unforeseen issues
Instead, we now rely on standard Vite semantics for plugin ordering
The official Vite React SWC plugin also relies on plugin ordering for MDX
@remix-run/dev
- Vite: Remove interop with <LiveReload />
, rely on <Scripts />
instead (#8636)
⚠️ This is a breaking change for projects using the unstable Vite plugin
Vite provides a robust client-side runtime for development features like HMR, making the <LiveReload />
component obsolete
In fact, having a separate dev scripts component was causing issues with script execution order
To work around this, the Remix Vite plugin used to override <LiveReload />
into a bespoke implementation that was compatible with Vite
Instead of all this indirection, now the Remix Vite plugin instructs the <Scripts />
component to automatically include Vite's client-side runtime and other dev-only scripts
To adopt this change, you can remove the LiveReload component from your root.tsx
component:
import {
- LiveReload,
Outlet,
Scripts,
}
export default function App() {
return (
<html>
<head>
</head>
<body>
<Outlet />
<Scripts />
- <LiveReload />
</body>
</html>
)
}
@remix-run/dev
- Vite: Only write Vite manifest files if build.manifest
is enabled within the Vite config (#8599)
⚠️ This is a breaking change for consumers of Vite's manifest.json
files
To explicitly enable generation of Vite manifest files, you must set build.manifest
to true
in your Vite config:
export default defineConfig({
build: { manifest: true },
// ...
});
@remix-run/dev
- Vite: Add new buildDirectory
option with a default value of "build"
(#8575)
⚠️ This is a breaking change for consumers of the Vite plugin that were using the assetsBuildDirectory
and serverBuildDirectory
options
This replaces the old assetsBuildDirectory
and serverBuildDirectory
options which defaulted to "build/client"
and "build/server"
respectively
The Remix Vite plugin now builds into a single directory containing client
and server
directories
If you've customized your build output directories, you'll need to migrate to the new buildDirectory
option, e.g.:
import { unstable_vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
remix({
- serverBuildDirectory: "dist/server",
- assetsBuildDirectory: "dist/client",
+ buildDirectory: "dist",
})
],
});
@remix-run/dev
- Vite: Write Vite manifest files to build/.vite
directory rather than being nested within build/client
and build/server
directories (#8599)
manifest.json
filesmanifest.json
build/.vite/client-manifest.json
and build/.vite/server-manifest.json
, or build/.vite/server-{BUNDLE_ID}-manifest.json
when using server bundles@remix-run/dev
- Vite: Remove unstable
prefix from serverBundles
option (#8596)
@remix-run/dev
- Vite: Add --sourcemapClient
and --sourcemapServer
flags to remix vite:build
(#8613)
--sourcemapClient
, --sourcemapClient=inline
, or --sourcemapClient=hidden
--sourcemapServer
, --sourcemapServer=inline
, or --sourcemapServer=hidden
@remix-run/dev
- Vite: Validate IDs returned from the serverBundles
function to ensure they only contain alphanumeric characters, hyphens and underscores (#8598)
@remix-run/dev
- Vite: Fix "could not fast refresh" false alarm (#8580)
meta
for fast refresh, which removes the false alarm.@remix-run/dev
- Vite: Cloudflare Pages support (#8531)
@remix-run/dev
- Vite: Add getRemixDevLoadContext
option to Cloudflare preset (#8649)
@remix-run/dev
- Vite: Remove undocumented backwards compatibility layer for Vite v4 (#8581)
@remix-run/dev
- Vite: Add presets
option to ease integration with different platforms and tools (#8514)
@remix-run/dev
- Vite: Add buildEnd
hook (#8620)
@remix-run/dev
- Vite: Add mode
field into generated server build (#8539)
@remix-run/dev
- Vite: Reduce network calls for route modules during HMR (#8591)
@remix-run/dev
- Vite: Export Unstable_ServerBundlesFunction
and Unstable_VitePluginConfig
types (#8654)
create-remix
@remix-run/architect
@remix-run/cloudflare
@remix-run/cloudflare-pages
@remix-run/cloudflare-workers
@remix-run/css-bundle
@remix-run/deno
@remix-run/dev
@remix-run/eslint-config
@remix-run/express
@remix-run/node
@remix-run/react
@remix-run/serve
@remix-run/server-runtime
@remix-run/testing
Full Changelog: v2.5.1...v2.6.0
FAQs
Node.js platform abstractions for Remix
The npm package @remix-run/node receives a total of 768,799 weekly downloads. As such, @remix-run/node popularity was classified as popular.
We found that @remix-run/node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.