https://github.com/github/babel-plugin-transform-invariant-location
Babel plugin that rewrites invariant calls with their source location
https://github.com/github/babel-plugin-transform-invariant-location
babel-plugin flow
Last synced: 5 months ago
JSON representation
Babel plugin that rewrites invariant calls with their source location
- Host: GitHub
- URL: https://github.com/github/babel-plugin-transform-invariant-location
- Owner: github
- License: mit
- Archived: true
- Created: 2017-07-21T19:53:37.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2020-08-03T15:40:45.000Z (over 5 years ago)
- Last Synced: 2024-09-30T00:20:33.743Z (over 1 year ago)
- Topics: babel-plugin, flow
- Language: JavaScript
- Size: 3.91 KB
- Stars: 13
- Watchers: 6
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# transform-invariant-location
A Babel plugin to annotate [Flow `invariant()` calls](https://github.com/zertosh/invariant) with an additional string argument detailing the current file and line number. This is useful to track down exceptions that are raised by `invariant()` in minified bundles at runtime.
Before:
```js
invariant(foo)
invariant(foo, "foo is missing")
```
After:
```js
invariant(foo, "path/to/source.js:42")
invariant(foo, "foo is missing -- path/to/source.js:42")
```