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

@lvce-editor/cache-worker

v0.5.0

Published

Worker APIs for Cache Storage, IndexedDB, and OPFS

Readme

Cache Worker

Browser storage APIs for LVCE workers. @lvce-editor/cache-worker provides Cache Storage, IndexedDB, and Origin Private File System (OPFS) operations through a worker RPC command map.

Commands

| Command | Arguments | Result | | ------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | | Cache.getCacheStorageItem | (request, cacheName = 'lvce-cache') | Structured-cloneable { body: ArrayBuffer, headers: [string, string][], status, statusText } or null when missing | | Cache.setCacheStorageItem | (request, value, cacheName = 'lvce-cache') | undefined; stores a body accepted by the browser Response constructor | | Cache.removeCacheStorageItem | (request, cacheName = 'lvce-cache') | boolean indicating whether an item was removed | | IndexedDb.addIndexedDbFileHandle | (key, handle, databaseName = 'lvce-cache-worker') | undefined after the write transaction commits | | IndexedDb.getIndexedDbFileHandle | (key, databaseName = 'lvce-cache-worker') | Stored handle or null when missing through worker RPC | | IndexedDb.removeIndexedDbFileHandle | (key, databaseName = 'lvce-cache-worker') | undefined after the delete transaction commits; deleting a missing key is a no-op | | Opfs.readFile | (name) | UTF-8 text; rejects when the file does not exist | | Opfs.writeFile | (name, content) | undefined after the writable is closed | | Opfs.removeFile | (name) | undefined; rejects when the file does not exist |

Missing browser APIs reject with an error that names the unavailable capability. Browser storage quota, security, invalid key, structured-clone, and transaction errors are propagated to the caller. File handles must be structured-cloneable by the browser and writable in the current origin. OPFS filenames are single path components; directory traversal is not supported.

Resolve the worker entry URL with getCacheWorkerUrl and connect it using @lvce-editor/rpc's ModuleWorkerRpcParent:

import { ModuleWorkerRpcParent } from '@lvce-editor/rpc'
import { getCacheWorkerUrl } from '@lvce-editor/cache-worker'

const rpc = await ModuleWorkerRpcParent.create({
  commandMap: {},
  url: getCacheWorkerUrl().href,
})

The worker registers the commands in src/parts/CommandMap/CommandMap.js. Response values are converted to structured-cloneable data before crossing RPC; callers can create a new Response from the returned body and metadata.

Development

This repository uses npm workspaces and a root package-lock.json.

Run npm run dev to build the worker assets and start the development test server.

The cross-browser suite checks Cache Storage and OPFS through worker RPC in Chromium, Firefox, and WebKit. IndexedDB file-handle restoration is covered in Firefox; Chromium checks general structured-clone persistence. WebKit runs in CI as advisory coverage because some e2e tests may not pass there yet.

npm ci
npm test
npm run build
npm run e2e -- --browser=webkit

The browser suite runs against Chromium, Firefox, and WebKit. Install them with npx playwright install --with-deps chromium firefox webkit.

Synchronous cache clients

Opfs.getCacheFileHandle(namespace, name) returns a structured-cloneable FileSystemFileHandle beneath lvce-extension-caches/<namespace>/<name>. Both components must contain 1–80 lowercase ASCII letters, digits or hyphens, starting with a letter or digit. Reopening the same pair preserves its contents; separate namespaces do not share files. This directory avoids the root-level files used by synchronous RPC.

A dedicated worker can call createSyncAccessHandle() on the returned handle. The client owns that handle and must close it, including on failure and disposal. Use the default exclusive lock: concurrent clients that cannot acquire it should fall back to uncached reads. Cache-worker itself opens no access handles. The client remains responsible for size limits, its on-disk format, corruption validation, invalidation and crash recovery. This command does not authenticate extensions or isolate mutually untrusted code within an origin.