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

@amplitude/babel-plugin-autocapture-transformer

v0.1.1

Published

Babel plugin that transforms JSX for Amplitude autocapture at compile time.

Downloads

7,837

Readme

@amplitude/babel-plugin-autocapture-transformer

A Babel plugin that wraps React Native interaction handlers with Amplitude's ampCapture helper at compile time, so element clicks and other UI events can be autocaptured without changing your source JSX by hand.

Install

npm install --save-dev @amplitude/babel-plugin-autocapture-transformer

This plugin expects @amplitude/analytics-react-native to be installed in your app (it auto-imports ampCapture from that package).

Example

In

function HomeScreen() {
  return (
    <Button
      accessibilityLabel="Online test label"
      testID="12345"
      title="Online test"
      onPress={func}
    />
  );
}

Out

import { ampCapture } from '@amplitude/analytics-react-native';

function HomeScreen() {
  return (
    <Button
      accessibilityLabel="Online test label"
      testID="12345"
      title="Online test"
      onPress={ampCapture(func, {
        action: 'Press',
        accessibilityLabel: 'Online test label',
        testID: '12345',
        element: 'Button',
        component: 'HomeScreen',
      })}
    />
  );
}

When a file already imports from @amplitude/analytics-react-native, the plugin adds ampCapture to that import instead of inserting a second one.

Usage

.babelrc / babel.config.json

{
  "plugins": ["@amplitude/babel-plugin-autocapture-transformer"]
}

babel.config.js (Expo / React Native)

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: ['@amplitude/babel-plugin-autocapture-transformer'],
  };
};

With options

{
  "plugins": [
    [
      "@amplitude/babel-plugin-autocapture-transformer",
      {
        "pressableElements": ["CustomButton"],
        "valueChangeElements": ["Toggle"],
        "textChangeElements": ["SearchField"]
      }
    ]
  ]
}

What gets transformed

The plugin only rewrites known interactive JSX elements that already have an expression handler (for example onPress={handler}). String handlers and elements without handlers are left alone.

| Category | Default elements | Attributes → action | | --- | --- | --- | | Pressable | Button, TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, Pressable, Touchable, TouchableNativeFeedback, Link | onPress → Press, onLongPress → LongPress | | Value change | Switch, Slider, Picker | onValueChange → ValueChange | | Text change | TextInput | onChangeText → ChangeText, onSubmitEditing → SubmitEditing |

If the element also has accessibilityLabel and/or testID, those values are copied into the ampCapture properties object. The plugin also adds:

  • element — the JSX tag name (for example Button)
  • component — the enclosing React component or function name when it can be resolved (for example HomeScreen)

Options

| Name | Type | Default | Description | | --- | --- | --- | --- | | pressableElements | string[] | [] | Additional JSX component names treated as pressable (onPress / onLongPress). Merged with the built-in defaults. | | valueChangeElements | string[] | [] | Additional JSX component names treated as value-change elements (onValueChange). Merged with the built-in defaults. | | textChangeElements | string[] | [] | Additional JSX component names treated as text-change elements (onChangeText / onSubmitEditing). Merged with the built-in defaults. |

Limitations

  • Only plain JSX identifiers are transformed (<Button />). Member expressions like <RN.Button /> are ignored and need to be included in the options array.
  • Custom components are not transformed unless you list them in the matching options array.
  • Spread attributes (for example {...props}) are not inspected for accessibilityLabel / testID; only attributes written directly on the element are collected.
  • component is omitted when the enclosing function is anonymous (for example export default () => …).

License

MIT