Skip to content

Latest commit

 

History

History
642 lines (411 loc) · 19 KB

File metadata and controls

642 lines (411 loc) · 19 KB

@react-router/node

7.1.0

Patch Changes

7.0.2

Patch Changes

7.0.1

Patch Changes

7.0.0

Major Changes

  • 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 from react-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 define globalThis.crypto, using Node's require('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

Patch Changes

  • Add createRequestListener to @react-router/node (#12319)
  • Remove unstable upload handler. (#12015)
  • Remove unneeded dependency on @web3-storage/multipart-parser (#12274)
  • Updated dependencies:

2.9.0

Minor Changes

  • Use undici as our fetch polyfill going forward (#9106, #9111)
  • Put undici fetch polyfill behind a new installGlobals({ nativeFetch: true }) parameter (#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 polfill will need to pass the flag to installGlobals on their own to avoid runtime errors with Single Fetch

Patch Changes

2.8.1

Patch Changes

2.8.0

Patch Changes

2.7.2

Patch Changes

2.7.1

Patch Changes

2.7.0

Patch Changes

2.6.0

Patch Changes

2.5.1

Patch Changes

2.5.0

Patch Changes

2.4.1

Patch Changes

2.4.0

Minor Changes

  • Deprecate DataFunctionArgs in favor of LoaderFunctionArgs/ActionFunctionArgs. This is aimed at keeping the types aligned across server/client loaders/actions now that clientLoader/clientActon functions have serverLoader/serverAction parameters which differentiate ClientLoaderFunctionArgs/ClientActionFunctionArgs. (#8173)

Patch Changes

2.3.1

Patch Changes

2.3.0

Patch Changes

2.2.0

Patch Changes

2.1.0

Patch Changes

2.0.1

Patch Changes

2.0.0

Major Changes

  • 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 via installGlobals (#7293)

  • Removed/adjusted types to prefer unknown over any and to align with underlying React Router types (#7319, #7354):

    • Renamed the useMatches() return type from RouteMatch to UIMatch
    • Renamed LoaderArgs/ActionArgs to LoaderFunctionArgs/ActionFunctionArgs
    • AppData changed from any to unknown
    • Location["state"] (useLocation.state) changed from any to unknown
    • UIMatch["data"] (useMatches()[i].data) changed from any to unknown
    • UIMatch["handle"] (useMatches()[i].handle) changed from { [k: string]: any } to unknown
    • Fetcher["data"] (useFetcher().data) changed from any to unknown
    • MetaMatch.handle (used in meta()) changed from any to unknown
    • AppData/RouteHandle are no longer exported as they are just aliases for unknown
  • The route meta API now defaults to the new "V2 Meta" API (#6958)

  • 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 your package.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";

Minor Changes

  • Re-export the new redirectDocument method from React Router (#7040, #6842) (#7040)

Patch Changes

  • Remove atob/btoa polyfills in favor of built-in versions (#7206)
  • Export proper ErrorResponse type for usage alongside isRouteErrorResponse (#7244)
  • Add the rest of the Web Streams API to installGlobals (#7321)
  • Ensures fetch() return is instanceof global Response by removing extended classes for NodeRequest and NodeResponse in favor of custom interface type cast (#7109)
  • Remove recursion from stream utilities (#7245)
  • Updated dependencies:

1.19.3

Patch Changes

1.19.2

Patch Changes

1.19.1

Patch Changes

1.19.0

Patch Changes

1.18.1

Patch Changes

1.18.0

Patch Changes

1.17.1

Patch Changes

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)

    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:

1.16.1

Patch Changes

1.16.0

Patch Changes

  • add @remix-run/node/install side-effect to allow node --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:

1.15.0

Minor Changes

  • 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)

    • V2_HtmlMetaDescriptor has been renamed to V2_MetaDescriptor
    • The meta function's arguments have been simplified
      • parentsData has been removed, as each route's loader data is available on the data property of its respective match 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 route meta function when using the v2_meta future flag

Patch Changes

1.14.3

Patch Changes

1.14.2

Patch Changes

1.14.1

Patch Changes

1.14.0

Patch Changes

1.13.0

Patch Changes

1.12.0

Patch Changes

1.11.1

Patch Changes

1.11.0

Patch Changes

1.10.1

Patch Changes

1.10.0

Patch Changes

  • Export V2_HtmlMetaDescriptor and V2_MetaFunction types from runtime packages (#4943)
  • Updated dependencies:

1.9.0

Patch Changes

1.8.2

Patch Changes

1.8.1

Patch Changes

1.8.0

Minor Changes

  • 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.

Patch Changes

  • 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:

1.7.6

Patch Changes

1.7.5

Patch Changes

1.7.4

Patch Changes

1.7.3

Patch Changes

1.7.2

Patch Changes

  • Flush Node streams to address issues with libraries like compression that rely on chunk flushing (#4235)
  • Updated dependencies:

1.7.1

Patch Changes

1.7.0

Minor Changes

  • We've added a new type: SerializeFrom. This is used to infer the (#4013) JSON-serialized return type of loaders and actions.

Patch Changes

  • Fixed a bug when destroying fileStorage sessions to prevent deleting entire session directories
  • Updated dependencies:

1.6.8

Patch Changes

1.6.7

Patch Changes

1.6.6

Patch Changes

1.6.5

Patch Changes

  • We enhanced the type signatures of loader/action and useLoaderData/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 in useLoaderData:

    - let data = useLoaderData() as LoaderData;
    + let data = useLoaderData<typeof loader>();

    The API above is exactly the same for your route action and useActionData via the ActionArgs 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 that useLoaderData can't return types that are impossible over the network, such as Date objects or functions.

    See the discussions in #1254 and #3276 for more context.

  • Updated dependencies

    • @remix-run/server-runtime