# vinyl-sourcemaps-apply

> Apply a source map to a vinyl file, merging it with preexisting source maps

Latest version **0.2.1** (published 2015-12-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install vinyl-sourcemaps-apply
pnpm add vinyl-sourcemaps-apply
yarn add vinyl-sourcemaps-apply
bun add vinyl-sourcemaps-apply
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2015-12-27 |
| First published | 2014-05-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Florian Reiterer |
| Maintainers | floridoo |
| Keywords | vinyl, sourcemaps, source maps, gulp |

## Links

- npm: https://www.npmjs.com/package/vinyl-sourcemaps-apply
- Repository: https://github.com/floridoo/vinyl-sourcemaps-apply
- Homepage: http://github.com/floridoo/vinyl-sourcemaps-apply
- Issues: https://github.com/floridoo/vinyl-sourcemaps-apply/issues
- npm.io page: https://npm.io/package/vinyl-sourcemaps-apply

## Dependencies (1)

- [source-map](https://npm.io/package/source-map.md) ^0.5.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2015-12-27
- 0.2.0 — 2015-09-27
- 0.1.4 — 2014-09-25
- 0.1.3 — 2014-09-19
- 0.1.2 — 2014-09-19
- 0.1.1 — 2014-05-11
- 0.1.0 — 2014-05-11

## README

# vinyl-sourcemaps-apply

Apply a source map to a vinyl file, merging it with preexisting source maps.

## Usage:

```javascript
var applySourceMap = require('vinyl-sourcemaps-apply');
applySourceMap(vinylFile, sourceMap);
```

### Example (Gulp plugin):

```javascript
var through = require('through2');
var applySourceMap = require('vinyl-sourcemaps-apply');
var myTransform = require('myTransform');

module.exports = function(options) {

  function transform(file, encoding, callback) {
    // generate source maps if plugin source-map present
    if (file.sourceMap) {
      options.makeSourceMaps = true;
    }

    // do normal plugin logic
    var result = myTransform(file.contents, options);
    file.contents = new Buffer(result.code);

    // apply source map to the chain
    if (file.sourceMap) {
      applySourceMap(file, result.map);
    }

    this.push(file);
    callback();
  }

  return through.obj(transform);
};
```

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