diff --git a/dist/index.js b/dist/index.js index 7e116d2b..fe61b88e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45570,7 +45570,8 @@ var hasRequiredParseDiff; function requireParseDiff () { if (hasRequiredParseDiff) return parseDiff$1; hasRequiredParseDiff = 1; -function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike){if(it)o=it;var i=0;var F=function F(){};return {s:F,n:function n(){if(i>=o.length)return {done:true};return {done:false,value:o[i++]}},e:function e(_e2){throw _e2},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return {s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e3){didErr=true;err=_e3;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err}}}}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key)}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint);if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return (hint==="string"?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i{if(!n)return [];if(typeof n!="string"||n.match(/^\s+$/))return [];const s=n.split(` +`);if(s.length===0)return [];const a=[];let o=null,d=null,u=0,m=0,l=null;const g=e=>{d?.changes.push({type:"normal",normal:true,ln1:u++,ln2:m++,content:e}),l.oldLines--,l.newLines--;},p=e=>{const[t,r]=parseFiles(e)??[];o={chunks:[],deletions:0,additions:0,from:t,to:r},a.push(o);},i=()=>{(!o||o.chunks.length)&&p();},$=(e,t)=>{i(),o.new=true,o.newMode=t[1],o.from="/dev/null";},N=(e,t)=>{i(),o.deleted=true,o.oldMode=t[1],o.to="/dev/null";},x=(e,t)=>{i(),o.oldMode=t[1];},F=(e,t)=>{i(),o.newMode=t[1];},S=(e,t)=>{i(),o.index=e.split(" ").slice(1),t[1]&&(o.oldMode=o.newMode=t[1].trim());},k=e=>{i(),o.from=parseOldOrNewFile(e);},y=e=>{i(),o.to=parseOldOrNewFile(e);},f=e=>+(e||1),M=(e,t)=>{o||p(e);const[r,c,w,L]=t.slice(1);u=+r,m=+w,d={content:e,changes:[],oldStart:+r,oldLines:f(c),newStart:+w,newLines:f(L)},l={oldLines:f(c),newLines:f(L)},o.chunks.push(d);},R=e=>{d&&(d.changes.push({type:"del",del:true,ln:u++,content:e}),o.deletions++,l.oldLines--);},b=e=>{d&&(d.changes.push({type:"add",add:true,ln:m++,content:e}),o.additions++,l.newLines--);},h=e=>{if(!d)return;const[t]=d.changes.slice(-1);d.changes.push({type:t.type,[t.type]:true,ln1:t.ln1,ln2:t.ln2,ln:t.ln,content:e});},_=[[/^diff\s/,p],[/^new file mode (\d+)$/,$],[/^deleted file mode (\d+)$/,N],[/^old mode (\d+)$/,x],[/^new mode (\d+)$/,F],[/^index\s[\da-zA-Z]+\.\.[\da-zA-Z]+(\s(\d+))?$/,S],[/^---\s/,k],[/^\+\+\+\s/,y],[/^@@\s+-(\d+),?(\d+)?\s+\+(\d+),?(\d+)?\s@@/,M],[/^\\ No newline at end of file$/,h]],v=[[/^\\ No newline at end of file$/,h],[/^-/,R],[/^\+/,b],[/^\s*/,g]],C=e=>{for(const[t,r]of v){const c=e.match(t);if(c){r(e,c);break}}l.oldLines===0&&l.newLines===0&&(l=null);},H=e=>{for(const[t,r]of _){const c=e.match(t);if(c){r(e,c);break}}},O=e=>{l?C(e):H(e);};for(const e of s)O(e);return a};const fileNameDiffRegex=/(a|i|w|c|o|1|2)\/.*(?=["']? ["']?(b|i|w|c|o|1|2)\/)|(b|i|w|c|o|1|2)\/.*$/g,gitFileHeaderRegex=/^(a|b|i|w|c|o|1|2)\//,parseFiles=n=>n?.match(fileNameDiffRegex)?.map(a=>a.replace(gitFileHeaderRegex,"").replace(/("|')$/,"")),qoutedFileNameRegex=/^\\?['"]|\\?['"]$/g,parseOldOrNewFile=n=>{let s=leftTrimChars(n,"-+").trim();return s=removeTimeStamp(s),s.replace(qoutedFileNameRegex,"").replace(gitFileHeaderRegex,"")},leftTrimChars=(n,s)=>{if(n=makeString(n),!s);const a=formTrimmingString(s);return n.replace(new RegExp(`^${a}+`),"")},timeStampRegex=/\t.*|\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d(.\d+)?\s(\+|-)\d\d\d\d/,removeTimeStamp=n=>{const s=timeStampRegex.exec(n);return s&&(n=n.substring(0,s.index).trim()),n},formTrimmingString=n=>n instanceof RegExp?n.source:`[${makeString(n).replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}]`,makeString=n=>`${n??""}`; return parseDiff$1; } diff --git a/dist/licenses.txt b/dist/licenses.txt index df260bf0..d5b495e2 100644 --- a/dist/licenses.txt +++ b/dist/licenses.txt @@ -1331,7 +1331,7 @@ software or this license, under any kind of legal claim._** --- Name: parse-diff -Version: 0.11.1 +Version: 0.12.0 License: MIT Private: false Description: Unified diff parser diff --git a/package.json b/package.json index 87d0180f..849a4c3a 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@octokit/plugin-throttling": "^11.0.3", "generic-type-guard": "^5.1.0", "minimatch": "^10.2.5", - "parse-diff": "^0.11.1", + "parse-diff": "^0.12.0", "yaml": "^2.8.3" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e709bba4..de66ca6d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,8 +30,8 @@ importers: specifier: ^10.2.5 version: 10.2.5 parse-diff: - specifier: ^0.11.1 - version: 0.11.1 + specifier: ^0.12.0 + version: 0.12.0 yaml: specifier: ^2.8.3 version: 2.8.3 @@ -3082,8 +3082,8 @@ packages: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} - parse-diff@0.11.1: - resolution: {integrity: sha512-Oq4j8LAOPOcssanQkIjxosjATBIEJhCxMCxPhMu+Ci4wdNmAEdx0O+a7gzbR2PyKXgKPvRLIN5g224+dJAsKHA==} + parse-diff@0.12.0: + resolution: {integrity: sha512-2Xr5mW4Bqd4CqYq2zttfw/RZraK+KcRuJvNkJzbDk3ea67Ap525XeTvBdtDE5tigJMVzIx/DMUzsShAf6+5SCA==} parse-filepath@1.0.2: resolution: {integrity: sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==} @@ -7286,7 +7286,7 @@ snapshots: dependencies: callsites: 3.1.0 - parse-diff@0.11.1: {} + parse-diff@0.12.0: {} parse-filepath@1.0.2: dependencies: