gulp-react
Advanced tools
Comparing version 1.0.0 to 1.0.1
23
index.js
@@ -6,2 +6,3 @@ 'use strict'; | ||
var react = require('react-tools'); | ||
var reactDomPragma = require('react-dom-pragma'); | ||
@@ -11,4 +12,3 @@ module.exports = function (options) { | ||
if (file.isNull()) { | ||
this.push(file); | ||
cb(); | ||
cb(null, file); | ||
return; | ||
@@ -18,4 +18,3 @@ } | ||
if (file.isStream()) { | ||
this.emit('error', new gutil.PluginError('gulp-react', 'Streaming not supported')); | ||
cb(); | ||
cb(new gutil.PluginError('gulp-react', 'Streaming not supported')); | ||
return; | ||
@@ -26,9 +25,5 @@ } | ||
var filePath = file.path; | ||
// http://stackoverflow.com/a/15123777 | ||
var JS_COMMENTS_REGEX = /(?:\/\*(?:[\s\S]*?)\*\/)|(?:\/\/(?:.*)$)/gm; | ||
var commentMatches = str.match(JS_COMMENTS_REGEX); | ||
var hasJsxComment = commentMatches && (commentMatches[0].indexOf('/**') !== -1 && commentMatches[0].indexOf('@jsx') !== -1); | ||
if (path.extname(filePath) === '.jsx' && !hasJsxComment) { | ||
str = '/** @jsx React.DOM */\n' + str; | ||
if (path.extname(filePath) === '.jsx') { | ||
str = reactDomPragma(str); | ||
} | ||
@@ -39,9 +34,9 @@ | ||
file.path = gutil.replaceExtension(filePath, '.js'); | ||
this.push(file); | ||
cb(null, file); | ||
} catch (err) { | ||
this.emit('error', new gutil.PluginError('gulp-react', err, {fileName: filePath})); | ||
cb(new gutil.PluginError('gulp-react', err, { | ||
fileName: filePath | ||
})); | ||
} | ||
cb(); | ||
}); | ||
}; |
{ | ||
"name": "gulp-react", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Precompile Facebook React JSX templates into JavaScript", | ||
@@ -36,2 +36,3 @@ "license": "MIT", | ||
"gulp-util": "^3.0.0", | ||
"react-dom-pragma": "^1.0.0", | ||
"react-tools": "^0.11.1", | ||
@@ -38,0 +39,0 @@ "through2": "^0.6.1" |
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
2640
4
32
+ Addedreact-dom-pragma@^1.0.0
+ Addedcomment-regex@1.0.1(transitive)
+ Addedhas-jsx-pragma@1.0.0(transitive)
+ Addedreact-dom-pragma@1.0.0(transitive)