Change8

fetch-router@0.4.0

Breaking Changes
📦 remix
1 breaking5 features🔧 10 symbols

Summary

This release introduces a breaking change to how middleware is defined in router methods, shifting to an inline configuration object. It also adds new utilities for resource naming, form actions, and expanded response helper support.

⚠️ Breaking Changes

  • Removed support for middleware as an optional second argument in router methods. Middleware must now be defined inline within the route handler definition object using the 'use' key.

Migration Steps

  1. Update all router method calls (e.g., router.map) to move the middleware array from the second argument into a configuration object under the 'use' key, and move the callback into the 'handler' key.

✨ New Features

  • Added 'routeNames' option to 'createResource' and 'createResources' for mapping default route names to custom names.
  • Added 'route' shorthand for 'createRoutes' to public exports.
  • Added support for any 'BodyInit' type in the 'html(body)' response helper.
  • Added 'createFormAction' (aliased as 'formAction') for creating route maps with 'index' (GET) and 'action' (POST) routes for HTML forms.
  • Exported 'RouteHandlers' and 'RouteHandler' types.

🔧 Affected Symbols

router.mapcreateResourcecreateResourceshtmlcreateFormActionformActioncreateRoutesrouteRouteHandlersRouteHandler