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

@singapore-editor/tree-sitter

v0.2.17

Published

Worker-based Tree-sitter parsing for Singapore syntax colors, folds, and brackets.

Readme

@singapore-editor/tree-sitter

Worker-based Tree-sitter parsing for Singapore syntax colors, folds, and brackets.

Part of Singapore. A code editor for the browser that keeps every version.

Install

npm install @singapore-editor/core @singapore-editor/tree-sitter @singapore-editor/tree-sitter-languages

Usage

import { Editor } from '@singapore-editor/core/editor'
import { createTreeSitterLanguagePlugin } from '@singapore-editor/tree-sitter'
import { TREE_SITTER_LANGUAGE_CONTRIBUTIONS } from '@singapore-editor/tree-sitter-languages/catalog'

const host = document.createElement('div')
host.style.height = '400px'
document.body.append(host)

const editor = new Editor(host, {
  plugins: [createTreeSitterLanguagePlugin(TREE_SITTER_LANGUAGE_CONTRIBUTIONS)],
})
editor.setText('const value = 1\n', { languageId: 'typescript' })

Requirements

Tree-sitter and native Markdown parsing need Chromium 144, Firefox 145, Safari 26.2, or newer, and Node.js 26.0.0 or Bun 1.2.22 or newer for parser calls outside a browser. The parser uses WebAssembly.Memory.prototype.toResizableBuffer(), and those are the first versions that support it.

API highlights

  • createTreeSitterLanguagePlugin() installs language contributions for structural parsing and editor palette colors.
  • createTreeSitterHighlighterPlugin() and createTreeSitterHighlighterProvider() paint VS Code themes through @shaulavo/tree-sitter-scope-compat on the same worker.
  • createTreeSitterSyntaxProvider() registers custom grammars.
  • expandTreeSitterSelection() selects a larger syntax node.

Generated API reference

Merge units

TreeSitterWorkerOwner.mergeUnit() queries an already-parsed snapshot using its document ID, runtime session ID, snapshot version, language ID and UTF-16 range. It returns status: 'ok' with the smallest enclosing syntax unit, its source-spelling signature and its parent's range and commutativity flag. A retired or unavailable snapshot returns status: 'stale' and unit: null.

Language contributions supply mergeUnitQuerySource. Queries capture @merge.unit, @merge.signature and @merge.commutative. An optional repeated @_merge.member capture limits commutativity to parents whose named semantic children all match that pattern. Comments leave eligibility unchanged. The worker compiles this query only when requested. Languages without a query, unmatched ranges and units with syntax errors use the enclosing complete lines with source: 'line'. Fallback includes requested line separators and keeps CRLF together.

Named JavaScript imports use the local alias as their signature when present. Go field names are individual units whose parent range identifies the owning declaration, including grouped fields. Ordered parents expose source-name hints; duplicate-signature comparisons apply to commutative parents. JavaScript class bodies and objects, Go and Rust field lists, and TypeScript interfaces containing methods or call signatures stay ordered. Property-only TypeScript interfaces and JSON objects allow unordered children.

Generic languages reuse their retained parse. Markdown creates a structural block tree on its first merge-unit request because its native renderer keeps its tree private. Injected code uses the deepest containing registered language's query. Successful results retain that selected language ID, including line fallback.

In the Singapore family

@singapore-editor/core owns the editor view. This optional package adds syntax parsing. Choose the other plugins your app needs. Use a bundler that serves the package worker and data assets. See the hosting guide.

Singapore README · Documentation

License

MIT. License