# source-mapper

> Replace strack traces with original sources using source maps

Latest version **2.1.0** (published 2018-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install source-mapper
pnpm add source-mapper
yarn add source-mapper
bun add source-mapper
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2018-08-09 |
| First published | 2014-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 3 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Maximilian Antoni |
| Maintainers | mantoni |
| Keywords | stack, trace, source-maps |

## Links

- npm: https://www.npmjs.com/package/source-mapper
- Repository: https://github.com/mantoni/source-mapper.js
- Issues: https://github.com/mantoni/source-mapper.js/issues
- npm.io page: https://npm.io/package/source-mapper

## Dependencies (3)

- [through2](https://npm.io/package/through2.md) ^2.0.0
- [source-map](https://npm.io/package/source-map.md) ~0.5.3
- [convert-source-map](https://npm.io/package/convert-source-map.md) ^1.1.3

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2018-08-09
- 2.0.0 — 2016-01-19
- 1.0.6 — 2016-01-12
- 1.0.5 — 2015-09-05
- 1.0.4 — 2015-06-24
- 1.0.3 — 2015-03-26
- 1.0.2 — 2015-03-22
- 1.0.1 — 2014-09-12
- 1.0.0 — 2014-09-05
- 0.3.0 — 2014-09-01
- 0.2.1 — 2014-08-11
- 0.2.0 — 2014-07-25
- 0.1.0 — 2014-07-14

## README

# Source Mapper

[![Build Status]](https://travis-ci.org/mantoni/source-mapper.js)
[![SemVer]](http://semver.org)
[![License]](https://github.com/mantoni/source-mapper.js/blob/master/LICENSE)

Replace stack traces with original sources using [source-map][]. For node and
the browser.

## Install

```
npm install source-mapper
```

## Usage

```js
var sourceMapper = require('source-mapper');

var extracted = sourceMapper.extract(js);
var throughStream = sourceMapper.stream(extracted.map);
```

## API

- `extract(string)` extracts an inline source map from the given string. The
  returned object has the `js` without source maps and a `map` with source
  maps.
- `consumer(map)` returns a source map consumer for the given `map`.
- `line(consumer, line[, offset])` maps the given line to the original source
  using a consumer. If `offset` is given, it is substracted from the line
  number.
- `stream(consumer[, offset])` returns a [through2][] stream that replaces URLs
  in stack traces with the original source location using a consumer. If
  `offset` is given, it is substracted from the line number.
- `stream(map[, offset])` returns a [through2][] stream that replaces URLs in
  stack traces with the original source location using a source map. If
  `offset` is given, it is substracted from the line number.

## Development

Clone the repository and then run:

```
npm install
npm test
```

## Compatibility

- Node 0.10 or later
- Browserify 5.9 or later

## License

MIT

[Build Status]: https://img.shields.io/travis/mantoni/source-mapper.js.svg
[SemVer]: https://img.shields.io/:semver-%E2%9C%93-brightgreen.svg
[License]: https://img.shields.io/npm/l/source-mapper.svg
[source-map]: https://github.com/mozilla/source-map
[through2]: https://github.com/rvagg/through2

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