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

unsvgr

v0.0.4

Published

Convert react-native-svg TSX to static .svg (string transforms).

Readme

unsvgr

npm version npm downloads license package size TypeScript Bun

Convert react-native-svg TS/TSX icon components into static .svg files.

Demo

Install

bun install unsvgr
- or
bunx unsvgr

CLI

The package exposes a bin:

unsvgr

Usage

unsvgr [input] [outputDir] [options]

Arguments

  • input (optional): .ts/.tsx file or directory.
    • If omitted, the CLI scans --input.
  • outputDir (optional): output folder for generated SVG files.
    • If omitted, defaults to the same folder as each input file.

Options

  • -i, --input <dir>
    Directory to scan when input argument is omitted.
    Default: src/components/svgs

  • -o, --output <dir>
    Output directory (same meaning as positional outputDir).

  • --nano
    Skip icons that contain filter/mask features:

    • <filter> or <mask> tags
    • filter="..." or mask="..." attributes

Output behavior

  • Converts all exported components that contain <Svg>...</Svg>.
  • File name format: <ComponentName>.svg
  • When scanning multiple files, all generated files are written to the selected output directory.
  • Logs each generated file and component name.
  • Skips non-convertible icons at the end with the component name and reason.

Examples

1) Convert one file to same folder

unsvgr example/components/icon.tsx

2) Convert one file to explicit folder

unsvgr example/components/icon.tsx example/components/svg

3) Convert one file using --output

unsvgr example/components/icon.tsx --output example/components/svg

4) Scan a directory recursively for files containing <Svg>

unsvgr example/components

5) Omit input and use default scan folder

unsvgr

6) Omit input and provide custom scan folder

unsvgr --input example/components

7) Use nano-safe mode

unsvgr example/components/icon.tsx example/components/svg --nano

Expression fallback resolution

The converter aggressively resolves static JSX fallback expressions before writing SVG attributes, including:

  • local constants (defaultColor)
  • imported object paths (Colors.dark.icon)
  • ||, ??, ternary fallback branches
  • static template/string/number expressions

If an expression cannot be resolved deterministically, that icon is skipped as non-convertible and reported after conversion.

Contributing

git clone <repo-url>
cd rnsvg-to-svg
bun install

Run tests

bun test

Develop against example app

cd example
bun install
bun run convert-svg

Common contribution workflow

  1. Add or update fixture icons in example/components.
  2. Run bun run convert-svg in example.
  3. Add/update tests in index.test.ts.
  4. Run bun test at repo root.