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

@intl-tms/core

v0.1.0

Published

Library-agnostic in-context translation marker core: codec, wrapper, wire contract, highlighter, TMS client, and panel state machine.

Readme

@intl-tms/core

Framework-agnostic core for in-context translation editing: wrap your i18n library's translator once, and every string it renders carries an invisible marker identifying the translation key it came from. A browser extension can then decode those markers to highlight and edit translations directly on the running page.

The package has zero runtime dependencies and ships as ESM.

Status: 0.x. The public API may change in minor releases until the adapter conformance set (next-intl, react-i18next, react-intl) passes without further core changes.

Install

npm install @intl-tms/core

How it works

Host App  ──wraps translator──▶  markers in rendered text
                                          │
                                          ▼
                              Extension decodes, highlights, edits
                                          │
                                          ▼
                              Your HTTP endpoints store the change

@intl-tms/core sits on both sides of that seam. It encodes markers in the host app, and decodes them in the extension. It never talks to your database — you own the HTTP endpoints it reads and writes through.

Quick start

1. Wrap your translator

createTms adapts the core to whatever i18n library you use. The returned hook is type-identical to the one you pass in, so call sites don't change.

import { createTms, COOKIE_NAME } from '@intl-tms/core';
import { useTranslations } from 'next-intl'; // or any other library

const tms = createTms({
  useClient: (ns) => useTranslations(ns),
  isEnabled: {
    client: () =>
      typeof document !== 'undefined' &&
      document.cookie.includes(`${COOKIE_NAME}=1`),
  },
});

export const useTms = tms.useTms as typeof useTranslations;

Then swap the import in your components — useTms for useTranslations:

export function Nav() {
  const t = useTms('namespace');
  return <nav>{t('nav.home')}</nav>;
}

Markers are only emitted when isEnabled returns true, so production renders are untouched unless in-context editing is switched on.

2. Describe your setup

The extension fetches a TMSConfig from your app at runtime:

import type { TMSConfig } from '@intl-tms/core';

export const tmsConfig: TMSConfig = {
  languages: ['en', 'da', 'es', 'fr'],
  endpoints: {
    update: 'https://app.example.com/api/tms/{key}', // required
    usageReport: 'https://app.example.com/api/tms/usage', // optional
    usageRead: 'https://app.example.com/api/tms/usage/{key}', // optional
  },
};

Endpoints are full absolute URLs, fetched verbatim with {key} replaced by the URL-encoded translation key. The two usage endpoints are optional and act as a feature toggle — omit them to turn usage tracking off.

3. Implement the endpoints

You own these routes and their storage. The wire shapes are exported as types:

| Route | Returns / accepts | | --- | --- | | GET /api/tms/config | TMSConfig | | GET /api/tms/{key} | TranslationValues — { locale: value } | | PUT /api/tms/{key} | TranslationWrite — { locale, value } | | POST /api/tms/usage | UsageReport | | GET /api/tms/usage/{key} | Usage[] |

See the integration guide for worked examples of each.

What's exported

| Area | Exports | | --- | --- | | Marker codec | wrap, unwrap, isWrapped, stripMarkers | | Adapter | createTms, wrapTranslator, COOKIE_NAME | | Config & wire types | TMSConfig, Schema, TranslationValues, LocaleWrite, Usage, UsageReport, … | | Usage / dedupe | aggregateUsage, usageSignature, normalizeUrl | | HTTP client | createTmsClient, resolveEndpoint | | Editing internals | scanForTranslations, createHighlighter, createPicker, createPanelStore |

usageSignature and normalizeUrl are deliberately public so a host app's server can deduplicate the usage index without pulling in the browser-side code.

Security

The endpoints in the integration guide are shown unauthenticated, which is fine for local development and not fine in production. Put the PUT and POST routes behind an authentication and authorization check before deploying. The toggle cookie is a UI switch only — it does not protect routes.

License

MIT © Tobias Havmøller Secher