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

@advance-labs/crawler

v0.2.2

Published

Polite, bounded HTTP crawler — sitemap-first discovery, link-following BFS, robots.txt, and site-file detection.

Readme

@advance-labs/crawler

A polite, bounded HTTP crawler for the AEO Toolkit. It discovers a site's pages sitemap-first, then follows on-site links breadth-first up to a hard page cap. It is robots.txt-aware, rate-limits per host, captures redirect chains, and detects the well-known crawl-hint / trust files (robots.txt, sitemap.xml, llms.txt, llms-full.txt, favicon.ico). All network I/O is routed through an injectable Fetcher (default: the global fetch), so callers and tests never need a live network.

Usage

import { crawl, fetchResource, parseRobotsTxt, parseSitemap, AI_BOT_NAMES } from '@advance-labs/crawler';

// Crawl up to 50 pages, respecting robots.txt and spacing requests 500ms per host.
const result = await crawl('https://example.com/', {
  maxPages: 50,
  respectRobotsTxt: true,
  perHostRateLimitMs: 500,
  concurrency: 4,
});

console.log(result.pageCount, 'pages');
console.log(result.robots.aiBotDirectives); // which AI crawlers are allowed at the root
console.log(result.filePresence);           // { robotsTxt, sitemapXml, llmsTxt, llmsFullTxt, favicon }

// Single resource fetch with redirect-chain capture.
const page = await fetchResource('https://example.com/');

// Inject a fake fetcher for tests — no real network.
await crawl('https://example.com/', { maxPages: 10, fetcher: myFakeFetch });

Public API

| Export | Kind | Description | | --- | --- | --- | | crawl(rootUrl, opts) | Promise<CrawlResult> | Sitemap-first + BFS link-following crawl, capped at opts.maxPages. Honors robots.txt, per-host rate limit, and concurrency. | | fetchResource(url, opts?) | Promise<PageResource> | One fetch with status, headers, timing, final URL, content-type, body, and manual redirect-chain capture. | | parseRobotsTxt(raw, url) | RobotsTxt | Parses robots.txt; populates sitemaps[], grouped directives, and an aiBotDirectives[] entry for every AiBotName. | | emptyRobotsTxt(url) | RobotsTxt | An all-allowed robots result for sites that have none. | | parseSitemap(xml) | SitemapEntry[] | Parses <urlset> and <sitemapindex> documents; tolerant of malformed input. | | detectSiteFiles(rootUrl, opts?) | Promise<SiteFilePresence> | HEAD/GET probes for robots, sitemap, llms.txt, llms-full.txt, favicon. | | extractLinks(html, baseUrl) | Url[] | Dependency-free regex href extraction, absolutized and de-duplicated. | | sameOrigin, sameRegistrableSite, hostOf | helpers | URL scope + host helpers used by the crawl frontier. | | PerHostRateLimiter | class | Per-host request spacing with an injectable clock/delay. | | resolveFetcher, CrawlerError | runtime | Fetcher resolution and the package's typed error. | | Fetcher, FetchOptions, CrawlRuntimeOptions, FetchResourceOptions, DetectSiteFilesOptions | types | The injectable I/O seam and option shapes. | | AI_BOT_NAMES | readonly AiBotName[] | The known AI/LLM crawler user-agents probed in robots.txt. | | DEFAULT_*, MAX_REDIRECT_HOPS | constants | Tunable defaults (user-agent, concurrency, timeout, depth, redirect cap). |

All domain shapes (CrawlResult, PageResource, RobotsTxt, SitemapEntry, SiteFilePresence, AiBotName, CrawlOptions, …) are imported from @advance-labs/types; this package never redefines them.

Status

Implemented. No stubs. The single I/O seam is the injectable Fetcher (defaults to global fetch on Node 20+); pass a fake in tests to stay network-free. robots.txt directive parsing is provided by robots-parser; sitemap parsing by fast-xml-parser.