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

@react-map-input/geopack

v0.1.0

Published

Build-time toolkit that turns administrative-boundary GeoJSON into a pre-projected geopack for react-map-input.

Readme

@react-map-input/geopack

Build-time toolkit that turns administrative-boundary GeoJSON into a pre-projected react-map-input pack.

This is a development dependency. Nothing here runs in the browser — that is the point: all projection and simplification happens here so the runtime ships with zero dependencies.

There is deliberately no one-shot CLI. Every country's canonical attribute data — names, parent links, expected counts — has a different shape, and a pack is only trustworthy if it is validated against that data. So this package exposes the pipeline as composable steps; the reference implementation is packages/data/tr/scripts/build.ts, which is short enough to copy and adapt.

Pipeline

  1. Assign each subregion polygon to a region by interior point (assign.ts).
  2. Match those polygons to your canonical region/subregion list (match.ts).
  3. Simplify topology-aware with mapshaper, then dissolve subregions into regions (simplify.ts), so a region border is exactly the union of its subregions'.
  4. Project once into a shared coordinate space and emit rounded SVG path data (project.ts).
  5. Validate against the canonical source and emit (validate.ts, emit.ts).

Two things that will bite you

Ring winding. d3-geo wants clockwise exterior rings — the opposite of RFC 7946, which most published GeoJSON follows. Given the wrong winding it reads each polygon as its own complement, silently emitting a second enormous subpath and destroying any fitExtent built on the resulting bounds. Nothing errors; the map just collapses into a corner. Always rewindGeometry() before projecting. validatePack() asserts the regions actually fill their canvas so this cannot ship.

Interior points, not centroids. A concave coastal shape can put its area centroid out at sea, where it belongs to no region and the nearest-neighbour fallback silently picks the wrong one. interiorPoint() falls back to a scanline midpoint. In Türkiye this is the difference between Yumurtalık landing in Adana, where it belongs, and in Hatay.

Matching

Source names rarely match canonical ones exactly. Rules run in descending order of confidence — override, exact, central-alias, strip-central-suffix, fuzzy, sole-remaining — and each match records the rule that produced it, so anything past a plain exact hit can be reviewed rather than trusted. Against Türkiye: 919 exact, 50 central-alias (OSM writes Çanakkale Merkez where the canonical data says just Merkez), and one override for Gökçeada, which OSM lists under its Greek exonym Imbros.

Fuzzy matching only fires when a single candidate is strictly closest, so near-ties fall through to be resolved by hand instead of being guessed.

Preview

preview.mjs rasterises a built pack as terminal ASCII — a fast way to confirm a projection is sane without opening a browser.

Installing

npm install --save-dev @react-map-input/geopack

Ships ESM and CommonJS builds with types, so it runs under plain Node — no loader required.

Licence

MIT.