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

@vercel/remix

Package Overview
Dependencies
Maintainers
164
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/remix - npm Package Versions

13
14

2.9.2-patch.2

Diff

vercel-release-bot
published 2.9.2-patch.1 •

vercel-release-bot
published 2.9.2 •

Changelog

Source

v2.9.2

Date: 2024-05-10

What's Changed

Updated Type-Safety for Single Fetch

In 2.9.2 we've enhanced the type-safety when opting into the future.unstable_singleFetch feature. Previously, we added the response stub to LoaderFunctionArgs and used type overrides for inference on useLoaderData, etc., but we found that it wasn't quite enough.

With this release we're introducing new functions to assist the type-inference when using single fetch - defineLoader/defineAction and their client-side counterparts defineClientLoader and nd defineClientAction. These are identity functions; they don't modify your loader or action at runtime. Rather, they exist solely for type-safety by providing types for args and by ensuring valid return types.

export const loader = defineLoader(({ request }) => {
  //                                ^? Request
  return { a: 1, b: () => 2 };
  //           ^ type error: `b` is not serializable
});

Note that defineLoader and defineAction are not technically necessary for defining loaders and actions if you aren't concerned with type-safety:

// this totally works! and typechecking is happy too!
export const loader = () => {
  return { a: 1 };
};

This means that you can opt-in to defineLoader incrementally, one loader at a time.

Please see the Single Fetch docs for more information.

