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

@rolldown/plugin-jsx-remove-attributes

v0.1.1

Published

Rolldown plugin to remove JSX attributes (e.g. data-testid)

Readme

@rolldown/plugin-jsx-remove-attributes npm

Rolldown plugin to remove JSX attributes (e.g. data-testid).

This plugin is similar to babel-plugin-react-remove-properties but uses Rolldown's native AST parser and native magic string API instead of Babel, making it faster and requiring no additional dependencies.

Install

pnpm add -D @rolldown/plugin-jsx-remove-attributes

Usage

import jsxRemoveAttributes from '@rolldown/plugin-jsx-remove-attributes'

export default {
  plugins: [
    jsxRemoveAttributes({
      // options
    }),
  ],
}

Example

In

export default function Home() {
  return (
    <div data-test-id="1" data-custom="1a">
      <div data-custom="2">
        <h1 data-testid="3">Hello World!</h1>
      </div>
    </div>
  )
}

Out (with default options)

export default function Home() {
  return (
    <div data-custom="1a">
      <div data-custom="2">
        <h1>Hello World!</h1>
      </div>
    </div>
  )
}

Attributes matching /^data-test/ (data-test-id and data-testid) are removed, while data-custom is preserved.

Options

attributes

  • Type: Array<string | RegExp>
  • Default: [/^data-test/]

Patterns to match JSX attribute names to remove. Strings are exact matches.

jsxRemoveAttributes({
  attributes: [/^data-test/, 'data-custom'],
})

Benchmark

Results of the benchmark that can be run by pnpm bench in ./benchmark directory:

  name                                         hz      min     max     mean      p75     p99    p995    p999     rme  samples
· @rolldown/plugin-jsx-remove-attributes  12.9805  72.0620  107.49  77.0388  74.7614  107.49  107.49  107.49  ±9.99%       10
· @rolldown/plugin-babel                   5.1662   183.08  223.91   193.56   197.79  223.91  223.91  223.91  ±5.22%       10
· @rollup/plugin-swc                      11.3756  82.0540  111.68  87.9076  87.6005  111.68  111.68  111.68  ±6.98%       10

@rolldown/plugin-jsx-remove-attributes - bench/jsx-remove-attributes.bench.ts > JSX Remove Attributes Benchmark
  1.14x faster than @rollup/plugin-swc
  2.51x faster than @rolldown/plugin-babel

The benchmark was ran on the following environment:

OS: macOS Tahoe 26.3
CPU: Apple M4
Memory: LPDDR5X-7500 32GB

License

MIT

Credits

The implementation is based on swc-project/plugins/packages/react-remove-properties (Apache License 2.0). Test cases are also adapted from it.