Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let rebundle = () => {
gutil.log('Rebundling "%s"...', gutil.colors.cyan(bundleFile));
return bundler.bundle()
.pipe(exorcist(bundleMapFile))
.pipe(source(bundleFile)) // streaming vinyl file object
.pipe(buffer()) // convert from streaming to buffered vinyl file object
.pipe(uglify(uglifyConfig.options))
.pipe(gulp.dest(appConfig.dest))
.pipe(gulpif(options.watch, livereload()))
.pipe(notify(() => {
gutil.log('Finished "%s" bundle.', gutil.colors.cyan(bundleFile));
}));
};
function bundle(){
return bundler
.bundle()
.on('error', function (err) {
console.error(`=====\n${err.toString()}\n====`);
this.emit('end');
})
.pipe(exorcist('app/js/eleven.js.map'))
.pipe(source('eleven.js'))
.pipe(buffer())
.pipe(ifElse(process.env.NODE_ENV === 'production', uglify))
.pipe(gulp.dest('app/js'));
}
function bundle(src, dest) {
const jsFile = path.basename(dest);
const destPath = path.dirname(dest);
const mapFile = `${dest}.map`;
bundler.add(src, bundle);
bundler.bundle()
.on('error', (error) => {
console.error('\nError: ', error, '\n');
bundler.emit('end');
})
.pipe(exorcist(mapFile))
.pipe(source(jsFile))
.pipe(buffer())
.pipe(ifElse(process.env.NODE_ENV === 'production', uglify))
.pipe(gulp.dest(destPath));
}
gulp.task('jsbundle', ['eslint'], () => {
return browserify({
paths: [ path.join(__dirname, config.app) ],
entries: config.js.entryFile,
debug: true
})
.transform(babelify)
.bundle().on('error', function(error){
gutil.log(gutil.colors.red('[Build Error]', error.message));
this.emit('end');
})
.pipe(exorcist(config.js.sourcemapFile))
.pipe(source(config.js.outputFile))
.pipe(buffer())
.pipe(gulp.dest(config.js.appOutputPath));
});
function bundle() {
gutil.log('Compiling JS...');
return bundler.bundle()
.on('error', (err) => {
gutil.log(err.message);
browserSync.notify('Browserify Error!');
this.emit('end');
})
.pipe(exorcist('public/js/bundle.js.map'))
.pipe(source('bundle.js'))
.pipe(gulp.dest('public/js'))
.pipe(browserSync.stream({once: true}));
}
fromString: true
})
fs.writeFileSync(file, newCode.code)
return
}
socketMessage({
type: 'refresh'
})
})
if (process.env.NODE_ENV === 'production' && CONFIG.prodSourceMaps) {
bundler.bundle((err) => {
if (err) cb(err)
})
.pipe(exorcist(path.resolve(CONFIG.outputDir, sourceMapFile)))
.pipe(stream)
.on('finish', () => cb())
} else {
bundler.bundle((err) => {
if (err) cb(err)
})
.pipe(stream)
.on('finish', () => cb())
}
}, { wait: 300 })
pipeline = pipeline.pipe(transform(() => {
return exorcist(path.join(config.scripts.destination, config.scripts.filename) + '.map');
}));
}