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

@lingva/electron

v0.1.0

Published

Electron integration adapter for Lingva localization

Readme

@lingva/electron

Thin Electron-facing adapter over the framework-agnostic Lingva runtime.

pnpm add @lingva/electron
pnpm add -D @lingva/cli

Local resources

pnpm lingva init --mode local --no-auth --sdk vanilla

Import the generated runtime config and project into an application-owned module. This example is at the consumer repository root and assumes welcome.title is a configured translation key:

import { createLingvaElectronRuntime } from '@lingva/electron';
import runtimeConfig from './.lingva/generated/runtime';
import project from './.lingva/generated/project';

const runtime = createLingvaElectronRuntime({ ...runtimeConfig, project });
console.log(runtime.tSync('welcome.title'));
runtime.destroy();

In a running application, retain the runtime for its owning window or main process instead of destroying it immediately. Subscribe to getSnapshot() updates with subscribe(listener) and retain the returned unsubscribe function. Call it and destroy() when that owner shuts down. Local generated resources can be bundled without Node filesystem access.

Hosted refresh

For distributable applications, prefer a customer-owned authenticated backend that forwards authorized reads to Lingva. Here bundleUrlTemplate is that backend's URL containing {locale}, and sessionToken is the application's user-session credential, not a Lingva administrative or publishing key:

import { createLingvaElectronRuntime } from '@lingva/electron';

export async function loadTitle(bundleUrlTemplate: string, sessionToken: string, locale: string) {
  const runtime = createLingvaElectronRuntime({
    mode: 'remote',
    projectId: 'desktop-app',
    locale,
    fallbackLocale: 'en',
    remote: {
      url: bundleUrlTemplate,
      headers: { Authorization: `Bearer ${sessionToken}` },
    },
  });
  try {
    await runtime.loadLocale(locale);
    return runtime.tSync('welcome.title');
  } finally {
    runtime.destroy();
  }
}

Validate the locale and use an application-controlled URL before calling this function. Loading errors reject; decide whether to fail or use a packaged fallback. setLocale alone does not download hosted translations.

Boundaries

createLingvaElectronRuntime(input) wraps createLingvaJsRuntime(input); the package also re-exports that JS factory and its types. It does not install Electron IPC handlers, configure contextBridge, add filesystem loaders, or provide persistent/offline storage. Own those integrations in the application.

Keep Lingva write/admin credentials on the backend. A key in an Electron main process or packaged environment is still extractable; moving it out of the renderer does not make it a server secret. If direct hosted reads are suitable for your threat model, use only a delivery:read key and copy the deployment's URL and environment from the project setup page. Expose only the required translated values through a narrow, validated application-owned IPC boundary.

Read the public documentation.