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

kysely-wasqlite-worker

v2.0.1

Published

kysely dialect for wa-sqlite, run sql in worker, store data in OPFS or IndexedDB

Downloads

1,503

Readme

kysely-wasqlite-worker

kysely dialect for @subframe7536/sqlite-wasm (using custom build wa-sqlite under the hood), execute sql in Web Worker, store data in OPFS or IndexedDB

No need to set response header like official wasm

[!important] This package is ESM-only in v2.

Install

bun add kysely kysely-wasqlite-worker @subframe7536/sqlite-wasm

kysely-wasqlite-worker is an ESM-only package and only works in modern browsers.

Usage

import { WaSqliteWorkerDialect } from 'kysely-wasqlite-worker'

const dialect = new WaSqliteWorkerDialect({
  fileName: 'test',
})

Custom Worker

in worker.ts

import { customFunctionCore, exportDatabase } from '@subframe7536/sqlite-wasm'
import { createOnMessageCallback, defaultCreateDatabaseFn } from 'kysely-wasqlite-worker'

createOnMessageCallback(
  async (init) => {
    const sqliteDB = await defaultCreateDatabaseFn(init)
    customFunctionCore(sqliteDB, 'myFunction', (a, b) => a + b)
    return sqliteDB
  },
  (executor, { type, payload }) => {
    if (type === 'export') {
      return exportDatabase(executor.db)
    }
    throw new Error(`Unknown worker request: ${type}`)
  },
)

Config

export interface WaSqliteWorkerDialectConfig {
  /**
   * db file name
   */
  fileName: string
  /**
   * prefer to store data in OPFS
   * @default true
   */
  preferOPFS?: boolean
  /**
   * wasqlite worker
   *
   * The built-in worker uses the packaged ESM worker entry and requires module worker support.
   * Provide a custom worker factory that returns a classic-compatible bundled worker
   * when supporting browsers without module workers.
   * @param supportModuleWorker if support { type: 'module' } in worker options
   * @example
   * (support) => support
   *   ? new Worker(new URL('kysely-wasqlite-worker/worker', import.meta.url), {
   *       type: 'module',
   *       credentials: 'same-origin',
   *     })
   *   : new Worker(new URL('./my-classic-worker.js', import.meta.url))
   */
  worker?: Worker | ((supportModuleWorker: boolean) => Worker)
  /**
   * wasm URL
   *
   * When omitted, `@subframe7536/sqlite-wasm` resolves its default runtime asset.
   * @param useAsyncWasm if need to use wa-sqlite-async.wasm
   * @example
   * const sqliteWasmVersion = '1.3.0'
   * (useAsync) => useAsync
   *   ? `https://esm.sh/@subframe7536/sqlite-wasm@${sqliteWasmVersion}/dist/wa-sqlite-async.wasm`
   *   : new URL(`@subframe7536/sqlite-wasm/dist/wa-sqlite.wasm`, import.meta.url).href
   */
  url?: string | ((useAsyncWasm: boolean) => string)
  onCreateConnection?: (
    connection: DatabaseConnection,
    options?: AbortableOperationOptions,
  ) => Promisable<void>
}

Custom worker requests use connection.request(type, payload) from the main thread. They are serialized with SQL execution.

see more in playground

If Vite needs an explicit worker output format, configure it in vite.config.ts:

export default defineConfig({
  // ...
  worker: {
    format: 'es',
  },
})

Limitation