- Updated dependencies:
- Updated dependencies:
- Updated dependencies:
-
Remove single_fetch future flag. (#11522)
-
For Remix consumers migrating to React Router, the
crypto
global from the Web Crypto API is now required when using cookie and session APIs. This means that the following APIs are provided fromreact-router
rather than platform-specific packages: (#11837)createCookie
createCookieSessionStorage
createMemorySessionStorage
createSessionStorage
For consumers running older versions of Node, the
installGlobals
function from@remix-run/node
has been updated to defineglobalThis.crypto
, using Node'srequire('node:crypto').webcrypto
implementation.Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:
createCookieFactory
createSessionStorageFactory
createCookieSessionStorageFactory
createMemorySessionStorageFactory
-
update minimum node version to 18 (#11690)
-
Add
exports
field to all packages (#11675) -
node package no longer re-exports from react-router (#11702)
-
Drop support for Node 18, update minimum Node vestion to 20 (#12171)
- Remove
installGlobals()
as this should no longer be necessary
- Remove
- Add createRequestListener to @react-router/node (#12319)
- Remove unstable upload handler. (#12015)
- Remove unneeded dependency on @web3-storage/multipart-parser (#12274)
- Updated dependencies:
- Use undici as our fetch polyfill going forward (#9106, #9111)
- Put
undici
fetch polyfill behind a newinstallGlobals({ nativeFetch: true })
parameter (#9198)remix-serve
will default to usingundici
for the fetch polyfill iffuture._unstable_singleFetch
is enabled because the single fetch implementation relies on theundici
polyfill- Any users opting into Single Fetch and managing their own polfill will need to pass the flag to
installGlobals
on their own to avoid runtime errors with Single Fetch
- Any users opting into Single Fetch and managing their own polfill will need to pass the flag to
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Deprecate
DataFunctionArgs
in favor ofLoaderFunctionArgs
/ActionFunctionArgs
. This is aimed at keeping the types aligned across server/client loaders/actions now thatclientLoader
/clientActon
functions haveserverLoader
/serverAction
parameters which differentiateClientLoaderFunctionArgs
/ClientActionFunctionArgs
. (#8173)
- Update to
@remix-run/[email protected]
(#8231) - Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Switch from
crypto.randomBytes
tocrypto.webcrypto.getRandomValues
for file session storage ID generation (#7203) - Use native
Blob
class instead of polyfill (#7217) - Updated dependencies:
@remix-run/[email protected]
@remix-run/[email protected]
-
Require Node >=18.0.0 (#6939)
-
Stop exporting the
fetch
API in favor of using the version in the global scope - which can be polyfilled viainstallGlobals
(#7293) -
Removed/adjusted types to prefer
unknown
overany
and to align with underlying React Router types (#7319, #7354):- Renamed the
useMatches()
return type fromRouteMatch
toUIMatch
- Renamed
LoaderArgs
/ActionArgs
toLoaderFunctionArgs
/ActionFunctionArgs
AppData
changed fromany
tounknown
Location["state"]
(useLocation.state
) changed fromany
tounknown
UIMatch["data"]
(useMatches()[i].data
) changed fromany
tounknown
UIMatch["handle"]
(useMatches()[i].handle
) changed from{ [k: string]: any }
tounknown
Fetcher["data"]
(useFetcher().data
) changed fromany
tounknown
MetaMatch.handle
(used inmeta()
) changed fromany
tounknown
AppData
/RouteHandle
are no longer exported as they are just aliases forunknown
- Renamed the
-
The route
meta
API now defaults to the new "V2 Meta" API (#6958)- Please refer to the (docs and Preparing for V2 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)
-
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
import { installGlobals } from "@remix-run/node"; installGlobals();
-
-
source-map-support
is now a responsibility of the app server (#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
yourself.npm i source-map-support
import sourceMapSupport from "source-map-support"; sourceMapSupport.install();
-
-
Removed support for "magic exports" from the
remix
package. This package can be removed from yourpackage.json
and you should update all imports to use the source@remix-run/*
packages: (#6895)- import type { ActionArgs } from "remix"; - import { json, useLoaderData } from "remix"; + import type { ActionArgs } from "@remix-run/node"; + import { json } from "@remix-run/node"; + import { useLoaderData } from "@remix-run/react";
- Remove
atob
/btoa
polyfills in favor of built-in versions (#7206) - Export proper
ErrorResponse
type for usage alongsideisRouteErrorResponse
(#7244) - Add the rest of the Web Streams API to
installGlobals
(#7321) - Ensures
fetch()
return isinstanceof global Response
by removing extended classes forNodeRequest
andNodeResponse
in favor of custom interface type cast (#7109) - Remove recursion from stream utilities (#7245)
- Updated dependencies:
@remix-run/[email protected]
@remix-run/[email protected]
@remix-run/[email protected]
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Update to latest
@remix-run/web-*
packages (#7026) - Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Upgrade to
@remix-run/[email protected]
. Submitted empty file inputs are now correctly parsed out as emptyFile
instances instead of being surfaced as an empty string viarequest.formData()
(#6816) - Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
-
Add
HeadersArgs
type to be consistent with loaders/actions/meta and allows for using afunction
declaration in addition to an arrow function expression (#6247)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", }; }
-
Fix
request.clone() instanceof Request
returning false. (#6512) -
Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- add
@remix-run/node/install
side-effect to allownode --require @remix-run/node/install
(#6132) - add
logDevReady
as replacement for platforms that can't initialize async I/O outside of the request response lifecycle. (#6204) - add missing files to published package (#6179)
- Updated dependencies:
@remix-run/[email protected]
-
We have made a few changes to the API for route module
meta
functions when using thefuture.v2_meta
flag. These changes are only breaking for users who have opted in. (#5746)V2_HtmlMetaDescriptor
has been renamed toV2_MetaDescriptor
- The
meta
function's arguments have been simplifiedparentsData
has been removed, as each route's loader data is available on thedata
property of its respectivematch
object// before export function meta({ parentsData }) { return [{ title: parentsData["routes/some-route"].title }]; } // after export function meta({ matches }) { return [ { title: matches.find((match) => match.id === "routes/some-route") .data.title, }, ]; }
- The
route
property on route matches has been removed, as relevant match data is attached directly to the match object// before export function meta({ matches }) { const rootModule = matches.find((match) => match.route.id === "root"); } // after export function meta({ matches }) { const rootModule = matches.find((match) => match.id === "root"); }
- Added support for generating
<script type='application/ld+json' />
and meta-related<link />
tags to document head via the routemeta
function when using thev2_meta
future flag
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
-
Introduces the
defer()
API from@remix-run/router
with support for server-rendering and HTTP streaming. This utility allows you to defer values returned fromloader
functions by returning promises instead of resolved values. This has been refered to as "sending a promise over the wire". (#4920)Informational Resources:
- https://gist.github.com/jacob-ebey/9bde9546c1aafaa6bc8c242054b1be26
- https://github.com/remix-run/remix/blob/main/decisions/0004-streaming-apis.md
Documentation Resources (better docs specific to Remix are in the works):
-
Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Export
V2_HtmlMetaDescriptor
andV2_MetaFunction
types from runtime packages (#4943) - Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Importing functions and types from the
remix
package is deprecated, and all (#3284) exported modules will be removed in the next major release. For more details, see the release notes for 1.4.0 where these changes were first announced.
- Update
@remix-run/web-fetch
. This addresses two bugs: (#4644)- It fixes a memory leak caused by unregistered listeners
- It adds support for custom
"credentials"
values (Remix does nothing with these at the moment, but they pass through for the consumer of the request to access if needed)
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
@remix-run/[email protected]
- Flush Node streams to address issues with libraries like
compression
that rely on chunk flushing (#4235) - Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- We've added a new type:
SerializeFrom
. This is used to infer the (#4013) JSON-serialized return type of loaders and actions.
- Fixed a bug when destroying
fileStorage
sessions to prevent deleting entire session directories - Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
- Updated dependencies:
@remix-run/[email protected]
-
We enhanced the type signatures of
loader
/action
anduseLoaderData
/useActionData
to make it possible to infer the data type from return type of its related server function.To enable this feature, you will need to use the
LoaderArgs
type from@remix-run/node
instead of typing the function directly:- import type { LoaderFunction } from "@remix-run/node"; + import type { LoaderArgs } from "@remix-run/node"; - export const loader: LoaderFunction = async (args) => { - return json<LoaderData>(data); - } + export async function loader(args: LoaderArgs) { + return json(data); + }
Then you can infer the loader data by using
typeof loader
as the type variable inuseLoaderData
:- let data = useLoaderData() as LoaderData; + let data = useLoaderData<typeof loader>();
The API above is exactly the same for your route
action
anduseActionData
via theActionArgs
type.With this change you no longer need to manually define a
LoaderData
type (huge time and typo saver!), and we serialize all values so thatuseLoaderData
can't return types that are impossible over the network, such asDate
objects or functions. -
Updated dependencies
@remix-run/server-runtime