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

astro-debug-build-filter

v1.0.0

Published

Astro integration placeholder for conditional page filtering.

Downloads

12

Readme

astro-debug-build-filter

Astro integration for conditional page filtering. Mark your pages as intended for 'debug' builds only and ensure they aren't accidentally published in your production builds.

How it works

  • Enabled only in release mode (when BUILD_PROFILE is not DEBUG). Set BUILD_PROFILE=DEBUG to disable filtering.
  • Dev (astro:server:setup):
    • Middleware blocks requests whose path matches the debug route pattern (by default any path under /debug).
    • Also blocks exact routes derived from pages flagged via frontmatter.
  • Config (astro:config:setup):
    • Blocks disallowed @astro-page: virtual modules early by returning an empty module, preventing inclusion.
  • Build (astro:build:setup):
    • Removes disallowed pages from the build graph before output (so they never get generated).

What’s filtered by default

  • Routes matching the pattern /(^|\/)debug(\/|$)/ (i.e. anything under /debug).
  • Files with frontmatter flag debug: true in .astro/.md/.mdx (also accepts some other 'truthy' values)

Limitations

  • requires Astro v5.13 or higher
  • only intended for use with Astro in static site generation mode

Usage

Setup

Add astro-debug-build-filter to your project:

bun add -d astro-debug-build-filter

In your astro.config.ts:

import { defineConfig } from 'astro/config'
import astroDebugBuildFilter from 'astro-debug-build-filter'

export default defineConfig({
  integrations: [astroDebugBuildFilter()]
})

Now all pages identified as debug-only will be filtered out in all builds.

To enable 'debug' pages again, set environment variable BUILD_PROFILE=DEBUG. For example:

BUILD_PROFILE=DEBUG bunx astro build
# or
BUILD_PROFILE=DEBUG bunx astro dev

Filtering is active whenever BUILD_PROFILE is not DEBUG. Or to phrase another way: your debug pages will only show up when you explicitly set BUILD_PROFILE to DEBUG.

Configuration details

The integration accepts an optional options object. Defaults are safe and work out-of-the-box:

  • patterns: array of RegExp or string prefixes. Default: /(^|\/)debug(\/|$)/.
    • String values are treated as a simple prefix match on the route string, e.g. "/admin" matches /admin and /admin/settings.
    • String prefixes are not segment-aware. If you need segment-aware matching, use a regular expression
  • frontmatterField: string name of the frontmatter flag. Default: "debug".
  • logoutput: boolean to enable console logging. Default: true.
import astroDebugBuildFilter from 'astro-debug-build-filter'

export default defineConfig({
  integrations: [
    astroDebugBuildFilter({
      // Blocked route patterns. Accepts RegExp or string prefixes.
      patterns: [/(^|\\/)debug(\\/|$)/],

      // Frontmatter flag name that marks a page as debug-only.
      frontmatterField: 'debug',

      // Output filtering details to console
      logoutput: true,
    })
  ]
})

Plugin developer notes

Testing

bun install
bun run test # concise summary only
bun run testv # usual verbose test output

bun run clean # forces cleanup of some temp files which are re-used for faster integration tests

ASTRO_VERSION=5.13 bun run test # run against specific Astro version

Changelog

vFuture

  • (maybe) more configuration options
  • (maybe) support server-side render mode

v1.0.0 (2025-09-04)

  • build disallowed routes cache with astro:routes:resolved hook
  • add logging for filtering (on by default)
  • convert all file operations to async
  • integratin test refactoring
    • support testing against specific Astro versions
    • build test projects with package.json and bun install
    • cleanup script
  • utils can handle file URLs
  • established minimum supported version
  • clean up Typescript definitions
  • better error handling
  • misc minor bug fixes and redundant code cleanup

v0.2.1

  • add index.d.ts to remove Typescript warnings on package consumers

v0.2.0 (2025-09-01)

  • support Astro sites with non-standard srcDir (e.g. app/pages instead of the default src/pages)
  • configurable pattern for which routes to filter
  • debounce dev-mode file watcher when recomputing routes
  • better test guardrails around erroring routes
  • better NPM package hygiene
  • route normalisation bug fixes

v0.1.1 (2025-08-30)

  • now supports dev server mode (previously only worked on build output)
  • rewrote integration tests to perform better and be better citizens (e.g. avoid ENOSPC in /tmp)

v0.1.0 (2025-08-29)

  • fix case sensitivity of BUILD_PROFILE checks
  • integration tests against actual Astro project
  • better explicit handling of static and dynamic */debug/* routes

v0.0.3

  • filtering was backwards - fixed
  • better defined behaviour
  • more thorough tests as documentation of expected behaviours

v0.0.1

  • Initial release
  • Default functionality implemented

Credits