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

arche-highlight

v0.10.2

Published

Syntax highlighting for vanilla microfrontends

Readme

ArcheHighlight

Syntax highlighting for vanilla microfrontends. Converts JavaScript code into a React Element or HTML.

Source code: GitHub | License: CFOSS

Node.js CI codecov npm version

const ReactElement = Arche(React)
window.Span = ReactElement.Span

const code = `
function f() {
  const x = 1
}

f()
`

ArcheHighlight.parseJavaScript(code)
// '<span class="function-keyword">function</span>',
// ' ',
// '<span class="function-name">f</span>',
// ' ',
// '(',
// ')',
// ' ',
// '{',
// '\n',
// ' ',
// ' ',
// '<span class="variable-declaration-keyword">const</span>',
// ' ',
// 'x',
// ' ',
// '<span class="operator">=</span>',
// ' ',
// '<span class="number">1</span>',
// '\n',
// '}',
// '\n',
// '\n',
// '<span class="function-name">f</span>',
// '(',
// ')',
// '\n',

React Element or HTML

ArcheHighlight requires a special Span function to exist globally on the server globalThis object or on the client window object. The global Span function can be from ReactElement, which is created from Arche and React.

const ReactElement = Arche(React)
window.Span = ReactElement.Span

React can be the React library or a server-side polyfill of React. ArcheHTML comes installed with a React polyfill for server-side rendering.

Docs

ArcheHighlight.parseJavaScript(code string) -> parsed string|object

ArcheHighlight JavaScript parser. Parses code into a React Element or HTML with JavaScript classes.

Arguments:

  • code - string - the JavaScript code to highlight.

Return:

  • parsed - string|object - a React Element or HTML with JavaScript classes.

JavaScript Classes

The following JavaScript classes are added to the code as span elements of the parsed React Element or HTML:

  • shebang-interpreter-directive - an interpreter directive at the beginning of a script starting with the shebang (#!) that instructs the loader of the script to execute the specified interpreter, for example #!/usr/bin/env node.

  • comment - single line (//) or multi-line comments (/* */).

  • number - numbers, for example 1, 0, 2.5, -1, 100.

  • string - strings, for example "a", 'a', "This is a string.".

  • template-literal - template literals, for example `This is a${x} ${y} literal`.

  • template-variable - variables in template literals, for example the ${x} and ${y} in the template literal above.

  • bigint - JavaScript BigInts, for example 2n.

  • variable-declaration-keyword - var, const, let.

  • keyword - import, new, async, await, for, while, of.

  • function-keyword - the function keyword for function declarations, for example function f() {}.

  • arrow-function-operator - the arrow function operator => for arrow function declarations, for example const fn = () => {}.

  • function-name - the name of a function, either in a function declaration or as the function of a function call, for example in function f() {}, f would have a function-name class, and in add(1, 2), add would have a function-name class.

  • operator - the JavaScript operators +, -, *, /, **, =, +=, ++, -=, *=, /=, **=, ==, ===, !=, !==, >, >=, <, <=, ?, :, &&, ||, ??, &, |, ^, ~, >>, <<, &=, |=, and ^=.

  • object-colon - the colons (:) separating keys from values in JavaScript objects.

  • property-accessor - the property access operator or dot operator (.), for example Array.from.

  • spread-operator - the JavaScript spread operator (...).

  • global-object - global objects and functions: process, require, console, window, global, globalThis, isNaN.

  • undefined - the undefined value.

  • null - the null object.

  • boolean - booleans true and false.

  • not-a-number - the special numeric value NaN that represents an undefined or unrepresentable number, for example 0 / 0.

Example

Please find a runnable example in the example directory. You can run the example with a static web server such as Static Web Server.

static-web-server --port=8080 --root=./example -e=false

License

ArcheHTML is distributed under the CFOSS License.

Support

  • minimum Node.js version: 16
  • minimum Chrome version: 63
  • minimum Firefox version: 57
  • minimum Edge version: 79
  • minimum Safari version: 11.1