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

@humanlayer/yjs-fs-react

v0.0.81

Published

React bindings for [`@humanlayer/yjs-fs`](../yjs-fs). Provides a context provider for a `YjsFilesystem` session plus hooks that subscribe to filesystem and awareness changes and re-render automatically, so components stay in sync with the underlying Yjs C

Readme

@humanlayer/yjs-fs-react

React bindings for @humanlayer/yjs-fs. Provides a context provider for a YjsFilesystem session plus hooks that subscribe to filesystem and awareness changes and re-render automatically, so components stay in sync with the underlying Yjs CRDT without manual event wiring.

Install

bun add @humanlayer/yjs-fs-react @humanlayer/yjs-fs yjs y-protocols react

Usage

Wrap your app in a provider, then read/write with hooks. Use YjsFilesystemProvider when your app already created the YjsFilesystem, Awareness, and transport provider:

import { YjsFilesystem } from '@humanlayer/yjs-fs'
import { YjsFilesystemProvider, useFilesystem, useFilesystemTree } from '@humanlayer/yjs-fs-react'
import * as Y from 'yjs'

const doc = new Y.Doc()
const filesystem = new YjsFilesystem({ doc })

function App() {
  return (
    <YjsFilesystemProvider filesystem={filesystem}>
      <FileTree />
    </YjsFilesystemProvider>
  )
}

function FileTree() {
  const filesystem = useFilesystem()
  const tree = useFilesystemTree('/')

  return (
    <button onClick={() => filesystem.createFile('/notes.md', '# hi')}>
      {tree.children.length} entries
    </button>
  )
}

Use YjsFilesystemSessionProvider when session creation is async (e.g. connecting a transport provider before the tree is usable). It calls createSession, renders loading until it resolves, and calls session.destroy() on unmount:

<YjsFilesystemSessionProvider
  createSession={async () => {
    const doc = new Y.Doc()
    const awareness = new Awareness(doc)
    const provider = new SomeYjsProvider({ doc, awareness })
    await provider.connect()
    return { filesystem: new YjsFilesystem({ doc, awareness }), awareness, provider, destroy: () => provider.destroy() }
  }}
  loading={<div>Loading…</div>}
>
  <App />
</YjsFilesystemSessionProvider>

Hooks

  • useFilesystem() / useYjsFilesystem() — the raw YjsFilesystem instance for imperative calls (createFile, mkdir, rename, unlink, stat, ...).
  • useFilesystemSession() / useYjsFilesystemSession() — the full context: { filesystem, awareness, provider }.
  • useDirectoryEntries(path?)EntryDirent[] of immediate children, re-renders on any filesystem change.
  • useFilesystemTree(path?) / useTree() — recursive FilesystemTreeNode rooted at path (defaults to /).
  • useEntryStat(path) / useStat()EntryStat | null for a path, subscribed to just that path.
  • useYTextForFile(path) / useYText() — the collaborative Y.Text backing a text file, for binding to editors like TipTap or Monaco.
  • useFileSelector(path, select) / useSnapshot() — escape hatch to derive an arbitrary value from the filesystem, re-evaluated whenever path changes.
  • useYjsProvider() / useProvider() — the raw transport provider instance.
  • useConnectionStatus()'disconnected' | 'connecting' | 'connected', read from the provider's connected/connecting flags and 'status' events.
  • useIsSynced() / useSynced() — whether the provider has completed initial sync ('synced' event).
  • useYjsAwareness() / useAwareness() — the Awareness instance (throws if none was provided).
  • useAwarenessStates() — reactive Map<clientId, TState> of all peers' awareness state, for presence UIs.
  • useFilesystemRawYDoc() / useYjsDocument() / useDoc() — the underlying Y.Doc.

All change-driven hooks subscribe to filesystem.subscribe / filesystem.subscribePath (or awareness's 'change' event and the provider's 'status'/'synced' events) and re-render on change, so updates from remote peers propagate automatically without manual listeners.

Connection-status hooks work with any transport provider shaped like { connected?, connecting?, synced?, on(event, fn), off(event, fn) } — this matches y-websocket, y-webrtc, and similar providers without requiring a specific one.