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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@builder.io/nextjs-plugin-jsx-loc

v0.1.4

Published

Next.js plugin that adds location data attributes to JSX elements for debugging

Readme

nextjs-plugin-jsx-loc

A Next.js plugin that adds location data attributes to JSX elements for debugging and development purposes.

Installation

npm install @builder.io/nextjs-plugin-jsx-loc
# or
yarn add @builder.io/nextjs-plugin-jsx-loc
# or
pnpm add @builder.io/nextjs-plugin-jsx-loc

Usage with Next.js

Add the plugin to your next.config.js:

const { withJsxLoc } = require('@builder.io/nextjs-plugin-jsx-loc');

/** @type {import('next').NextConfig} */
const nextConfig = {};

module.exports = withJsxLoc({
  // Optional: specify custom include/exclude patterns
  // include: [/src\/components/],
  // exclude: [/node_modules/, /test/]
}, nextConfig);

Or with TypeScript (next.config.mjs):

import { withJsxLoc } from '@builder.io/nextjs-plugin-jsx-loc';

/** @type {import('next').NextConfig} */
const nextConfig = {};

export default withJsxLoc({
  // Optional configuration
}, nextConfig);

Turbopack Support

This plugin works with both webpack (default) and Turbopack in Next.js applications. When you use the plugin with Turbopack, it automatically configures the necessary loaders through the turbopack.rules configuration.

To use with Turbopack in development:

# After adding the plugin to next.config.js
next dev --turbo

For production builds with Turbopack (experimental):

# Requires Next.js 15.3.0+
next build --turbo

Usage with Turborepo

For a Turborepo setup, make sure each Next.js app in your monorepo includes the plugin in its Next.js configuration.

// apps/web/next.config.js
const { withJsxLoc } = require('@builder.io/nextjs-plugin-jsx-loc');

/** @type {import('next').NextConfig} */
const nextConfig = {};

module.exports = withJsxLoc({}, nextConfig);

How It Works

The plugin adds a data-loc attribute to JSX elements that contains the relative file path and line number:

// Input: src/components/Button.tsx
export function Button() {
  return <button>Click me</button>;
}

// Output (during development):
export function Button() {
  return <button data-loc="src/components/Button.tsx:2">Click me</button>;
}

This allows you to identify where components are defined when inspecting the DOM.

Features

  • Adds source location information to JSX elements
  • Works with both .jsx and .tsx files
  • Skips processing of node_modules
  • Preserves source maps
  • Compatible with Next.js 12+ including Turbopack
  • Compatible with Turborepo monorepo setups
  • No configuration required

Options

  • include: RegExp or array of RegExp patterns to include specific files (optional)
  • exclude: RegExp or array of RegExp patterns to exclude specific files (optional, defaults to /node_modules/)

License

MIT