diff2html
Advanced tools
Comparing version 2.0.1 to 2.0.3
{ | ||
"name": "diff2html", | ||
"version": "2.0.1", | ||
"homepage": "http://rtfpessoa.github.io/diff2html/", | ||
"version": "2.0.3", | ||
"homepage": "https://diff2html.xyz", | ||
"description": "Fast Diff to colorized HTML", | ||
@@ -40,10 +40,11 @@ "keywords": [ | ||
"release": "./scripts/release.sh", | ||
"release-website": "node ./scripts/release-website.js", | ||
"release-bower": "./scripts/update-bower-version.sh", | ||
"templates": "./scripts/hulk.js --wrapper node --variable 'browserTemplates' ./src/templates/*.mustache > ./src/templates/diff2html-templates.js", | ||
"style": "eslint src/*.js src/ui/js/*.js", | ||
"style": "eslint .", | ||
"coverage": "istanbul cover _mocha -- -u exports -R spec ./test/**/*", | ||
"check-coverage": "istanbul check-coverage --statements 90 --functions 90 --branches 85 --lines 90 ./coverage/coverage.json", | ||
"test": "npm run coverage && npm run check-coverage", | ||
"codacy": "npm run coverage && cat ./coverage/lcov.info | codacy-coverage", | ||
"preversion": "npm run release && npm test", | ||
"codacy": "cat ./coverage/lcov.info | codacy-coverage", | ||
"preversion": "npm run release && npm run release-website && npm test", | ||
"version": "npm run release-bower && git add -A src dist package.json bower.json", | ||
@@ -57,17 +58,17 @@ "postversion": "git push && git push --tags" | ||
"dependencies": { | ||
"diff": "^2.2.3", | ||
"diff": "^3.0.0", | ||
"hogan.js": "^3.0.2" | ||
}, | ||
"devDependencies": { | ||
"autoprefixer": "^6.3.6", | ||
"browserify": "^13.0.1", | ||
"clean-css": "^3.4.18", | ||
"codacy-coverage": "^1.1.3", | ||
"eslint": "^3.0.1", | ||
"eslint-plugin-promise": "^1.3.2", | ||
"eslint-plugin-standard": "^1.3.2", | ||
"autoprefixer": "^6.4.0", | ||
"browserify": "^13.1.0", | ||
"clean-css": "^3.4.19", | ||
"codacy-coverage": "^2.0.0", | ||
"eslint": "^3.3.1", | ||
"eslint-plugin-promise": "^2.0.1", | ||
"eslint-plugin-standard": "^2.0.0", | ||
"fast-html-parser": "^1.0.1", | ||
"istanbul": "^0.4.4", | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^2.5.3", | ||
"mocha": "^3.0.2", | ||
"nopt": "^3.0.6", | ||
@@ -74,0 +75,0 @@ "postcss-cli": "^2.5.2", |
@@ -41,3 +41,3 @@ /* | ||
/* Add previous block(if exists) before start a new file */ | ||
var saveBlock = function() { | ||
function saveBlock() { | ||
if (currentBlock) { | ||
@@ -47,3 +47,3 @@ currentFile.blocks.push(currentBlock); | ||
} | ||
}; | ||
} | ||
@@ -54,3 +54,3 @@ /* | ||
*/ | ||
var saveFile = function() { | ||
function saveFile() { | ||
if (currentFile && currentFile.newName) { | ||
@@ -60,6 +60,6 @@ files.push(currentFile); | ||
} | ||
}; | ||
} | ||
/* Create file structure */ | ||
var startFile = function() { | ||
function startFile() { | ||
saveBlock(); | ||
@@ -72,5 +72,5 @@ saveFile(); | ||
currentFile.addedLines = 0; | ||
}; | ||
} | ||
var startBlock = function(line) { | ||
function startBlock(line) { | ||
saveBlock(); | ||
@@ -120,5 +120,5 @@ | ||
currentBlock.header = line; | ||
}; | ||
} | ||
var createLine = function(line) { | ||
function createLine(line) { | ||
var currentLine = {}; | ||
@@ -154,4 +154,31 @@ currentLine.content = line; | ||
} | ||
}; | ||
} | ||
/* | ||
* Checks if there is a hunk header coming before a new file starts | ||
* | ||
* Hunk header is a group of three lines started by ( `--- ` , `+++ ` , `@@` ) | ||
*/ | ||
function existHunkHeader(line, lineIdx) { | ||
var idx = lineIdx; | ||
while (idx < diffLines.length - 3) { | ||
if (utils.startsWith(line, 'diff')) { | ||
return false; | ||
} | ||
if ( | ||
utils.startsWith(diffLines[idx], oldFileNameHeader) && | ||
utils.startsWith(diffLines[idx + 1], newFileNameHeader) && | ||
utils.startsWith(diffLines[idx + 2], hunkHeaderPrefix) | ||
) { | ||
return true; | ||
} | ||
idx++; | ||
} | ||
return false; | ||
} | ||
var diffLines = | ||
@@ -271,2 +298,4 @@ diffInput.replace(/\\ No newline at end of file/g, '') | ||
var doesNotExistHunkHeader = !existHunkHeader(line, lineIndex); | ||
/* | ||
@@ -287,12 +316,20 @@ * Git diffs provide more information regarding files modes, renames, copies, | ||
} else if ((values = copyFrom.exec(line))) { | ||
currentFile.oldName = values[1]; | ||
if (doesNotExistHunkHeader) { | ||
currentFile.oldName = values[1]; | ||
} | ||
currentFile.isCopy = true; | ||
} else if ((values = copyTo.exec(line))) { | ||
currentFile.newName = values[1]; | ||
if (doesNotExistHunkHeader) { | ||
currentFile.newName = values[1]; | ||
} | ||
currentFile.isCopy = true; | ||
} else if ((values = renameFrom.exec(line))) { | ||
currentFile.oldName = values[1]; | ||
if (doesNotExistHunkHeader) { | ||
currentFile.oldName = values[1]; | ||
} | ||
currentFile.isRename = true; | ||
} else if ((values = renameTo.exec(line))) { | ||
currentFile.newName = values[1]; | ||
if (doesNotExistHunkHeader) { | ||
currentFile.newName = values[1]; | ||
} | ||
currentFile.isRename = true; | ||
@@ -299,0 +336,0 @@ } else if ((values = similarityIndex.exec(line))) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
334727
42
6067
0
200
+ Addeddiff@3.5.0(transitive)
- Removeddiff@2.2.3(transitive)
Updateddiff@^3.0.0