Release version 2.0.2

This commit is contained in:
Rodrigo Fernandes 2016-08-23 17:25:18 +01:00
parent 7821447330
commit 11c00bbd46
5 changed files with 72 additions and 27 deletions

View file

@ -1,6 +1,6 @@
{
"name": "diff2html",
"version": "2.0.1",
"version": "2.0.2",
"homepage": "http://rtfpessoa.github.io/diff2html/",
"description": "Fast Diff to colorized HTML",
"keywords": [

60
dist/diff2html.js vendored
View file

@ -819,9 +819,13 @@ function applyPatches(uniDiff, options) {
}
var updatedContent = applyPatch(data, index, options);
options.patched(index, updatedContent);
options.patched(index, updatedContent, function (err) {
if (err) {
return options.complete(err);
}
setTimeout(processIndex, 0);
processIndex();
});
});
}
processIndex();
@ -1044,7 +1048,8 @@ function parsePatch(uniDiff) {
// Parses the --- and +++ headers, if none are found, no lines
// are consumed.
function parseFileHeader(index) {
var fileHeader = /^(\-\-\-|\+\+\+)\s+(\S*)\s?(.*?)\s*$/.exec(diffstr[i]);
var headerPattern = /^(---|\+\+\+)\s+([\S ]*)(?:\t(.*?)\s*)?$/;
var fileHeader = headerPattern.exec(diffstr[i]);
if (fileHeader) {
var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
index[keyPrefix + 'FileName'] = fileHeader[2];
@ -2209,7 +2214,6 @@ var substr = 'ab'.substr(-1) === 'b'
}).call(this,require('_process'))
},{"_process":21}],21:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
@ -2236,6 +2240,48 @@ var cachedClearTimeout;
}
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
@ -2260,7 +2306,7 @@ function drainQueue() {
if (draining) {
return;
}
var timeout = cachedSetTimeout(cleanUpNextTick);
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
@ -2277,7 +2323,7 @@ function drainQueue() {
}
currentQueue = null;
draining = false;
cachedClearTimeout(timeout);
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
@ -2289,7 +2335,7 @@ process.nextTick = function (fun) {
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
cachedSetTimeout(drainQueue, 0);
runTimeout(drainQueue);
}
};

File diff suppressed because one or more lines are too long

2
npm-shrinkwrap.json generated
View file

@ -1,6 +1,6 @@
{
"name": "diff2html",
"version": "2.0.1",
"version": "2.0.2",
"dependencies": {
"abbrev": {
"version": "1.0.7",

View file

@ -1,6 +1,6 @@
{
"name": "diff2html",
"version": "2.0.1",
"version": "2.0.2",
"homepage": "http://rtfpessoa.github.io/diff2html/",
"description": "Fast Diff to colorized HTML",
"keywords": [