@@ -2,7 +2,7 @@ var gutil = require('gulp-util'),
22 requirejs = require ( 'requirejs' ) ,
33 PluginError = gutil . PluginError ,
44 File = gutil . File ,
5- es = require ( 'event-stream' ) ;
5+ es = require ( 'event-stream' )
66
77// Consts
88const PLUGIN_NAME = 'gulp-requirejs' ;
@@ -13,15 +13,15 @@ module.exports = function(opts) {
1313 'use strict' ;
1414
1515 if ( ! opts ) {
16- throw PluginError ( PLUGIN_NAME , 'Missing options array!' ) ;
16+ throw new PluginError ( PLUGIN_NAME , 'Missing options array!' ) ;
1717 }
1818
1919 if ( ! opts . out && typeof opts . out !== 'string' ) {
20- throw PluginError ( PLUGIN_NAME , 'Only single file outputs are supported right now, please pass a valid output file name!' ) ;
20+ throw new PluginError ( PLUGIN_NAME , 'Only single file outputs are supported right now, please pass a valid output file name!' ) ;
2121 }
2222
2323 if ( ! opts . baseUrl ) {
24- throw PluginError ( PLUGIN_NAME , 'Piping dirs/files is not supported right now, please specify the base path for your script.' ) ;
24+ throw new PluginError ( PLUGIN_NAME , 'Pipeing dirs/files is not supported right now, please specify the base path for your script.' ) ;
2525 }
2626
2727 // create the stream and save the file name (opts.out will be replaced by a callback function later)
@@ -30,12 +30,19 @@ module.exports = function(opts) {
3030
3131 // just a small wrapper around the r.js optimizer, we write a new gutil.File (vinyl) to the Stream, mocking a file, which can be handled
3232 // regular gulp plugins (i hope...).
33- optimize ( opts , function ( text ) {
34- _s . write ( new File ( {
35- path : _fName ,
36- contents : new Buffer ( text )
37- } ) ) ;
38- } ) ;
33+
34+ // try {
35+ optimize ( opts , function ( text ) {
36+ _s . write ( new File ( {
37+ path : _fName ,
38+ contents : new Buffer ( text )
39+ } ) ) ;
40+ } ) ;
41+ // } catch (err) {
42+ // _s.emit('error', err);
43+ // }
44+
45+
3946
4047 // return the stream for chain .pipe()ing
4148 return _s ;
0 commit comments