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-javascript

v0.1.0

Published

JavaScript language definition for kindly-note. Aliases: js, jsx, mjs, cjs. Default-exports a deep-frozen LanguageDefinition with typed JavaScriptExtensionPoints for downstream extenders (TypeScript, CoffeeScript).

Downloads

59

Readme

@kindly-note/lang-javascript

The JavaScript / JSX / MJS / CJS language definition for kindly-note. Default-exports a deep-frozen LanguageDefinition and publishes a typed JavaScriptExtensionPoints surface so downstream packages (notably @kindly-note/lang-typescript) can compose new languages without mutating JavaScript's internals.

This package is the keystone of the language-extension story laid out in architect-spec.md §8.2: a parent that exposes a typed extension contract, consumed by descendants through the extendLanguage() API rather than through array-mutation of an untyped exports: any field.

Install

npm install @kindly-note/core @kindly-note/lang-javascript
# or: bun add / pnpm add / yarn add

@kindly-note/core is a peer-style runtime dependency — bring your own version. lang-helpers and lang-pack-ecmascript are workspace dependencies of this package and resolve transitively.

Usage

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

const hl = createHighlighter({ languages: [javascript] });
hl.highlight('const x = 1;', { language: 'javascript' }).value;
// → '<span class="kn-keyword">const</span> x = <span class="kn-number">1</span>;'

The default export is a deep-frozen LanguageDefinition<JavaScriptExtensionPoints>; the matcher in @kindly-note/core compiles a fresh CompiledLanguage at register time. Raw definitions are never mutated.

Aliases

The language registers under all of these names:

  • js
  • jsx
  • mjs
  • cjs

Any of them work as the language: argument to highlight() and as the lang-… className on <pre><code> blocks.

Extension points

The extensible field on the LanguageDefinition publishes a typed contract — the named export JavaScriptExtensionPoints:

export interface JavaScriptExtensionPoints {
  /** The contains-array used inside function-parameter parsing. */
  readonly PARAMS_CONTAINS: readonly Mode[];
  /** The mode that matches a class reference (e.g. `extends Foo`). */
  readonly CLASS_REFERENCE: Mode;
}

Downstream packages consume the contract through extendLanguage(). The child supplies pure transforms — never mutations — for the points it cares about. The parent stays frozen; the call returns a sibling LanguageDefinition:

import { extendLanguage } from '@kindly-note/core';
import javascript, {
  type JavaScriptExtensionPoints,
} from '@kindly-note/lang-javascript';

const DECORATOR: Mode = { scope: 'meta', match: '@' + IDENT_RE };

const typescript = extendLanguage(javascript, {
  name: 'TypeScript',
  aliases: ['ts', 'tsx', 'mts', 'cts'],
  extendPoints: {
    PARAMS_CONTAINS: (current) => [...current, DECORATOR],
  },
  addContains: [
    DECORATOR,
    INTERFACE_MODE(javascript.extensible!), // closure over CLASS_REFERENCE
  ],
});

@kindly-note/lang-typescript is the canonical consumer of this surface; it adds DECORATOR to PARAMS_CONTAINS and uses CLASS_REFERENCE inside its interface … extends Foo mode. See architect-spec.md §8.2.2 for the full worked example. Other future descendants (CoffeeScript, etc.) plug in the same way.

Two structural guarantees are worth calling out:

  • The extension surface is typed. extendLanguage<JavaScriptExtensionPoints> statically constrains extendPoints to PARAMS_CONTAINS and CLASS_REFERENCE — typos are caught by tsc.
  • The extension is non-mutating. PARAMS_CONTAINS is readonly Mode[]; descendants compose with (current) => [...current, …] rather than current.push(…).

Status

v0.0.1. Cohort 4 (the keystone). Public API is minimal — a default export plus the JavaScriptExtensionPoints type — and is governed by the architect spec. Breaking changes before 1.0.0 are documented through the repo's changeset workflow.

License

MIT. See the repo root for the full text.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]