
Product
Introducing Supply Chain Attack Campaigns Tracking in the Socket Dashboard
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.
@next/routing
Advanced tools
Shared route resolving package for Next.js.
NOTE: This package is experimental and will become stable along with adapters API
This package provides a comprehensive route resolution system that handles rewrites, redirects, middleware invocation, and dynamic route matching with support for conditional routing based on headers, cookies, queries, and host.
npm install @next/routing
import { resolveRoutes } from '@next/routing'
const result = await resolveRoutes({
url: new URL('https://example.com/api/users'),
basePath: '',
requestBody: readableStream,
headers: new Headers(),
pathnames: ['/api/users', '/api/posts'],
routes: {
beforeMiddleware: [],
beforeFiles: [],
afterFiles: [],
dynamicRoutes: [],
onMatch: [],
fallback: [],
},
invokeMiddleware: async (ctx) => {
// Your middleware logic
return {}
},
})
if (result.matchedPathname) {
console.log('Matched:', result.matchedPathname)
}
Each route can have:
sourceRegex - Regular expression to match against pathnamedestination - Destination path with support for replacements ($1, $name)headers - Headers to apply on matchhas - Conditions that must matchmissing - Conditions that must not matchstatus - HTTP status code (3xx for redirects)When a route has:
Location or RefreshThe routing will end immediately and return a redirect result with the destination URL and status code.
Conditions support:
header - Match HTTP headerscookie - Match cookiesquery - Match query parametershost - Match hostnameValues can be:
undefined - Match if key existsFAQs
Next.js shared route resolving
We found that @next/routing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Security News
Node.js 25.4.0 makes require(esm) stable, formalizing CommonJS and ESM compatibility across supported Node versions.