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

@lionrapid/core

v0.5.0

Published

Core functionality for LionRapid localization library with fixed dist publishing

Readme

@lionrapid/core

Core translation engine for LionRapid. TypeScript-first i18n with multi-layer caching, server sync, and browser auto-translation.

Installation

npm install @lionrapid/core

Usage

Developer mode (npm)

import {
  LionRapidBuilder,
  MemoryRepository,
  NetworkRepository,
} from '@lionrapid/core';

const lionRapid = await LionRapidBuilder.init({
  defaultLocale: 'en',
  namespace: 'app',
})
  .use(new MemoryRepository({ enabled: true }))
  .use(
    new NetworkRepository({
      enabled: true,
      options: { baseUrl: 'https://api.lionrapid.com' },
    })
  )
  .build();

// Translate
const text = lionRapid.t('welcome', 'Welcome!');

// With parameters (ICU MessageFormat)
const greeting = lionRapid.t('greeting', { name: 'John' });

// Change language
await lionRapid.changeLanguage('es');

// Get current locale
const locale = lionRapid.getCurrentLocale(); // 'es'

Auto-init mode (script tag)

No build step required. Add to any HTML page:

<script
  src="https://cdn.lionrapid.com/lionrapid.auto.min.js"
  data-api-key="pk_eng_xxx"
  data-base-url="https://api.lionrapid.com"
  data-default-locale="en"
  data-languages="en,es,fr"
  data-mode="full"
  async
></script>

Auto-init scans the DOM, extracts text blocks, fetches translations, and applies them in-place. Includes a floating language switcher.

Features

  • Multi-layer cache: Memory (sync) -> LocalStorage -> Cache API -> Network
  • Auto-sync missing keys: Batched POST of untranslated content to your backend
  • ICU MessageFormat: Plurals, select, date/time, number formatting (via @lionrapid/formatters plugin)
  • Event-driven: Subscribe to language:change:success, repo:set:success, and more
  • Block-level translation: ContentUnit format preserves inline styles (<1>bold</1>)
  • Visual editor: Built-in editor activated via ?__lr_editor=grant_xxx query param
  • Tree-shakable: Import only what you use

API

// Translation
t(key: string, fallback?: string): string
t(key: string, params: Record<string, unknown>, fallback?: string): string

// Language
await lionRapid.changeLanguage('fr');
lionRapid.getCurrentLocale(); // 'fr'

// Events
lionRapid.bus.on('language:change:success', (envelope) => {
  console.log(envelope.payload.newLocale);
});

Browser Bundles

| Bundle | Use case | | ------------------------- | --------------------------- | | lionrapid.auto.min.js | Script tag auto-translation | | lionrapid.iife.min.js | Script tag (developer mode) | | lionrapid.esm.min.js | ES modules | | lionrapid.umd.min.js | Universal (CommonJS + AMD) | | lionrapid.editor.min.js | Visual editor (lazy-loaded) |

Related Packages

License

MIT