# babel-plugin-jsx-owner

> adds parent component information to every child

Latest version **0.12.1** (published 2023-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-jsx-owner
pnpm add babel-plugin-jsx-owner
yarn add babel-plugin-jsx-owner
bun add babel-plugin-jsx-owner
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.1 |
| Published | 2023-02-08 |
| First published | 2020-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mikhail Shemenyov |
| Maintainers | saunterer |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-jsx-owner
- Repository: git@github.com:lffate/babel-plugin-jsx-owner
- npm.io page: https://npm.io/package/babel-plugin-jsx-owner

## Recent versions

- 0.12.1 (latest) — 2023-02-08
- 0.11.1 — 2021-07-12
- 0.10.1 — 2021-06-16
- 0.9.3 — 2021-05-24
- 0.9.2 — 2020-06-05
- 0.9.1 — 2020-06-05
- 0.9.0 — 2020-06-05

## README

Adds `__source` to every JSX element with next data: 

```
{
    name: string,
    parentProps: any
}
```

It allows you to handle children's parent component with name* and props

* name - not actually component's name (function or class), this is a file name with path. For example: `product/grid-list/ProductGridList` 
* works only if component placed at `src/components` path. to override this, use paths to specify component directories

Feel free to fork and change this settings.

There is probability of some issues due to `__source` is reserved react property.
But you can override it by plugin option (Make sure to prevent it to be passed to a real DOM): 
```
// .babelrc
{
  "presets": [
      ...
  ],
  "plugins": [
    [
      "babel-plugin-jsx-owner",
      {
        "traceId": "__source",
        /* paths where your components placed */
        "paths": ["src/components"],
        /* paths to ignore */
        "ignorePaths": ["renderSubscriber"],
        /* add prefix to all component names */
        "prefix": "sd-common-products",
      }
    ]
  ]
}

```

```sh
npm install -D babel-plugin-jsx-owner
```

```sh
yarn add -D babel-plugin-jsx-owner
```

---
_Source: https://npm.io/package/babel-plugin-jsx-owner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
