npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dualmark/vercel

v0.10.0

Published

Vercel Edge Middleware adapter for the Dualmark AEO framework. Wraps any upstream handler and transparently serves markdown to AI bots at the edge.

Downloads

202

Readme

@dualmark/vercel

Vercel Edge Middleware adapter for the Dualmark AEO framework. Wraps any upstream handler and transparently serves markdown to AI bots at the edge — no changes to your existing site.

Install

bun add @dualmark/vercel @dualmark/core

Usage

// proxy.ts
import { NextResponse } from "next/server";
import { createAEOMiddleware } from "@dualmark/vercel";

const middleware = createAEOMiddleware({
  upstream: async () => NextResponse.next(),
  fetchAsset: async (url, init) => fetch(url.toString(), init),
  trailingSlash: "never",
  enableLinkHeader: true,
  hooks: {
    onAIRequest: (info) => console.log(`${info.botName} hit ${info.pathname}`),
    onMiss: (info) => console.warn(`miss: ${info.pathname}`),
  },
});

export default middleware;

export const config = {
  matcher: [
    {
      source: "/((?!_next/|favicon.ico).*)",
      missing: [{ type: "header", key: "next-router-prefetch" }],
    },
  ],
};

How it works on Vercel

Vercel Edge Middleware re-triggers for same-origin fetch() calls. To prevent infinite loops, the adapter adds an x-dualmark-subrequest header to internal fetchAsset calls and short-circuits when it detects a subrequest — returning NextResponse.next() so Vercel serves the static file directly.

  • upstream should return NextResponse.next() for browser requests. The adapter injects Link headers directly on the response object.
  • fetchAsset should forward the optional RequestInit to fetch() so the subrequest header is included.

Options

| Option | Type | Default | Description | | ------------------ | ----------------------------------- | --------- | ----------------------------------------------------------- | | upstream | (req) => Response | — | Handler for non-bot requests (return NextResponse.next()) | | fetchAsset | (url, init?) => Response | — | Fetch a .md file by URL (forward init to fetch) | | trailingSlash | "never" \| "always" \| "preserve" | "never" | Trailing slash mode | | enableLinkHeader | boolean | true | Inject Link rel=alternate on HTML responses | | hooks | { onAIRequest?, onMiss? } | — | Lifecycle callbacks for AI request events | | redirects | { internal?, external? } | — | Redirect rules for AI bots | | skip | { prefixes?, extensions? } | — | Paths to skip entirely | | headers | { cacheControl? } | — | Custom response headers |

What it does

  1. Subrequest detection to prevent fetch() infinite loops on Vercel
  2. Trailing-slash enforcement (configurable: never, always, preserve)
  3. AI bot detection via UA
  4. Content negotiation via Accept header
  5. Serves pre-built .md via fetchAsset with full AEO headers
  6. Internal redirects: routes to target's .md
  7. External redirects: returns markdown notice
  8. 406 when neither HTML nor markdown is acceptable
  9. Link header injection on upstream NextResponse.next() for HTML responses
  10. Analytics hooks (onAIRequest / onMiss)

License

Apache 2.0