Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-preprocess-file

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-preprocess-file - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

4

.eslintrc.js

@@ -23,8 +23,4 @@ module.exports = {

"single"
],
"semi": [
"error",
"always"
]
}
};

64

lib/index.js

@@ -1,47 +0,47 @@

const through = require('through2');
const through = require('through2')
const path = require('path')
const gutil = require('gulp-util');
const PluginError = gutil.PluginError;
const PluginError = require('plugin-error')
const _ = require('lodash')
const pp = require('preprocess');
const pp = require('preprocess')
const PLUGIN_NAME = 'gulp-preprocess-file';
const PLUGIN_NAME = 'gulp-preprocess-file'
function gulpPreprocessFile(context, options) {
context = _.merge({
NODE_ENV: 'development'
}, process.env, context)
context = _.merge({
NODE_ENV: 'development'
// eslint-disable-next-line no-undef
}, process.env, context)
// create stream
// function(file, encoding, callback)
var stream = through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file)
return cb();
}
// create stream
// function(file, encoding, callback)
var stream = through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file)
return cb()
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
return cb();
}
if (file.isStream()) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'))
return cb()
}
context.srcDir = context.srcDir || path.dirname(file.path)
options = _.isEmpty(options) ? getFileType(file.path) : options
context.srcDir = context.srcDir || path.dirname(file.path)
options = _.isEmpty(options) ? getFileType(file.path) : options
if (file.isBuffer()) {
var content = pp.preprocess(file.contents.toString(), context, options)
file.contents = new Buffer(content)
}
if (file.isBuffer()) {
var content = pp.preprocess(file.contents.toString(), context, options)
file.contents = new Buffer(content)
}
this.push(file);
cb();
});
this.push(file)
cb()
})
return stream;
};
return stream
}
function getFileType(file) {
return path.extname(file).split('.').pop() || ''
return path.extname(file).split('.').pop() || ''
}
module.exports = gulpPreprocessFile;
module.exports = gulpPreprocessFile
{
"name": "gulp-preprocess-file",
"version": "2.0.1",
"version": "2.1.0",
"description": "A Gulp plugin for Preprocess files based off environment configuration. Based on Preprocess package",

@@ -26,6 +26,5 @@ "main": "lib/index.js",

"homepage": "https://github.com/mengqing723/gulp-preprocess-file#readme",
"devDependencies": {},
"dependencies": {
"gulp-util": "^3.0.8",
"lodash": "^4.17.10",
"plugin-error": "^1.0.1",
"preprocess": "^3.1.0",

@@ -32,0 +31,0 @@ "through2": "^2.0.3"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc