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

zap-syntax

v1.0.0

Published

Syntax highlighting for ZAP (Zero-copy Application Protocol) schema files

Readme

ZAP Protocol Syntax Highlighting

Docs: ZAP schema syntax highlighting · part of the ZAP Protocol

Official syntax highlighting for ZAP (Zero-copy Application Protocol) schema files.

Features

  • Full TextMate grammar for .zap and .zaps files
  • Compatible with Shiki, VS Code, Monaco, and TextMate-based editors
  • Highlights:
    • Structs, enums, interfaces, services
    • Field IDs (@0, @1, etc.)
    • Unique IDs (@0xdbb9ad1f14bf0b36)
    • Primitive types (Int32, Float64, Text, etc.)
    • Short aliases (i32, f64, bool, etc.)
    • Composite types (List, Map, Option, Result)
    • Comments (#, //, /* */)
    • Strings (double, single, backtick)
    • Numbers (decimal, hex, binary, octal, float)
    • Annotations and modifiers
    • RPC definitions

Installation

npm / pnpm / yarn

npm install zap-syntax
pnpm add zap-syntax
yarn add zap-syntax

VS Code

Search for "ZAP Protocol" in the VS Code extensions marketplace, or:

code --install-extension zap-protocol.zap-syntax

Usage

Shiki (Recommended for Web)

import { createHighlighter } from 'shiki';
import { registerZapLanguage } from 'zap-syntax';

const highlighter = await createHighlighter({
  themes: ['github-dark', 'github-light'],
  langs: [],
});

// Register ZAP language
await registerZapLanguage(highlighter);

// Highlight code
const html = highlighter.codeToHtml(`
struct Point @0 {
  x @0 :Float64;
  y @1 :Float64;
}
`, {
  lang: 'zap',
  theme: 'github-dark'
});

Shiki with Bundled Langs

import { createHighlighter } from 'shiki';
import zapGrammar from 'zap-syntax/grammar';

const highlighter = await createHighlighter({
  themes: ['github-dark'],
  langs: [
    {
      name: 'zap',
      scopeName: 'source.zap',
      ...zapGrammar
    }
  ],
});

Fumadocs (Next.js)

Add to your source.config.ts:

import { rehypeCode } from 'fumadocs-core/mdx-plugins';
import zapGrammar from 'zap-syntax/grammar';

export default {
  mdxOptions: {
    rehypePlugins: [
      [rehypeCode, {
        langs: [zapGrammar]
      }]
    ]
  }
};

Or in your shiki configuration:

// lib/shiki.ts
import { createHighlighter } from 'shiki';
import { getZapGrammar } from 'zap-syntax';

export async function getHighlighter() {
  const highlighter = await createHighlighter({
    themes: ['github-dark-dimmed'],
    langs: ['typescript', 'go', 'rust', getZapGrammar()],
  });
  return highlighter;
}

Monaco Editor

import * as monaco from 'monaco-editor';
import zapGrammar from 'zap-syntax/grammar';

monaco.languages.register({ id: 'zap', extensions: ['.zap', '.zaps'] });

// Use with monaco-textmate or monaco-vscode-textmate-theme-converter

Schema Example

# ZAP Protocol Schema
@0xdbb9ad1f14bf0b36;

struct Message @0 {
  id @0 :UInt64;
  timestamp @1 :Int64;
  payload @2 :Data;
  metadata @3 :Map(Text, Text);
}

enum Status @1 {
  pending @0;
  success @1;
  error @2;
}

interface Calculator @2 {
  add @0 (a :Float64, b :Float64) -> (result :Float64);
  multiply @1 (a :Float64, b :Float64) -> (result :Float64);
}

service MathService @3 {
  rpc Calculate (Request) returns (Response);
  rpc Stream (stream Request) returns (stream Response);
}

Scopes

The grammar provides the following TextMate scopes:

| Scope | Description | |-------|-------------| | keyword.control.zap | struct, enum, interface, union, service | | keyword.other.zap | import, using, const, extends | | keyword.modifier.zap | inline, packed, aligned, optional | | storage.type.primitive.zap | Int32, Float64, Text, Bool, etc. | | storage.type.composite.zap | List, Map, Set, Option, Result | | entity.name.type.zap | User-defined types | | constant.numeric.field-id.zap | @0, @1, @2, etc. | | keyword.other.unique-id.zap | @0xdbb9ad1f14bf0b36 | | comment.line.number-sign.zap | # comments | | string.quoted.double.zap | "strings" | | constant.numeric.*.zap | Numbers (int, float, hex, etc.) |

API

Functions

  • getZapGrammar() - Returns the TextMate grammar object
  • registerZapLanguage(highlighter) - Registers ZAP with a Shiki highlighter

Exports

  • zapGrammar - The raw TextMate grammar JSON
  • zapLanguageConfiguration - VS Code language configuration
  • zapLanguage - Shiki language definition object

Development

# Clone
git clone https://github.com/zap-protocol/syntax.git
cd syntax

# Install
pnpm install

# Build
pnpm build

# Test highlighting
pnpm test

Quick Fallback

While setting up custom Shiki integration, you can use proto as a language alias since ZAP's schema syntax is similar to Protocol Buffers:

\`\`\`proto
struct Message @0 {
  id @0 :UInt64;
  payload @1 :Data;
}
\`\`\`

This provides basic syntax highlighting until full ZAP language support is configured.

Related

License

MIT License - see LICENSE


ZAP Protocol — Infinitely faster. Zero-copy Application Protocol for the age of AI & crypto.