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

@maptiles-doctor/core

v0.1.1

Published

Contract-checking engine behind MapTiles Doctor: reads a MapLibre/Mapbox style and the tile, glyph and sprite artifacts it depends on, and reports where they disagree.

Readme

@maptiles-doctor/core

The contract-checking engine behind MapTiles Doctor. It reads a MapLibre/Mapbox style and the artifacts it depends on — PMTiles, MBTiles, TileJSON, sprites, glyphs and the vector tiles themselves — and reports where they disagree.

Every check lives here. The CLI, the GitHub Action and the VS Code extension are wrappers around this package.

📖 Documentation

Install

npm install @maptiles-doctor/core

Requires Node 24.18.1 or newer.

Usage

import { checkStyleContract } from "@maptiles-doctor/core";

const report = await checkStyleContract({
  stylePath: "style.json",
  sources: [{ id: "basemap", location: "world.pmtiles" }],
  failThreshold: "broken"
});

for (const finding of report.findings) {
  console.log(finding.severity, finding.category, finding.message);
}

report is validated against report schema v1 before it is returned.

checkStyleContract(options)

| Option | Default | What it does | | ------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------ | | stylePath | — (required) | Path or URL of the style. Also the base for resolving relative source, sprite and glyph locations. | | styleText | — | Style JSON to check instead of the contents of stylePath. An editor uses it to check an unsaved buffer. | | sources | [] | { id, location } overrides pointing a style source id at a real artifact. | | failThreshold | "broken" | Lowest severity that makes the report failed. | | allowNetwork | true | When false, every remote read becomes an incomplete check instead of a fetch. | | sampleTiles | true | Read real tiles and treat the observed layers and properties as evidence. | | maxSampleTiles | 3 | Tile addresses probed per source. | | sampleAt | built-in anchors | [lon, lat] to sample at, for a source whose data the anchors miss. | | sampledAbsenceSeverity | "info" | Severity for a finding resting only on absence from a partial sample. "info" \| "warning" \| "risky" — never broken. | | canaries | [] | Views to render with MapLibre GL in a headless browser. Off unless at least one is configured. | | screenshotDir | — | Where canary screenshots and diffs are written. | | baselineDir | — | Directory of <canary-id>.png baselines. | | maxDiffRatio | 0.005 | Fraction of differing pixels tolerated against a baseline. | | timeoutMs | 10000 | Per-request network timeout. |

Returns a DoctorReport:

interface DoctorReport {
  schemaVersion: "1.0";
  status: "passed" | "failed" | "incomplete";
  generatedAt: string;
  artifactHashes: Record<string, string>;
  checks: Array<{ id: string; status: "passed" | "failed" | "incomplete"; message: string }>;
  findings: Finding[];
  incompleteChecks: IncompleteCheck[];
  summary: { broken: number; risky: number; warning: number; info: number; incomplete: number };
}

Other exports

| Export | What it is | | --------------------------------------------- | -------------------------------------------------------------------------- | | checkCategories | Which finding categories each check in the report owns. | | doctorReportSchema, parseDoctorReport | Zod schema and parser for a report. | | doctorReportJsonSchema() | The equivalent JSON Schema, for consumers outside TypeScript. | | findingCategories | Every finding category the schema publishes. | | severityRank | info < warning < risky < broken, for comparing severities. | | readSourceContract | Read the contract a single PMTiles, MBTiles or TileJSON source declares. | | sampleSourceTiles, sampleAddresses | Tile sampling on its own. | | collectStyleUsage | What a style asks of its sources: source-layers, properties, icons, fonts. | | runVisualCanaries, rewriteStyleForBrowser | Headless rendering, and the style rewrite it needs. |

Severity means evidence strength

broken means an artifact was read and proves the mismatch. risky means the evidence points at a mismatch without closing it. info is weak evidence. A check that could not run at all is reported in incompleteChecks and never as a pass — a glyph server that times out does not produce a green report.

A partial sample can never produce broken: reading three tiles that do not contain a rare feature is not proof the feature is missing. And MapLibre overzooms, so a layer drawn above its source's maxzoom is normal and is never reported; zoom is judged against the source minzoom only.

Optional peers

| Package | Needed for | When missing | | ---------------- | --------------------------------------------- | ------------------------------------------------ | | better-sqlite3 | MBTiles sources (a direct dependency, native) | MBTiles sources report an incomplete check. | | playwright | Visual canaries | A configured canary reports an incomplete check. | | maplibre-gl | Visual canaries | A configured canary reports an incomplete check. |

Native and browser modules are loaded lazily so a missing binding degrades to an incomplete check rather than a crash, and so they can stay out of the Action and VS Code bundles.

License

Apache-2.0