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

font-obfuscator-kit

v0.1.0

Published

Build mapped webfonts and obfuscate text for DOM font obfuscation.

Downloads

89

Readme

font-obfuscator-kit

font-obfuscator-kit is a small npm package for:

  1. Building a mapped woff2 font (PUA codepoints -> real glyphs).
  2. Obfuscating text so DOM text nodes become unreadable in Elements.

Install

npm install ./font-obfuscator

Prerequisites

The build-font command depends on Python fonttools:

python3 -m pip install fonttools brotli zopfli

1) Prepare charset file

Create charset.txt with the characters you want to obfuscate.

Example (letters + numbers + common code symbols):

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.$(){}[]<>+-*/%!=&|^~?:;,'"`\#@

Note: if you also want to obfuscate spaces, append one trailing space at the end of this line.

2) Build mapped font

npx font-obf build-font \
  --src-font ~/Downloads/HackNerdFont-Regular.ttf \
  --charset-file ./charset.txt \
  --out-font ./dist/code-obf.woff2 \
  --out-map ./dist/code-obf-map.json

3) Obfuscate text

npx font-obf obfuscate \
  --charset-file ./charset.txt \
  --text "Closure and counterA"

Or obfuscate a full file:

npx font-obf obfuscate \
  --charset-file ./charset.txt \
  --in-file ./input.txt \
  --out-file ./dist/input.obf.txt

Browser usage pattern

<style>
  @font-face {
    font-family: "CodeObf";
    src: url("./code-obf.woff2") format("woff2");
    font-display: swap;
  }
  .obf-scope { font-family: "CodeObf", sans-serif; }
</style>

Then replace letters in text nodes with obfuscated characters (using the same mapping rule / map file) after page load.

API

const {
  createCharMapFromCharset,
  obfuscateText,
  deobfuscateText,
  obfuscateDomTextNodes
} = require("font-obfuscator-kit");

TypeScript: built-in .d.ts is included.

For browser-side usage (VuePress / client runtime), import from:

import { createCharMapFromCharset, obfuscateDomTextNodes } from "font-obfuscator-kit/browser";

VuePress integration

If you want:

  • Markdown source stays normal text
  • Final page looks normal
  • DevTools Elements text nodes show obfuscated chars

Use runtime obfuscation in client.

VuePress v2 (.vuepress/client.ts)

import { defineClientConfig } from "vuepress/client";
import { createCharMapFromCharset, obfuscateDomTextNodes } from "font-obfuscator-kit/browser";

const CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.$(){}[]<>+-*/%!=&|^~?:;,'\"`\\#@";
const charMap = createCharMapFromCharset(CHARSET, { baseCodepoint: "0xE100" });

function runObfuscation() {
  const root = document.querySelector(".theme-default-content") || document.body;
  obfuscateDomTextNodes(root, charMap, {
    excludeTags: ["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "INPUT", "CODE", "PRE"]
  });
}

export default defineClientConfig({
  enhance({ router }) {
    if (typeof window === "undefined") return;
    window.addEventListener("DOMContentLoaded", runObfuscation, { once: true });
    router.afterEach(() => {
      window.requestAnimationFrame(runObfuscation);
    });
  }
});

Full runnable sample:

examples/vuepress-v2-ts

Then in .vuepress/styles/index.scss:

@font-face {
  font-family: "CodeObf";
  src: url("/assets/code-obf.woff2") format("woff2");
  font-display: swap;
}

.theme-default-content {
  font-family: "CodeObf", var(--vp-font-family-base);
}

VuePress v1 (.vuepress/enhanceApp.js)

import { createCharMapFromCharset, obfuscateDomTextNodes } from "font-obfuscator-kit/browser";

const CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.$(){}[]<>+-*/%!=&|^~?:;,'\"`\\#@";
const charMap = createCharMapFromCharset(CHARSET, { baseCodepoint: "0xE100" });

function runObfuscation() {
  const root = document.querySelector(".theme-default-content") || document.body;
  obfuscateDomTextNodes(root, charMap);
}

export default ({ router }) => {
  if (typeof window === "undefined") return;
  window.addEventListener("load", runObfuscation);
  router.afterEach(() => setTimeout(runObfuscation, 0));
};

Limitations

  • This is obfuscation, not strong encryption.
  • If attacker gets both font and mapping rule, text can be recovered.