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

@xndrjs/i18n

v0.8.2

Published

Compiler-first, type-safe ICU MessageFormat i18n with lazy delivery loading and external payload validation for content ingest.

Readme

@xndrjs/i18n

Compiler-first, type-safe ICU MessageFormat i18n for TypeScript apps.

  • Codegen turns JSON/YAML dictionaries into exact TypeScript types and lazy loaders.
  • Runtime is a single handle: createI18n(options?).load({ namespaces, locale }).
  • Content updates without rebuild use authoring edits outside the library + regenerateNamespaces([...]) + loaderStrategy: "fetch".
  • React lives in @xndrjs/i18n-react (gate / HOC, no Suspense).

Install

npm install @xndrjs/i18n zod

Peer dep: zod (config + validation).

Quick start

1. Config (i18n/i18n.codegen.json):

{
  "projectName": "App",
  "delivery": "split-by-locale",
  "namespaces": {
    "default": "translations/default.json",
    "billing": "translations/billing.yaml"
  },
  "codegenPath": "generated"
}

Generated under codegenPath/: i18n-types.generated.ts, instance.generated.ts, namespace-loaders.generated.ts, dictionary-schema.generated.ts. Delivery JSON goes to artifactsPath (defaults to codegenPath). Type names are inferred as AppParams / AppSchema / AppLocale.

2. Generate:

npx xndrjs-i18n-codegen --config i18n/i18n.codegen.json
# or from code:
# import { runCodegen } from "@xndrjs/i18n/codegen";
# runCodegen("i18n/i18n.codegen.json");

3. Use:

import { createI18n } from "./generated/instance.generated.js";

const i18n = createI18n();
const { t } = await i18n.load({
  namespaces: ["default", "billing"],
  locale: "en",
});

t("default", "welcome", { name: "Ada" });
t("billing", "invoice_summary", { count: 3 });

SSR → CSR hydrate:

const state = i18n.serialize();
// pass `state` into the React root; gates resolve via peek() without a flash

Scaffold:

npx xndrjs-i18n-setup multi .

Delivery modes

| Mode | Artifacts | load({ locale }) behavior | | --------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------- | | split-by-locale (default) | {ns}.{locale}.json | Loads that locale file | | custom | {ns}.{area}.json + deliveryArtifacts | Maps locale → area via generated LOCALE_DELIVERY_AREA, then loads the area |

Loader strategy

{
  "loaderStrategy": "fetch"
}
  • import (default) — dynamic import(); JSON is bundled. Content changes need a rebuild.
  • fetch — generated loaders call fetchImpl({ locale, namespace, area? }). You must pass fetchImpl to createI18n({ fetchImpl }) (or I18nRoot). Mapping the resource id to a URL, CDN path, or filesystem read is an application concern — codegen does not embed base URLs.

Hydrate from SSR:

const state = i18n.serialize();
const client = createI18n({ state }); // import strategy
// fetch strategy:
// const client = createI18n({ state, fetchImpl });

Content updates without build (CMS)

Two APIs from @xndrjs/i18n/codegen:

| API | When | Writes | | ----------------------------------------- | ---------------------------------------------------- | ----------------------------------------------------------------- | | runCodegen(config) | Contract changes (keys, params, namespaces, locales) | Types + instance + loaders + delivery JSON (then rebuild the app) | | regenerateNamespaces({ namespaces, … }) | Editorial label/copy changes (same ICU contract) | Only delivery JSON for the listed namespaces |

Authoring files are updated outside this library (CMS export, editors, scripts). Then refresh delivery artifacts:

import { regenerateNamespaces } from "@xndrjs/i18n/codegen";

// after writing translations/billing.json (same keys + ICU params)
regenerateNamespaces({
  configPath: "i18n/i18n.codegen.json",
  namespaces: ["billing"],
});

If authoring changes a key’s ICU parameter contract (or adds/removes keys), regeneration fails — run runCodegen and ship a release instead.

End-to-end without rebuild requires loaderStrategy: "fetch". Debounce/batch webhooks in the app; each call rewrites delivery JSON only, not app code.

Validation

@xndrjs/i18n/validation (and generated dictionary-schema.generated.ts) validates external CMS payloads before writing authoring files. It is not a runtime patch API.

Audit

npx xndrjs-i18n-audit --config i18n/i18n.codegen.json
npx xndrjs-i18n-audit --config i18n/i18n.codegen.json --fail-on effective

Tech stack