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

dust-embeddings-capacitor

v0.1.4

Published

Capacitor plugin for on-device embedding model tokenization and inference.

Readme



capacitor-embeddings

Capacitor plugin for on-device tokenization and embedding inference — BPE and WordPiece tokenizers, ONNX-backed embedding sessions, pooling strategies, and vector math utilities.

Current version: 0.1.0

Features

  • BPETokenizer — byte-pair encoding tokenizer with vocabulary file loading
  • WordPieceTokenizer — subword splitting for BERT-family models
  • EmbeddingSession — load an ONNX embedding model and run inference
  • EmbeddingSessionManager — multi-session lifecycle with reference counting
  • PoolingStrategy — CLS token, mean pooling, max pooling
  • VectorMath — cosine similarity, dot product, L2 normalization
  • DustCore integration — registers as an EmbeddingService in the DustCore service locator

Platform support

| | Android | iOS | Web | |---|---|---|---| | Runtime | dust-embeddings-kotlin + dust-onnx-kotlin | dust-embeddings-swift + dust-onnx-swift | Stub (throws) | | Min version | API 26 | iOS 16.0 | — |

Install

npm install dust-embeddings-capacitor dust-core-capacitor
npx cap sync

dust-core-capacitor is a required peer dependency — it provides the shared ML contract types and the DustCoreRegistry that capacitor-embeddings uses to register itself as an EmbeddingService.

iOS (CocoaPods)

# Podfile
platform :ios, '16.0'
use_frameworks! :linkage => :static

pod 'DustCapacitorEmbeddings', :path => '../capacitor-embeddings'
pod 'DustCapacitorCore',       :path => '../capacitor-core'

Android

The Kotlin plugin resolves dust-embeddings-kotlin and dust-onnx-kotlin as local project dependencies via the Capacitor Gradle build.

Quick Start

import { EmbeddingPlugin } from 'dust-embeddings-capacitor';

// Tokenize text
const { tokens } = await EmbeddingPlugin.tokenize({
  text: 'Hello, world!',
  tokenizer: 'bpe',
  vocabPath: '/path/to/vocab.json',
});

// Load an embedding model and generate a vector
await EmbeddingPlugin.loadModel({ modelId: 'embed-v1', modelPath: '/path/to/model.onnx' });
const { embedding } = await EmbeddingPlugin.embed({
  modelId: 'embed-v1',
  text: 'Hello, world!',
  pooling: 'mean',
});
console.log('embedding dim:', embedding.length);

// Compute cosine similarity
const { score } = await EmbeddingPlugin.cosineSimilarity({ a: embedding, b: otherEmbedding });

Project structure

capacitor-embeddings/
├── package.json                         # v0.1.0, peer deps: @capacitor/core ^7||^8, dust-core-capacitor >=0.1.0
├── Package.swift                        # SPM: EmbeddingsPlugin target, depends on dust-embeddings-swift
├── DustCapacitorEmbeddings.podspec      # CocoaPods: depends on DustEmbeddings, DustCapacitorCore
├── src/
│   ├── definitions.ts                   # EmbeddingPlugin interface, tokenizer types, pooling enums
│   ├── plugin.ts                        # WebPlugin stub (all methods throw "unimplemented")
│   └── index.ts                         # Barrel export
├── ios/Sources/EmbeddingsPlugin/
│   └── EmbeddingsPlugin.swift           # CAPPlugin bridge, DustCoreRegistry EmbeddingService registration
├── android/
│   ├── build.gradle                     # api project(':dust-embeddings-kotlin')
│   └── src/main/java/.../EmbeddingsPlugin.kt
└── tests/unit/                          # TypeScript unit tests (Vitest)

Dependency chain

capacitor-embeddings
  ├── dust-core-capacitor  (peer)
  ├── dust-embeddings-kotlin  (Android native)
  │   ├── dust-core-kotlin
  │   ├── dust-onnx-kotlin
  │   └── dust-llm-kotlin
  └── dust-embeddings-swift  (iOS native)
      ├── dust-core-swift
      ├── dust-onnx-swift
      └── dust-llm-swift

Related packages

| Package | Layer | Purpose | |---------|-------|---------| | dust-core-capacitor | Bridge | Shared contracts — EmbeddingService protocol | | dust-embeddings-kotlin | Kotlin | Tokenizers, ONNX embedding sessions, vector math | | dust-embeddings-swift | Swift | Tokenizers, ONNX embedding sessions, vector math | | dust-onnx-capacitor | Bridge | ONNX Runtime model loading (underlying runtime) |

License

Copyright 2026 Rogelio Ruiz Perez. Licensed under the Apache License 2.0.