Comparing version 1.2.0 to 1.2.1
@@ -99,3 +99,3 @@ /* | ||
var replaceIncludes = function (fileType, returnType) { | ||
var replaceIncludes = function (file, fileType, returnType) { | ||
/** | ||
@@ -127,10 +127,13 @@ * Callback function after matching our regex from the source file. | ||
dependencies. | ||
map(function (path) { | ||
return path.replace(/\\/g, '/').replace(ignorePath, ''); | ||
map(function (filePath) { | ||
return path.join( | ||
path.relative(path.dirname(file), path.dirname(filePath)), | ||
path.basename(filePath) | ||
).replace(/\\/g, '/').replace(ignorePath, ''); | ||
}). | ||
filter(function (path) { | ||
return filesCaught.indexOf(path) === -1; | ||
filter(function (filePath) { | ||
return filesCaught.indexOf(filePath) === -1; | ||
}). | ||
forEach(function (path) { | ||
newFileContents += spacing + fileType.replace[blockType].replace('{{filePath}}', path); | ||
forEach(function (filePath) { | ||
newFileContents += spacing + fileType.replace[blockType].replace('{{filePath}}', filePath); | ||
}); | ||
@@ -147,13 +150,13 @@ | ||
* | ||
* @param {string} file path to the source file | ||
* @param {string} filePath path to the source file | ||
*/ | ||
var injectScripts = function (file) { | ||
var contents = String(fs.readFileSync(file)); | ||
var fileExt = path.extname(file).substr(1); | ||
var injectScripts = function (filePath) { | ||
var contents = String(fs.readFileSync(filePath)); | ||
var fileExt = path.extname(filePath).substr(1); | ||
var fileType = fileTypes[fileExt] || fileTypes['default']; | ||
var returnType = /\r\n/.test(contents) ? '\r\n' : '\n'; | ||
fs.writeFileSync(file, contents.replace( | ||
fs.writeFileSync(filePath, contents.replace( | ||
fileType.block, | ||
replaceIncludes(fileType, returnType) | ||
replaceIncludes(filePath, fileType, returnType) | ||
)); | ||
@@ -163,3 +166,3 @@ }; | ||
var injectScriptsStream = function (contents, fileExt) { | ||
var injectScriptsStream = function (filePath, contents, fileExt) { | ||
var returnType = /\r\n/.test(contents) ? '\r\n' : '\n'; | ||
@@ -170,3 +173,3 @@ var fileType = fileTypes[fileExt] || fileTypes['default']; | ||
fileType.block, | ||
replaceIncludes(fileType, returnType) | ||
replaceIncludes(filePath, fileType, returnType) | ||
); | ||
@@ -203,3 +206,3 @@ }; | ||
config.set('stream', { | ||
src: injectScriptsStream(stream.src, stream.fileType), | ||
src: injectScriptsStream(stream.path, stream.src, stream.fileType), | ||
fileType: stream.fileType | ||
@@ -206,0 +209,0 @@ }); |
{ | ||
"name": "wiredep", | ||
"main": "./wiredep.js", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Wire Bower dependencies to your source code.", | ||
@@ -6,0 +6,0 @@ "repository": "stephenplusplus/wiredep", |
@@ -72,2 +72,3 @@ /* | ||
src: file.contents.toString(), | ||
path: file.path, | ||
fileType: path.extname(file.path).substr(1) | ||
@@ -74,0 +75,0 @@ }; |
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
24355
597