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

swc-plugin-react-source

v0.1.1

Published

SWC plugin for add source attribute to dom nodes

Readme

Плагин для swc, аналогичный babel-plugin-react-source

Что плагин делает?

Добавляет проп "source" для блоковских компонентов и "data-source" для html-тегов и компонентов из настраиваемого списка библиотек
В папке tests/fixtures есть input и output

Как прогнать тесты?

  1. Настроить среду разработки (установить Rust, swc_cli, *rust-analyzer для vscode)
  2. Запустить в корне проекта cargo test
  3. * Команда UPDATE=1 cargo test обновляет снапшоты

Как подключить этот плагин к сборке реального проекта для тестирования?

  1. Ваш проект должен использовать builtin:swc-loader

Вариант 1 - простой

  1. Собираем плагин командой cargo build --target wasm32-wasi --release (в корне плагина)

  2. Создаем ссылку yarn link (в корне плагина)

  3. Подключить плагин в нужном проекте yarn link swc-plugin-react-source (в папке с твоим проектом)

  4. В options для builtin:swc-loader в rspack.config проекта нужно добавить плагин

{
  "jsc": {
    "experimental": {
      "plugins": [
        ['swc-plugin-react-source', {}]
      ]
    }
  }
}
  1. Собрать проект с подключенным пакетом yarn build

  2. Посмотреть на собранный код проекта. Там будут source и data-source, если все подключилось правильно

  3. * После внесения изменений в код плагина можно снова его собрать (пункт 1). Твой проект, куда прилинкован пакет с плагином, будет всегда использовать последнюю собранную версию

Вариант 2 - для xhh на стенде

  1. Собираем плагин командой cargo build --target wasm32-wasi --release (в корне плагина)

  2. Собираем в пакет yarn pack (в корне плагина), появляется файл .tgz. Этот файлик надо положить на стенд, если хочешь подключить плагин к сборке на стенде.

  3. В проекте, куда хотим установить плагин, запускаем yarn add /<абсолютный_путь_до_пакета>/swc-plugin-react-source<версия>.tgz

  4. Дальше всё как в Варианте 1, смотри пункт 4

Что тут внутри?

src/lib.rs - основной файл
src/utils.rs - вспомогательные функции
tests/test.rs - юнит-тесты плагина
tests/fixtures - файлики с js исходниками, которые используются для тестирования плагина

Как настроить плагин?

В options можно передать объект со списком libraries
Если передать пустой объект, то по умолчанию плагин подставит туда ['magritte']

['swc-plugin-react-source', {
    libraries: ['magritte', 'another_one']
}]

✨ Желаю тебе попутного ветра в паруса ✨