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

@thomasfosterau/effect-wikimedia

v1.0.0

Published

A strongly typed, Effect-idiomatic client family for Wikimedia properties — Wikipedia, Wikidata, Commons, WDQS, wikitext, and dumps.

Readme

@thomasfosterau/effect-wikimedia

A strongly typed, Effect-idiomatic client family for Wikimedia properties (Wikipedia, Wikidata, Commons, and siblings). One package, module-per-surface: each namespace is a tree-shakeable slice that imports only Core.

Every surface is a namespace on the package's single "." barrel (import { Action, Rest, Commons, Wikidata, Sparql, Core } from "@thomasfosterau/effect-wikimedia"); importing one namespace never pulls another surface's code into a bundle (tests/tree-shaking.test.ts proves this with a real esbuild build).

Module surface

  • Core — the shared HttpClient-based service (WikimediaClient), per-wiki host validation (normaliseWikimediaHost), the typed error family (InvalidRequest / RequestFailed / RateLimited), and the polite-User-Agent / maxlag / retry-after etiquette every other module builds on.

  • Action — the Action API (/w/api.php): getWikitext, getPageMetadata, search, parsePage (sections/links/categories/templates).

  • Rest — the Core REST API / Parsoid surface (/w/rest.php/v1/...): getPageMetadata, getRevisionMetadata, getParsedHtml, getRevisionHtml.

  • CommonsfilePathUrl (Special:FilePath URL construction, with optional thumbnail width) and getFileInfo.

  • Wikidata — the typed Wikidata item / claim model: branded Q/P/L ids (ItemId / PropertyId / LexemeId), the full snak DataValue union (wikibase-entityid, time, globecoordinate, quantity, monolingualtext, string, external-id, and a lenient unknown degrade), statements with rank / qualifiers / references, sitelinks, and per-language label / description / alias maps. getEntities (batched wbgetentities, 50-id chunking) and searchEntities (wbsearchentities).

  • Sparql — the Wikidata Query Service (WDQS) SPARQL client: query (with a LIMIT-enforcing helper, hasLimitClause) decoding SPARQL 1.1 JSON results into typed terms (uri / literal / bnode / unknown), and literalKind mapping xsd:* datatypes back toward the Wikibase datavalue vocabulary.

  • Wikitext — a pure, dependency-free wikitext → typed AST parser, with a round-trip serializer and a query/manipulation surface. The one module that imports nothing, not even Core.

  • Dumps — Wikimedia dump processing as Stream pipelines: the Wikidata JSON entity dump decoded through Wikidata's model, MediaWiki XML pages / incrementals via a scoped SAX-style scanner, and Node-only byte sources (file / resumable HTTP range) with pluggable gzip / bz2 decompression stages. The one Node-only entry point; the pipelines themselves stay runtime-agnostic over any Stream<Uint8Array>.

  • Reconciliation — the one opinionated namespace, layered on top of Action / Wikidata: resolve a label or an external identifier to candidate Wikidata items (Match), then pull the selected facts for a confirmed QID (Enrich). It carries policy the surface modules deliberately don't — input validators, curated property allowlists, and the candidate/fact shapes. It is persistence-free: Match returns candidates, Enrich returns neutral facts, and storing either is the caller's job.

Install

npm install @thomasfosterau/effect-wikimedia effect

effect is a peer dependency — two copies break Context / Layer / Schema identity at runtime.

Usage

import * as Effect from "effect/Effect";
import { Action, Core } from "@thomasfosterau/effect-wikimedia";

const program = Action.getWikitext("en.wikipedia.org", "Douglas Adams").pipe(
  Effect.provide(Core.wikimediaLayer),
);

Every request goes through Core.WikimediaClient, which applies the UA policy and maxlag etiquette, and retries a 429/503/in-body maxlag signal automatically. Core.wikimediaLayer is the production layer (over the platform fetch); tests provide Core.wikimediaClientLayer over a stubbed HttpClient instead — see tests/core.test.ts.

Development

This repository is managed by Vite+ (the vp CLI).

vp install     # install dependencies
vp check       # format (Oxfmt), lint (Oxlint), type-check (tsgolint)
vp run test    # Vitest suite
vp run build   # tsdown library build into dist/

vp run test runs against recorded fixtures (tests/fixtures/) with the network stubbed at FetchHttpClient.Fetch — there is no live network access anywhere in this package's tests or in CI.

Releases are automated with Changesets — see docs/RELEASING.md.

License

MIT