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

@ssvg/core

v0.0.15

Published

Core SSVG compiler: compileSSVG(xml, options) -> structured SVG result.

Readme

@ssvg/core

Core sSVG compiler for parsing sSVG files into SVG and HTML files with SVG blocks.

For more information about sSVG, how it works, and why, visit SimpleSVG.dev.

This package exports two main functions (asynchronous in Node, synchronous in browser):

  • compileSSVG: Compiles .ssvg files to .svg
  • compileHTML: Compiles <ssvg> blocks within HTML to valid HTML with <svg> blocks

Installation

npm install @ssvg/core

Usage

Node (ESM/CommonJS)

import { compileSSVG, compileHTML } from '@ssvg/core';

const svgResult = await compileSSVG(ssvgContent, options);
const htmlResult = await compileHTML(htmlContent, options);

Browser Build

A dedicated browser build is available via:

import { compileSSVG, compileHTML } from '@ssvg/core/browser';

const svgResult = compileSSVG(ssvgContent, options);   // Synchronous API
const htmlResult = compileHTML(htmlContent, options);  // Synchronous API
  • The browser build exposes the synchronous compileSSVG and compileHTML functions.
  • Both return the same CompileResult structure as in Node, but synchronously.
  • Imports are supported only from local files (using XMLHttpRequest). Remote URLs and Node.js modules (fs, node-fetch) are NOT supported.
  • Use the baseDir option to set the base path for local imports (relative to site root).

Exports

The package uses conditional exports in package.json:

"exports": {
  ".": {
    "types": "./dist/index.d.ts",
    "import": "./dist/index.js",
    "require": "./dist/index.cjs"
  },
  "./browser": {
    "import": "./dist/browser.js",
    "default": "./dist/browser.js"
  }
}

API

Parameters

  • ssvgContent (string): The sSVG markup as a string.
  • htmlContent (string): The HTML markup containing <ssvg> blocks as a string.
  • options (optional object):
    • baseDir (string): Base directory for resolving relative imports. Defaults to process.cwd() (Node) or '' (browser).
    • prettyDecimals (number | null): Number of decimal places for numeric values in output. If null, no rounding is applied.

Return Value

Both functions return a Promise<CompileResult> (Node) or CompileResult (browser) where CompileResult is:

{
  ok: boolean;           // true if compilation succeeded
  body?: string;         // The compiled SVG or HTML string on success
  error?: {              // Error details if ok is false
    message: string;
    code?: string;
    details?: any;
  };
  warnings?: string[];   // Array of warning messages
  stats?: {              // Compilation statistics
    durationMs?: number;
  };
  configUsed?: {         // The options that were actually used
    prettyDecimals?: number | null;
    baseDir?: string;
  };
}

License

MIT