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

geoglyph

v0.4.0

Published

Every country as a mark the size of a letter: an SVG outline cropped to the landmass people recognise, and its flag to pour inside.

Readme

geoglyph

Twelve country outlines with their flags poured inside

Country outlines as SVG glyphs, sized to sit in a line of text, with each country's flag to fill them. Try every option in the playground.

pnpm install geoglyph
import shape from 'geoglyph/shape/br';
import flag from 'geoglyph/flag-px/br';
import { toSvg } from 'geoglyph/svg';

toSvg(shape, { flag, size: '1.5em' });

245 countries by ISO 3166-1 alpha-2 code, and six regions, with no runtime dependencies. Each country is its own module, so you only ship the ones you import.

CODES lists the countries and only the countries, so a country picker built from it never shows a region. The regions are in REGIONS, and everything else takes them like any country: load('eu'), has('eu'), the flag loaders and geoglyph/shape/eu. flag-icons draws a flag for each. Five are blocs, drawn as their members dissolved into one outline, each member cropped the way its own glyph is:

  • EU, the European Union: its 27 members. ISO 3166 reserves the code for it.
  • ASEAN, the Association of Southeast Asian Nations: its 11 members, Timor-Leste included.
  • EAC, the East African Community: its 8 members, Somalia and the DR Congo included.
  • ARAB, the Arab League: its 22 members, Syria and the Comoros included.
  • PC, the Pacific Community, standing in for Oceania: Australia, New Zealand and the 22 Pacific island countries and territories. France, the UK and the US are members too, for the territories they held, but their mainlands are left out, or the Pacific would be a speck between them. It is drawn with the date line in the middle, and its islands, far too small to see at this scale, as dots.

UN is the world: every piece of land in one outline, filled with the UN flag. Nothing is cropped from it, and Antarctica is left out, as the UN emblem leaves it out.

IL and PS are both drawn as the whole territory between the river and the sea, filled with the Palestinian flag. Everything else is as Natural Earth and flag-icons ship it.

Loading at runtime

import { load, has } from 'geoglyph';
import { loadFlag } from 'geoglyph/flags';        // 48×36 png
import { loadFlagSvg } from 'geoglyph/flags-svg'; // svg

if (has(code)) {
  const shape = await load(code);
  const flag = await loadFlag(code);
}

React

import { Glyph } from 'geoglyph/react';

<Glyph shape={shape} flag={flag} size="1.5em" title="Brazil" />

Glyph takes a shape, not a country code, and fetches nothing. Other props go on the <svg>.

Blocks

The same twelve countries in blocks, flags poured inside

import { toBlocks } from 'geoglyph/blocks';

toSvg(toBlocks(shape, { cells: 10 }));

Snaps the outline to square cells, cells along the longer side (default 10). Add shape-rendering: crispEdges for hard edges.

API

| | | | --- | --- | | geoglyph/shape/<iso> | { d, viewBox } | | geoglyph/flag/<iso> | SVG source | | geoglyph/flag-px/<iso> | 48×36 PNG data URI | | geoglyph | load, has, CODES, REGIONS, toSvg, toBlocks | | geoglyph/svg | toSvg, clipPathFor, flagHref | | geoglyph/blocks | toBlocks | | geoglyph/react | Glyph | | geoglyph/flags | loadFlag | | geoglyph/flags-svg | loadFlagSvg |

toSvg(shape, options) takes size (default 1em), fill (default currentColor), className, flag, backdrop and title.

  • flag is a URL, a data URI or SVG source. It replaces the silhouette; set backdrop to draw the silhouette under it, for example to fade the flag in on hover.
  • With a title the <svg> gets role="img"; without one it's aria-hidden.
  • Subpath imports are lowercase. load, loadFlag and has take either case.

Flags

flag-px/ is a 48×36 PNG, about 640 bytes whatever the country. flag/ is the SVG: median 804 bytes, but up to 177 KB for Serbia. Either way the flag is stretched to the shape's box, so its stripes still read inside a narrow country.

Shapes

  • Each country is cropped to its main landmass: the US without Alaska and Hawaii, France without Réunion. Nearby islands like Tasmania, Corsica and both of New Zealand stay.
  • Fiji is drawn across the date line, which cuts it in two. Kiribati and Micronesia, atolls strung out over thousands of kilometres, are each their largest island: Kiritimati and Pohnpei.
  • Coordinates are plain longitude and latitude, so countries far from the equator come out wide. Norway and Canada are stretched; Kenya and Indonesia are true.
  • No states or provinces, and the shapes don't share a coordinate space, so they can't be put back together into a map. Use TopoJSON for that.
  • GEOGLYPH_POV=RU pnpm vendor rebuilds the shapes with disputed areas assigned the way that country assigns them. UA, CN, MA, AR and others work too; an unsupported code prints the list. The published package uses Natural Earth's default.

Development

pnpm dev       # playground
pnpm check     # build, types, lint, format, tests, publint, attw
pnpm vendor    # rebuild shapes and flags from Natural Earth and flag-icons
pnpm banner    # the images in this README

Add a changeset with pnpm changeset for anything that should be released.

Licence

MIT. Geometry from Natural Earth (public domain), flags from flag-icons (MIT). See NOTICE.