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

@kindly-note/lang-json

v0.1.0

Published

JSON language definition for kindly-note. Aliases: json, jsonc, json5. Default-exports a deep-frozen LanguageDefinition.

Downloads

51

Readme

@kindly-note/lang-json

JSON, JSONC, and JSON5 language definition for kindly-note. A single deep-frozen LanguageDefinition covering all three dialects on one unified lexical surface — property names, strings, numbers, literals, punctuation, and (for JSONC / JSON5) line and block comments.

Implements row @kindly-note/lang-json of the architectural spec (docs/plan/architect-spec.md §1.2). Validates spec §0 shifts #1 (languages are values) and #2 (compile-at-register-time, immutable).

Install

bun add @kindly-note/core @kindly-note/lang-json

The package's dependencies already pull in @kindly-note/lang-helpers and @kindly-note/lang-pack-ecmascript transitively — you only need to install @kindly-note/core (the engine) alongside it.

Usage

import { createHighlighter } from '@kindly-note/core';
import json from '@kindly-note/lang-json';

const hl = createHighlighter({ languages: [json] });
const result = hl.highlight('{"a":1}', { language: 'json' });
console.log(result.value);

The default export is a LanguageDefinition value, not a factory function — no global registry is mutated on import, and bundlers tree-shake unused languages by import graph alone (spec §0 shift #1).

Example output spans

With the default htmlEmitter (class prefix kn-), the input {"a":1} renders as:

<span class="kn-punctuation">{</span><span class="kn-attr">"a"</span><span class="kn-punctuation">:</span><span class="kn-number">1</span><span class="kn-punctuation">}</span>

Token-type coverage:

| scope | matches | |----------------|--------------------------------------------------| | attr | property names — "key": (lookahead-anchored) | | string | string values (double- and single-quoted for JSON5) | | number | 42, -3, 2.5, 1e6, 0xFF (extended) | | literal | true, false, null | | punctuation | { } [ ] , : | | comment | // line and /* block */ (JSONC / JSON5 only) |

Whitespace between tokens ( , \n, \t) is preserved as raw text — never wrapped in a span — so reformatted output is byte-identical to the input when stripped of HTML tags.

Aliases

json, jsonc, and json5 all resolve to the same registered handle:

const hl = createHighlighter({ languages: [json] });

hl.getLanguage('json');   // → handle
hl.getLanguage('jsonc');  // → same handle
hl.getLanguage('json5');  // → same handle
hl.getLanguage('JSONC');  // → same handle (case-insensitive)

The canonical name is JSON, returned by listLanguages() and on HighlightResult.language. Round-1 user lock: byte-for-byte fixture parity with upstream highlight.js is not a goal — structural correctness (correct scope on each lexeme) is.

The illegal: '\\S' rule is strict: any non-whitespace lexeme outside the recognised modes fires IllegalSyntaxError, surfacing as result.illegal: true. A future @kindly-note/lang-json-strict may tighten the surface to RFC 8259 (no comments, double-quoted strings only).

Status

Cohort 3b — shipped alongside @kindly-note/lang-pack-ecmascript. 18 tests across frozen-definition, end-to-end highlight, alias resolution, nested objects/arrays, whitespace preservation, compilation immutability, and sanity (illegal handling, empty containers, number variants). See docs/plan/build-manifest-c3b.md for the full verification log.

License

MIT. See LICENSE.