gulp-file-include
Advanced tools
Comparing version 0.13.4 to 0.13.5
@@ -0,0 +0,0 @@ module.exports = function(src, index, dest) { |
'use strict'; | ||
var replaceConditional = require('./conditional'); | ||
var replaceVariable = require('./variable'); | ||
var replaceInclude = require('./include'); | ||
var replaceOperator = require('./replace-operator'); | ||
var replaceFunction = require('./replace-function'); | ||
var replaceVariable = require('./replace-variable'); | ||
var concat = require('concat-stream'); | ||
@@ -73,22 +73,26 @@ var setIndent = require('./indent'); | ||
text = stripCommentedIncludes(text, opts); | ||
text = replaceConditional({ | ||
handler: conditionalHandler, | ||
content: text | ||
}, opts); | ||
text = replaceInclude({ | ||
handler: includeHandler, | ||
content: text | ||
}, opts); | ||
text = replaceOperator(text, { | ||
prefix: opts.prefix, | ||
suffix: opts.suffix, | ||
name: 'if', | ||
handler: conditionalHandler | ||
}); | ||
text = replaceFunction(text, { | ||
prefix: opts.prefix, | ||
suffix: opts.suffix, | ||
name: 'include', | ||
handler: includeHandler | ||
}); | ||
text = replaceVariable(text, data, opts); | ||
function conditionalHandler(args, body) { | ||
function conditionalHandler(inst) { | ||
// jshint ignore: start | ||
var condition = new Function('var context = this; with (context) { return ' + args + '; }').call(data); | ||
var condition = new Function('var context = this; with (context) { return ' + inst.args + '; }').call(data); | ||
// jshint ignore: end | ||
return condition ? body : ''; | ||
return condition ? inst.body : ''; | ||
} | ||
function includeHandler(args, before) { | ||
var args = /[^)"\']*["\']([^"\']*)["\'](,\s*({[\s\S]*?})){0,1}\s*/.exec(args); | ||
function includeHandler(inst) { | ||
var args = /[^)"\']*["\']([^"\']*)["\'](,\s*({[\s\S]*?})){0,1}\s*/.exec(inst.args); | ||
@@ -105,3 +109,3 @@ if(args) { | ||
if (opts.indent) { | ||
includeContent = setIndent(before, before.length, includeContent); | ||
includeContent = setIndent(inst.before, inst.before.length, includeContent); | ||
} | ||
@@ -108,0 +112,0 @@ |
{ | ||
"name": "gulp-file-include", | ||
"version": "0.13.4", | ||
"version": "0.13.5", | ||
"description": "a gulp plugin for file include", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -0,0 +0,0 @@ [![NPM version][npm-img]][npm-url] |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
13463
240