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

lindera-wasm

v6.2.0

Published

A morphological analysis library for WebAssembly.

Readme

lindera-wasm

WebAssembly of Lindera

Screenshot from 2025-09-13 23-05-49

Demo Application

npm

Dictionary

Pre-built dictionaries are available from GitHub Releases. Download a dictionary archive (e.g. lindera-ipadic-*.zip) and load it at runtime using the OPFS API. See the example application for a working demo of downloading and loading dictionaries.

Usage

Web Usage

The lindera-wasm package is built with wasm-pack's web target. Call the default-exported async init function (__wbg_init) once before using any API. Dictionaries are loaded at runtime from a local path or downloaded from GitHub Releases using the OPFS API.

import __wbg_init, { TokenizerBuilder, loadDictionaryFromBytes } from 'lindera-wasm';
import { downloadDictionary, loadDictionaryFiles } from 'lindera-wasm/opfs';

async function main() {
    await __wbg_init();

    // Download dictionary from GitHub Releases (first time only)
    await downloadDictionary("https://github.com/lindera/lindera/releases/download/v3.0.0/lindera-ipadic-3.0.0.zip", "ipadic");

    // Load dictionary from OPFS
    const files = await loadDictionaryFiles("ipadic");
    const dict = loadDictionaryFromBytes(
        files.metadata, files.dictTrie, files.dictValsIdx, files.dictVals,
        files.dictWordsIdx, files.dictWords, files.matrixMtx, files.charDef, files.unk
    );

    const builder = new TokenizerBuilder();
    builder.setDictionaryInstance(dict);
    builder.setMode("normal");
    const tokenizer = builder.build();

    const tokens = tokenizer.tokenize("すもももももももものうち");
    tokens.forEach(token => {
        console.log(`${token.surface}: ${token.details.join(", ")}`);
    });
}

main();

Bundler Usage (Webpack, Rollup, etc.)

Bundlers use the same lindera-wasm package. Modern bundlers (Vite, Webpack 5 with the asyncWebAssembly experiment) can consume the web-target build directly; call await __wbg_init() before using any API, exactly as in the web usage above. The dictionary loading approach is also the same.

Token Properties

Each token object has the following properties:

| Property | Type | Description | | -------- | ---- | ----------- | | surface | string | Surface form of the token | | byteStart | number | Start byte position in the original text | | byteEnd | number | End byte position in the original text | | position | number | Position index of the token | | wordId | number | Word ID in the dictionary | | isUnknown | boolean | Whether the token is an unknown word | | details | string[] | Morphological details array |

Tokens are plain JavaScript objects, not class instances, so read details directly (token.details[0]) and pass a token to JSON.stringify as-is.

For Vite Projects

You should exclude this package in the optimizeDeps:

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  optimizeDeps: {
    exclude: [
      "lindera-wasm"
    ]
  },
})

For Browser Extension Development

Set the cors config in vite.config.js:

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  server: {
    cors: {
      origin: [
        /chrome-extension:\/\//,
      ],
    },
  },
})

And set the content_security_policy to contain wasm-unsafe-eval in manifest.json:

"content_security_policy": {
  "extension_pages": "script-src 'self' 'wasm-unsafe-eval';"
}

Development

Install project dependencies

Setup repository

# Clone the Lindera project repository
% git clone [email protected]:lindera/lindera.git
% cd lindera

Build project

% make wasm-build

Run tests

% make wasm-test

Build example web application

% cd example && npm install && npm run build && cp index.html dist/index.html

Run example web application

% cd example && npm run start