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

react-diff-view

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-diff-view - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

4

package.json
{
"name": "react-diff-view",
"version": "1.4.1",
"version": "1.4.2",
"description": "A git diff component to consume the git unified diff output.",

@@ -17,3 +17,3 @@ "main": "index.js",

"diff": "^3.4.0",
"gitdiff-parser": "0.0.7",
"gitdiff-parser": "0.0.8",
"leven": "^2.1.0",

@@ -20,0 +20,0 @@ "lodash.escape": "^4.0.1",

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.reactDiffView=n():e.reactDiffView=n()}("undefined"!=typeof self?self:this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=3)}([,,,function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),t.d(n,"parseDiff",function(){return l}),t.d(n,"addStubHunk",function(){return f});var r=t(4),i=t.n(r),o=t(5),u=t.n(o),a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},s=function(){return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,n){var t=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(t.push(u.value),!n||t.length!==n);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}return t}(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(e,n){var t="zip"===n.nearbySequences?function(e){var n=e.reduce(function(e,n,t){var r=s(e,3),i=r[0],o=r[1],u=r[2];return o?n.isInsert&&u>=0?(i.splice(u+1,0,n),[i,n,u+2]):(i.push(n),[i,n,n.isDelete&&o.isDelete?u:t]):(i.push(n),[i,n,n.isDelete?t:-1])},[[],null,-1]);return s(n,1)[0]}(e.changes):e.changes;return a({},e,{changes:t})},l=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u()(!n.stubHunk,"stubHunk options is deprecated, use addStubHunk function later to add a stub hunk, this function can receive an extra referenceCodeOrLines argument to determine whether stub hunk is required");return i.a.parse(e).map(function(e){return function(e,n){var t=e.hunks.map(function(e){return c(e,n)});return a({},e,{hunks:n.stubHunk?f(t):t})}(e,n)})},f=function(e,n){if(!e||!e.length)return e;if(!function(){if(!n)return!0;var t="string"==typeof n?n.split("\n"):n,r=e[e.length-1],i=r.oldStart+r.oldLines-1;return t.length>i}())return e;var t=e[e.length-1],r={oldStart:t.oldStart+t.oldLines,oldLines:0,newStart:t.newStart+t.newLines,newLines:0,content:"STUB",changes:[]};return[].concat(function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}(e),[r])}},function(e,n,t){!function(t){var r={parse:function(e){for(var n,t,r,i,o=[],u=2,a=e.split("\n"),s=a.length,c=0;c<s;){var l=a[c];if(0===l.indexOf("diff --git")){var f=l.slice(11),d=null,h=null;switch(f.indexOf('"')){case-1:d=(g=f.split(" "))[0].slice(2),h=g[1].slice(2);break;case 0:var p=f.indexOf('"',2);d=f.slice(3,p);var v=f.indexOf('"',p+1);h=v<0?f.slice(p+4):f.slice(v+3,-1);break;default:d=(g=f.split(" "))[0].slice(2),h=g[1].slice(3,-1)}n={oldPath:d,newPath:h,hunks:[]},o.push(n);var y=null,m=a[c+1];0===m.indexOf("old")&&(n.oldMode=m.slice(9,16),n.newMode=a[c+2].slice(9,16),m=a[(c+=2)+1]),0===m.indexOf("similarity")&&(n.similarity=parseInt(m.split(" ")[2],10),c+=1);var w;e:for(;w=a[++c];){var g;switch((g=w.split(" "))[0]){case"diff":c--;break e;case"index":var b=g[1].split("..");n.oldRevision=b[0],n.newRevision=b[1],g[2]&&(n.oldMode=n.newMode=g[2]),u=5;var x=a[c+1];if(0===x.indexOf("---")){var O=a[c+2];/\s\/dev\/null$/.test(x)?(n.oldPath="/dev/null",y="add"):/\s\/dev\/null$/.test(O)&&(n.newPath="/dev/null",y="delete"),c+=2}break e}y||(y=g[0])}n.type=y||"modify"}else if(0===l.indexOf("Binary"))n.isBinary=!0,u=2,n=null;else if(5===u)if(0===l.indexOf("@@")){var T=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(l);t={content:l,oldStart:T[1]-0,newStart:T[4]-0,oldLines:T[3]-0||0,newLines:T[6]-0||0,changes:[]},n.hunks.push(t),r=t.oldStart,i=t.newStart}else{var k=l.slice(0,1),L={content:l.slice(1)};switch(k){case"+":L.type="insert",L.isInsert=!0,L.lineNumber=i,i++;break;case"-":L.type="delete",L.isDelete=!0,L.lineNumber=r,r++;break;case" ":L.type="normal",L.isNormal=!0,L.oldLineNumber=r,L.newLineNumber=i,r++,i++}L.type&&t.changes.push(L)}c++}return o}};n=e.exports=r}()},function(e,n,t){"use strict";(function(n){var t=function(){};"production"!==n.env.NODE_ENV&&(t=function(e,n,t){var r=arguments.length;t=new Array(r>2?r-2:0);for(var i=2;i<r;i++)t[i-2]=arguments[i];if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(n.length<10||/^[s\W]*$/.test(n))throw new Error("The warning format should be able to uniquely identify this warning. Please, use a more descriptive format than: "+n);if(!e){var o=0,u="Warning: "+n.replace(/%s/g,function(){return t[o++]});"undefined"!=typeof console&&console.error(u);try{throw new Error(u)}catch(e){}}}),e.exports=t}).call(n,t(6))},function(e,n){function t(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===t||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(n){try{return c.call(null,e,0)}catch(n){return c.call(this,e,0)}}}function o(){p&&d&&(p=!1,d.length?h=d.concat(h):v=-1,h.length&&u())}function u(){if(!p){var e=i(o);p=!0;for(var n=h.length;n;){for(d=h,h=[];++v<n;)d&&d[v].run();v=-1,n=h.length}d=null,p=!1,function(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{l(e)}catch(n){try{return l.call(null,e)}catch(n){return l.call(this,e)}}}(e)}}function a(e,n){this.fun=e,this.array=n}function s(){}var c,l,f=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:t}catch(e){c=t}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var d,h=[],p=!1,v=-1;f.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];h.push(new a(e,n)),1!==h.length||p||i(u)},a.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=s,f.addListener=s,f.once=s,f.off=s,f.removeListener=s,f.removeAllListeners=s,f.emit=s,f.prependListener=s,f.prependOnceListener=s,f.listeners=function(e){return[]},f.binding=function(e){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(e){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.reactDiffView=n():e.reactDiffView=n()}("undefined"!=typeof self?self:this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=3)}([,,,function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),t.d(n,"parseDiff",function(){return l}),t.d(n,"addStubHunk",function(){return f});var r=t(4),i=t.n(r),o=t(5),u=t.n(o),a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},s=function(){return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,n){var t=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(t.push(u.value),!n||t.length!==n);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}return t}(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(e,n){var t="zip"===n.nearbySequences?function(e){var n=e.reduce(function(e,n,t){var r=s(e,3),i=r[0],o=r[1],u=r[2];return o?n.isInsert&&u>=0?(i.splice(u+1,0,n),[i,n,u+2]):(i.push(n),[i,n,n.isDelete&&o.isDelete?u:t]):(i.push(n),[i,n,n.isDelete?t:-1])},[[],null,-1]);return s(n,1)[0]}(e.changes):e.changes;return a({},e,{changes:t})},l=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u()(!n.stubHunk,"stubHunk options is deprecated, use addStubHunk function later to add a stub hunk, this function can receive an extra referenceCodeOrLines argument to determine whether stub hunk is required");return i.a.parse(e).map(function(e){return function(e,n){var t=e.hunks.map(function(e){return c(e,n)});return a({},e,{hunks:n.stubHunk?f(t):t})}(e,n)})},f=function(e,n){if(!e||!e.length)return e;if(!function(){if(!n)return!0;var t="string"==typeof n?n.split("\n"):n,r=e[e.length-1],i=r.oldStart+r.oldLines-1;return t.length>i}())return e;var t=e[e.length-1],r={oldStart:t.oldStart+t.oldLines,oldLines:0,newStart:t.newStart+t.newLines,newLines:0,content:"STUB",changes:[]};return[].concat(function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}(e),[r])}},function(e,n,t){!function(t){var r={parse:function(e){for(var n,t,r,i,o=[],u=2,a=e.split("\n"),s=a.length,c=0;c<s;){var l=a[c];if(0===l.indexOf("diff --git")){var f=l.slice(11),d=null,h=null;switch(f.indexOf('"')){case-1:d=(g=f.split(" "))[0].slice(2),h=g[1].slice(2);break;case 0:var p=f.indexOf('"',2);d=f.slice(3,p);var v=f.indexOf('"',p+1);h=v<0?f.slice(p+4):f.slice(v+3,-1);break;default:d=(g=f.split(" "))[0].slice(2),h=g[1].slice(3,-1)}n={oldPath:d,newPath:h,hunks:[]},o.push(n);var y=null,m=a[c+1];0===m.indexOf("old")&&(n.oldMode=m.slice(9,16),n.newMode=a[c+2].slice(9,16),m=a[(c+=2)+1]),0===m.indexOf("similarity")&&(n.similarity=parseInt(m.split(" ")[2],10),c+=1);var w;e:for(;w=a[++c];){var g;switch((g=w.split(" "))[0]){case"diff":c--;break e;case"index":var b=g[1].split("..");n.oldRevision=b[0],n.newRevision=b[1],g[2]&&(n.oldMode=n.newMode=g[2]),u=5;var x=a[c+1];if(0===x.indexOf("---")){var O=a[c+2];/\s\/dev\/null$/.test(x)?(n.oldPath="/dev/null",y="add"):/\s\/dev\/null$/.test(O)&&(n.newPath="/dev/null",y="delete"),c+=2}break e}y||(y=g[0])}n.type=y||"modify"}else if(0===l.indexOf("Binary"))n.isBinary=!0,u=2,n=null;else if(5===u)if(0===l.indexOf("@@")){var T=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(l);t={content:l,oldStart:T[1]-0,newStart:T[4]-0,oldLines:T[3]-0||1,newLines:T[6]-0||1,changes:[]},n.hunks.push(t),r=t.oldStart,i=t.newStart}else{var k=l.slice(0,1),L={content:l.slice(1)};switch(k){case"+":L.type="insert",L.isInsert=!0,L.lineNumber=i,i++;break;case"-":L.type="delete",L.isDelete=!0,L.lineNumber=r,r++;break;case" ":L.type="normal",L.isNormal=!0,L.oldLineNumber=r,L.newLineNumber=i,r++,i++}L.type&&t.changes.push(L)}c++}return o}};n=e.exports=r}()},function(e,n,t){"use strict";(function(n){var t=function(){};"production"!==n.env.NODE_ENV&&(t=function(e,n,t){var r=arguments.length;t=new Array(r>2?r-2:0);for(var i=2;i<r;i++)t[i-2]=arguments[i];if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(n.length<10||/^[s\W]*$/.test(n))throw new Error("The warning format should be able to uniquely identify this warning. Please, use a more descriptive format than: "+n);if(!e){var o=0,u="Warning: "+n.replace(/%s/g,function(){return t[o++]});"undefined"!=typeof console&&console.error(u);try{throw new Error(u)}catch(e){}}}),e.exports=t}).call(n,t(6))},function(e,n){function t(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===t||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(n){try{return c.call(null,e,0)}catch(n){return c.call(this,e,0)}}}function o(){p&&d&&(p=!1,d.length?h=d.concat(h):v=-1,h.length&&u())}function u(){if(!p){var e=i(o);p=!0;for(var n=h.length;n;){for(d=h,h=[];++v<n;)d&&d[v].run();v=-1,n=h.length}d=null,p=!1,function(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{l(e)}catch(n){try{return l.call(null,e)}catch(n){return l.call(this,e)}}}(e)}}function a(e,n){this.fun=e,this.array=n}function s(){}var c,l,f=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:t}catch(e){c=t}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var d,h=[],p=!1,v=-1;f.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];h.push(new a(e,n)),1!==h.length||p||i(u)},a.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=s,f.addListener=s,f.once=s,f.off=s,f.removeListener=s,f.removeAllListeners=s,f.emit=s,f.prependListener=s,f.prependOnceListener=s,f.listeners=function(e){return[]},f.binding=function(e){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(e){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}}])});
//# sourceMappingURL=parse.js.map

@@ -475,1 +475,5 @@ # react-diff-view

- Fix an edge case in `sliceHunk`.
### 1.4.2
- Update `gitdiff-parser` to fix an issue when there is only one line in diff.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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