Patch Changes

  • @remix-run/dev - Vite: Fix dest already exists error when running remix vite:build (#9305)
  • @remix-run/dev - Vite: Fix issue resolving critical CSS during development when route files are located outside of the app directory (#9194)
  • @remix-run/dev - Vite: Remove @remix-run/node from Vite plugin's optimizeDeps.include list since it was unnecessary and resulted in Vite warnings when not depending on this package (#9287)
  • @remix-run/dev - Vite: Clean up redundant ?client-route=1 imports in development (#9395)
  • @remix-run/dev - Vite: Ensure Babel config files are not referenced when applying the react-refresh Babel transform within the Remix Vite plugin (#9241)
  • @remix-run/react - Type-safety for single-fetch: defineLoader, defineClientLoader, defineAction, defineClientAction (#9372)
  • @remix-run/react - Single Fetch: Add undefined to useActionData type override (#9322)
  • @remix-run/react - Single Fetch: Allow a nonce to be set on single fetch stream transfer inline scripts via <RemixServer> (#9364)
  • @remix-run/server-runtime - Single Fetch: Don't log thrown response stubs via handleError (#9369)
  • @remix-run/server-runtime - Single Fetch: Automatically wrap resource route naked object returns in json() for back-compat in v2 (and log deprecation warning) (#9349)
  • @remix-run/server-runtime - Single Fetch: Pass response stub to resource route handlers (#9349)

Updated Dependencies

Changes by Package

Full Changelog: v2.9.1...v2.9.2

vercel-release-bot
published 2.9.1 •

Changelog

Source

v2.9.1

Date: 2024-04-24

Patch Changes

  • @remix-run/dev - Fix issue where consumers who had added Remix packages to Vite's ssr.noExternal option were being overridden by the Remix Vite plugin adding Remix packages to Vite's ssr.external option (#9301)
  • @remix-run/react - Ignore future/*.d.ts files from TS build (#9299)

Changes by Package

Full Changelog: v2.9.0...v2.9.1

vercel-release-bot
published 2.9.0 •

Changelog

Source

v2.9.0

Date: 2024-04-23

What's Changed

Single Fetch (unstable)

2.9.0 introduces a future.unstable_singleFetch flag to enable to Single Fetch behavior (RFC) in your Remix application. Please refer to the docs for the full detail but the high-level changes to be aware of include:

  • Naked objects returned from loader/action functions are no longer automatically serialized to JSON responses
    • Instead, they'll be streamed as-is via turbo-stream which allows direct serialization of more complex types such as Promise, Date, Map instances, and more
    • You will need to modify your tsconfig.json's compilerOptions.types array to infer types properly when using Single Fetch
  • The headers export is no longer used when Single Fetch is enabled in favor of a new response stub passed to your loader/action functions
  • The json/defer/redirect utilities are deprecated when using Single Fetch (but still work mostly the same)
  • Actions no longer automatically revalidate on 4xx/5xx responses - you can return a 2xx to opt-into revalidation or use shouldRevalidate

[!IMPORTANT] Single Fetch requires using undici as your fetch polyfill, or using the built-in fetch on Node 20+, because it relies on APIs available there but not in the @remix-run/web-fetch polyfill. Please refer to the Undici section below for more details.

  • If you are managing your own server and calling installGlobals(), you will need to call installGlobals({ nativeFetch: true }) to avoid runtime errors when using Single Fetch
  • If you are using remix-serve, it will use undici automatically if Single Fetch is enabled
Undici

Remix 2.9.0 adds a new installGlobals({ nativeFetch: true }) flag to opt into using undici for the Web Fetch polyfills instead of the @remix-run/web-* packages. This change has a few primary benefits:

  • It will allow us to stop maintaining our own web-std-io fork in future versions of Remix
  • It should bring us more in-line with spec compliance
    • ⚠️ It is possible that some non-spec-compliant bugs in our fork will be "fixed" by moving to undici, so beware of "breaking bug fixes" and keep an eye on any advanced fetch API interactions you're performing in your app
    • ⚠️ In some cases, undici may have different behavior by design -- most notably, undici's garbage collection behavior differs and you are required to consume all fetch response bodies to avoid a memory leak in your app
  • Because undici is the fetch implementation used by node internally, it should better prepare Remix apps to more smoothly drop the polyfill to use the built-in Node.js APIs on node 20+

Minor Changes

  • New future.unstable_singleFetch flag (#8773, #9073, #9084, #9272)
  • @remix-run/node - Add a new installGlobals({ nativeFetch: true }) flag to opt-into using undici as the fetch polyfill instead of @remix-run/web-* (#9106, #9111, #9198)
  • @remix-run/server-runtime - Add ResponseStub header interface and deprecate the headers export when Single Fetch is enabled (#9142)

Patch Changes

  • create-remix - Allow . in repo name when using --template flag (#9026)
  • @remix-run/dev - Improve getDependenciesToBundle resolution in monorepos (#8848)
  • @remix-run/dev - Fix SPA mode when Single Fetch is enabled by using streaming entry.server (#9063)
  • @remix-run/dev - Vite: added sourcemap support for transformed routes (#8970)
  • @remix-run/dev - Update links printed to the console by the Remix CLI/Dev Server to point to updated docs locations (#9176)
  • @remix-run/server-runtime - Handle redirects created by handleDataRequest (#9104)

Updated Dependencies

Changes by Package

Full Changelog: v2.8.1...v2.9.0

vercel-release-bot
published 2.8.1-patch.2 •

vercel-release-bot
published 2.8.1-patch.1 •

vercel-release-bot
published 2.8.1 •

Changelog

Source

v2.8.1

Date: 2024-03-07

Patch Changes

  • @remix-run/dev - Vite: Support reading from Vite config when running remix reveal and remix routes CLI commands (#8916)
  • @remix-run/dev - Vite: Clean up redundant client route query strings on route JavaScript files in production builds (#8969)
  • @remix-run/dev - Vite: Add vite commands to Remix CLI --help output (#8939)
  • @remix-run/dev - Vite: Fix support for build.sourcemap option in Vite config (#8965)
  • @remix-run/dev - Vite: Fix error when using Vite's server.fs.allow option without a client entry file (#8966)
  • @remix-run/react - Strengthen the internal LayoutComponent type to accept limited children (#8910)

Updated Dependencies

Changes by Package

Full Changelog: v2.8.0...v2.8.1

vercel-release-bot
published 2.8.0 •

Changelog

Source

v2.8.0

Date: 2024-02-28

Minor Changes

  • @remix-run/dev - Vite: Pass resolved viteConfig to Remix Vite plugin's buildEnd hook (#8885)

Patch Changes

  • @remix-run/dev - Mark Layout as browser safe route export in esbuild compiler (#8842)
  • @remix-run/dev - Vite: Silence build warnings when dependencies include "use client" directives (#8897)
  • @remix-run/dev - Vite: Fix serverBundles issue where multiple browser manifests are generated (#8864)
  • @remix-run/dev - Vite: Support custom build.assetsDir option (#8843)
  • @remix-run/react - Fix the default root ErrorBoundary component so it leverages the user-provided Layout component (#8859)
  • @remix-run/react - Fix the default root HydrateFallback component so it leverages any user-provided Layout component (#8892)

Updated Dependencies

Changes by Package

Full Changelog: v2.7.2...v2.8.0

vercel-release-bot
published 2.7.2-preset.2 •

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