azu / azu/multi-stage-sourcemap

File property is being left out of the resulting rawSourceMap

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
patch welcome
Dominant language
JavaScript
Stars
108
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Hey, not sure if this is an issue of the multi-stage-sourcemap package but so far I have traced it, it looks like the issue of this package so here's the thing:

I'm using gulp-stylus v2.0.0 with autoprefixer-stylus 0.5.0 and trying to generate inline source maps using gulp-sourcemaps v1.3.0 on Windows 7 x64, node.js v0.10.36 as follows:

```
gulp.src('./src/styles/main.styl')
.pipe(plugins.sourcemaps.init())
.pipe(plugins.stylus({
compress: production,
use: [
autoprefixer({ browsers: ['last 2 versions'] })
]
}))
.pipe(plugins.sourcemaps.write())
.pipe(gulp.dest('./dist/styles/'))
```

But I'm getting the following error message:

```
Potentially unhandled rejection [2] Error: Source map to be applied is missing the "file" property
at assertProperty (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\vinyl-sourcemaps-apply\inde
x.js:32:13)
at applySourceMap (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\vinyl-sourcemaps-apply\inde
x.js:11:3)
at D:\Development\youcon-softphone\node_modules\gulp-stylus\index.js:39:13
at tryCatchReject (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\accord\node_modules\when\li
b\makePromise.js:845:30)
at runContinuation1 (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\accord\node_modules\when\
lib\makePromise.js:804:4)
at Fulfilled.when (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\accord\node_modules\when\li
b\makePromise.js:592:4)
at Pending.run (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\accord\node_modules\when\lib\m
akePromise.js:483:13)
at Scheduler._drain (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\accord\node_modules\when\
lib\Scheduler.js:62:19)
at Scheduler.drain (D:\Development\youcon-softphone\node_modules\gulp-stylus\node_modules\accord\node_modules\when\l
ib\Scheduler.js:27:9)
at process._tickCallback (node.js:442:13)
```

From what I understand [autoprefixer-stylus uses](https://github.com/jenius/autoprefixer-stylus/blob/71cc0fe75272f927924a3fa9ed721064cd6c7e2a/index.js#L45) multi-stage-sourcemap and multi-stage-sourcemap causes rawSourceMap to lose "file" property because [it's not passed to a Generator object](https://github.com/azu/multi-stage-sourcemap/blob/b85453680a18614c6ccb2caa8c89172c7a43d542/lib/multi-stage-sourcemap.js#L17) and it seems that the Generator object of source-map package [doesn't add this automatically](https://github.com/mozilla/source-map/blob/0314b55e6cad0a3462070123bfdb2dffc05a83e9/lib/source-map/source-map-generator.js#L29). After reading the readme file of this project it seems that this is an unexpected behaviour because in the example [there's a file property](https://github.com/azu/multi-stage-sourcemap/blob/b85453680a18614c6ccb2caa8c89172c7a43d542/README.md#transfer).

File property is [required by vinyl-sourcemaps-apply](https://github.com/floridoo/vinyl-sourcemaps-apply/blob/0977aaf2f4ba7aafb881b52612ddec0ac2cc18b1/index.js#L11) package which is a dependency of the gulp-stylus package.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.