gulp-traceur
Advanced tools
Comparing version 0.13.0 to 0.14.0
45
index.js
'use strict'; | ||
var gutil = require('gulp-util'); | ||
var through = require('through2'); | ||
var traceur = require('traceur'); | ||
var applySourceMap = require('vinyl-sourcemaps-apply'); | ||
var objectAssign = require('object-assign'); | ||
var traceur = require('traceur'); | ||
module.exports = function (options) { | ||
options = options || {}; | ||
module.exports = function (opts) { | ||
opts = opts || {}; | ||
return through.obj(function (file, enc, cb) { | ||
if (file.isNull()) { | ||
this.push(file); | ||
cb(); | ||
cb(null, file); | ||
return; | ||
@@ -19,12 +18,8 @@ } | ||
if (file.isStream()) { | ||
this.emit('error', new gutil.PluginError('gulp-traceur', 'Streaming not supported')); | ||
cb(); | ||
cb(new gutil.PluginError('gulp-traceur', 'Streaming not supported')); | ||
return; | ||
} | ||
var ret; | ||
var fileOptions = objectAssign({modules: 'commonjs'}, opts); | ||
var fileOptions = objectAssign({}, options); | ||
fileOptions.filename = file.relative; | ||
if (file.sourceMap) { | ||
@@ -35,23 +30,19 @@ fileOptions.sourceMaps = true; | ||
try { | ||
ret = traceur.compile(file.contents.toString(), fileOptions); | ||
var compiler = new traceur.NodeCompiler(fileOptions); | ||
var ret = compiler.compile(file.contents.toString(), file.relative, file.relative, file.base); | ||
var generatedSourceMap = compiler.getSourceMap(); | ||
if (ret.js) { | ||
file.contents = new Buffer(ret.js); | ||
if (ret) { | ||
file.contents = new Buffer(ret); | ||
} | ||
if (ret.generatedSourceMap && file.sourceMap) { | ||
applySourceMap(file, ret.generatedSourceMap); | ||
if (generatedSourceMap && file.sourceMap) { | ||
applySourceMap(file, generatedSourceMap); | ||
} | ||
if (ret.errors.length > 0) { | ||
this.emit('error', new gutil.PluginError('gulp-traceur', '\n' + ret.errors.join('\n'), { | ||
fileName: file.path, | ||
showStack: false | ||
})); | ||
} else { | ||
this.push(file); | ||
} | ||
} catch (err) { | ||
this.emit('error', new gutil.PluginError('gulp-traceur', err, { | ||
fileName: file.path | ||
this.push(file); | ||
} catch (errs) { | ||
this.emit('error', new gutil.PluginError('gulp-traceur', errs.join('\n'), { | ||
fileName: file.path, | ||
showStack: false | ||
})); | ||
@@ -58,0 +49,0 @@ } |
{ | ||
"name": "gulp-traceur", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "Traceur is a JavaScript.next to JavaScript-of-today compiler", | ||
@@ -43,8 +43,9 @@ "license": "MIT", | ||
"through2": "^0.6.1", | ||
"traceur": "0.0.58", | ||
"traceur": "0.0.74", | ||
"vinyl-sourcemaps-apply": "^0.1.1" | ||
}, | ||
"devDependencies": { | ||
"gulp-sourcemaps": "^1.2.8", | ||
"mocha": "*" | ||
} | ||
} |
@@ -23,3 +23,3 @@ # [gulp](http://gulpjs.com)-traceur [![Build Status](https://travis-ci.org/sindresorhus/gulp-traceur.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-traceur) | ||
return gulp.src('src/app.js') | ||
.pipe(traceur({sourceMap: true})) | ||
.pipe(traceur()) | ||
.pipe(gulp.dest('dist')); | ||
@@ -26,0 +26,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4054
2
42
+ Addedast-types@0.5.7(transitive)
+ Addedcls@0.1.5(transitive)
+ Addeddepd@1.0.1(transitive)
+ Addedesprima-fb@7001.1.0-dev-harmony-fb(transitive)
+ Addedjsesc@0.5.0(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedrecast@0.8.8(transitive)
+ Addedregenerate@1.4.2(transitive)
+ Addedregexpu@0.3.0(transitive)
+ Addedregjsgen@0.2.0(transitive)
+ Addedregjsparser@0.1.5(transitive)
+ Addedrsvp@3.6.2(transitive)
+ Addedsource-map@0.1.32(transitive)
+ Addedsource-map-support@0.2.10(transitive)
+ Addedtraceur@0.0.74(transitive)
- Removedtraceur@0.0.58(transitive)
Updatedtraceur@0.0.74