difit 2.2.5 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +51 -18
- package/README.ko.md +51 -18
- package/README.md +51 -18
- package/README.zh.md +51 -18
- package/dist/client/assets/index-COGlWx3r.js +29 -0
- package/dist/client/assets/{prism-csharp-PBpaowMo.js → prism-csharp-B3t_G-Pn.js} +1 -1
- package/dist/client/assets/prism-hcl-lweK0qz_.js +1 -0
- package/dist/client/assets/{prism-java-BOy7qtYR.js → prism-java-BTjua7nO.js} +1 -1
- package/dist/client/assets/{prism-php-Lr2_cKj7.js → prism-php-CTPwLQZs.js} +1 -1
- package/dist/client/assets/{prism-ruby-D4LgIaKv.js → prism-ruby-BZWvRfdX.js} +1 -1
- package/dist/client/assets/{prism-solidity-CWRLHGtK.js → prism-solidity-Oa5RM1fR.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/generated-file-check.d.ts +16 -0
- package/dist/server/generated-file-check.js +225 -0
- package/dist/server/generated-file-check.test.d.ts +1 -0
- package/dist/server/generated-file-check.test.js +96 -0
- package/dist/server/git-diff.js +25 -0
- package/dist/server/git-diff.test.js +197 -0
- package/dist/types/diff.d.ts +5 -2
- package/package.json +4 -4
- package/dist/client/assets/index-DRjWix98.js +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as U}from"./index-
|
|
1
|
+
import{g as U}from"./index-COGlWx3r.js";function W(r,t){for(var e=0;e<t.length;e++){const a=t[e];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in r)){const u=Object.getOwnPropertyDescriptor(a,s);u&&Object.defineProperty(r,s,u.get?u:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var I={},O;function Z(){return O||(O=1,(function(r){function t(n,l){return n.replace(/<<(\d+)>>/g,function(f,M){return"(?:"+l[+M]+")"})}function e(n,l,f){return RegExp(t(n,l),"")}function a(n,l){for(var f=0;f<l;f++)n=n.replace(/<<self>>/g,function(){return"(?:"+n+")"});return n.replace(/<<self>>/g,"[^\\s\\S]")}var s={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function u(n){return"\\b(?:"+n.trim().replace(/ /g,"|")+")\\b"}var v=u(s.typeDeclaration),d=RegExp(u(s.type+" "+s.typeDeclaration+" "+s.contextual+" "+s.other)),T=u(s.typeDeclaration+" "+s.contextual+" "+s.other),z=u(s.type+" "+s.typeDeclaration+" "+s.other),g=a(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),h=a(/\((?:[^()]|<<self>>)*\)/.source,2),i=/@?\b[A-Za-z_]\w*\b/.source,b=t(/<<0>>(?:\s*<<1>>)?/.source,[i,g]),c=t(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[T,b]),y=/\[\s*(?:,\s*)*\]/.source,A=t(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[c,y]),K=t(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[g,h,y]),q=t(/\(<<0>>+(?:,<<0>>+)+\)/.source,[K]),p=t(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[q,c,y]),o={keyword:d,punctuation:/[<>()?,.:[\]]/},k=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,w=/"(?:\\.|[^\\"\r\n])*"/.source,F=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;r.languages.csharp=r.languages.extend("clike",{string:[{pattern:e(/(^|[^$\\])<<0>>/.source,[F]),lookbehind:!0,greedy:!0},{pattern:e(/(^|[^@$\\])<<0>>/.source,[w]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:e(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[c]),lookbehind:!0,inside:o},{pattern:e(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[i,p]),lookbehind:!0,inside:o},{pattern:e(/(\busing\s+)<<0>>(?=\s*=)/.source,[i]),lookbehind:!0},{pattern:e(/(\b<<0>>\s+)<<1>>/.source,[v,b]),lookbehind:!0,inside:o},{pattern:e(/(\bcatch\s*\(\s*)<<0>>/.source,[c]),lookbehind:!0,inside:o},{pattern:e(/(\bwhere\s+)<<0>>/.source,[i]),lookbehind:!0},{pattern:e(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[A]),lookbehind:!0,inside:o},{pattern:e(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[p,z,i]),inside:o}],keyword:d,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),r.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),r.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:e(/([(,]\s*)<<0>>(?=\s*:)/.source,[i]),lookbehind:!0,alias:"punctuation"}}),r.languages.insertBefore("csharp","class-name",{namespace:{pattern:e(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[i]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:e(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[h]),lookbehind:!0,alias:"class-name",inside:o},"return-type":{pattern:e(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[p,c]),inside:o,alias:"class-name"},"constructor-invocation":{pattern:e(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[p]),lookbehind:!0,inside:o,alias:"class-name"},"generic-method":{pattern:e(/<<0>>\s*<<1>>(?=\s*\()/.source,[i,g]),inside:{function:e(/^<<0>>/.source,[i]),generic:{pattern:RegExp(g),alias:"class-name",inside:o}}},"type-list":{pattern:e(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[v,b,i,p,d.source,h,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:e(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[b,h]),lookbehind:!0,greedy:!0,inside:r.languages.csharp},keyword:d,"class-name":{pattern:RegExp(p),greedy:!0,inside:o},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var x=w+"|"+k,E=t(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[x]),S=a(t(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[E]),2),_=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,N=t(/<<0>>(?:\s*\(<<1>>*\))?/.source,[c,S]);r.languages.insertBefore("csharp","class-name",{attribute:{pattern:e(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[_,N]),lookbehind:!0,greedy:!0,inside:{target:{pattern:e(/^<<0>>(?=\s*:)/.source,[_]),alias:"keyword"},"attribute-arguments":{pattern:e(/\(<<0>>*\)/.source,[S]),inside:r.languages.csharp},"class-name":{pattern:RegExp(c),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var m=/:[^}\r\n]+/.source,C=a(t(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[E]),2),$=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[C,m]),R=a(t(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[x]),2),D=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[R,m]);function j(n,l){return{interpolation:{pattern:e(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[n]),lookbehind:!0,inside:{"format-string":{pattern:e(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[l,m]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:r.languages.csharp}}},string:/[\s\S]+/}}r.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:e(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[$]),lookbehind:!0,greedy:!0,inside:j($,C)},{pattern:e(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[D]),lookbehind:!0,greedy:!0,inside:j(D,R)}],char:{pattern:RegExp(k),greedy:!0}}),r.languages.dotnet=r.languages.cs=r.languages.csharp})(Prism)),I}var B=Z();const G=U(B),J=W({__proto__:null,default:G},[B]);export{J as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as u}from"./index-COGlWx3r.js";function d(t,o){for(var a=0;a<o.length;a++){const e=o[a];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const i=Object.getOwnPropertyDescriptor(e,r);i&&Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var s={},n;function p(){return n||(n=1,Prism.languages.hcl={comment:/(?:\/\/|#).*|\/\*[\s\S]*?(?:\*\/|$)/,heredoc:{pattern:/<<-?(\w+\b)[\s\S]*?^[ \t]*\1/m,greedy:!0,alias:"string"},keyword:[{pattern:/(?:data|resource)\s+(?:"(?:\\[\s\S]|[^\\"])*")(?=\s+"[\w-]+"\s+\{)/i,inside:{type:{pattern:/(resource|data|\s+)(?:"(?:\\[\s\S]|[^\\"])*")/i,lookbehind:!0,alias:"variable"}}},{pattern:/(?:backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+(?=\{)/i,inside:{type:{pattern:/(backend|module|output|provider|provisioner|variable)\s+(?:[\w-]+|"(?:\\[\s\S]|[^\\"])*")\s+/i,lookbehind:!0,alias:"variable"}}},/[\w-]+(?=\s+\{)/],property:[/[-\w\.]+(?=\s*=(?!=))/,/"(?:\\[\s\S]|[^\\"])+"(?=\s*[:=])/],string:{pattern:/"(?:[^\\$"]|\\[\s\S]|\$(?:(?=")|\$+(?!\$)|[^"${])|\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\})*"/,greedy:!0,inside:{interpolation:{pattern:/(^|[^$])\$\{(?:[^{}"]|"(?:[^\\"]|\\[\s\S])*")*\}/,lookbehind:!0,inside:{type:{pattern:/(\b(?:count|data|local|module|path|self|terraform|var)\b\.)[\w\*]+/i,lookbehind:!0,alias:"variable"},keyword:/\b(?:count|data|local|module|path|self|terraform|var)\b/i,function:/\w+(?=\()/,string:{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0},number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,punctuation:/[!\$#%&'()*+,.\/;<=>@\[\\\]^`{|}~?:]/}}}},number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,boolean:/\b(?:false|true)\b/i,punctuation:/[=\[\]{}]/}),s}var l=p();const b=u(l),f=d({__proto__:null,default:b},[l]);export{f as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as u}from"./index-
|
|
1
|
+
import{g as u}from"./index-COGlWx3r.js";function p(t,a){for(var r=0;r<a.length;r++){const e=a[r];if(typeof e!="string"&&!Array.isArray(e)){for(const s in e)if(s!=="default"&&!(s in t)){const n=Object.getOwnPropertyDescriptor(e,s);n&&Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var o={},i;function d(){return i||(i=1,(function(t){var a=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,e={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[e,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:e.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:e.inside}],keyword:a,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":e,keyword:a,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:e.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:e.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return a.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),o}var c=d();const l=u(c),w=p({__proto__:null,default:l},[c]);export{w as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as c}from"./index-
|
|
1
|
+
import{g as c}from"./index-COGlWx3r.js";function f(e,r){for(var n=0;n<r.length;n++){const t=r[n];if(typeof t!="string"&&!Array.isArray(t)){for(const a in t)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(t,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>t[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var u={},d;function g(){return d||(d=1,(function(e){var r=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],t=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,a=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,i=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:r,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:t,operator:a,punctuation:i};var l={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},o=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:l}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:l}}];e.languages.insertBefore("php","variable",{string:o,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:r,string:o,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:t,operator:a,punctuation:i}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",function(s){if(/<\?/.test(s.code)){var p=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;e.languages["markup-templating"].buildPlaceholders(s,"php",p)}}),e.hooks.add("after-tokenize",function(s){e.languages["markup-templating"].tokenizePlaceholders(s,"php")})})(Prism)),u}var b=g();const y=c(b),m=f({__proto__:null,default:y},[b]);export{m as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as l}from"./index-
|
|
1
|
+
import{g as l}from"./index-COGlWx3r.js";function d(e,r){for(var n=0;n<r.length;n++){const t=r[n];if(typeof t!="string"&&!Array.isArray(t)){for(const i in t)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(t,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var a={},o;function g(){return o||(o=1,(function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var r={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var n="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",t=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+n+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:r,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:r,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+t),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+t+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+n),greedy:!0,inside:{interpolation:r,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:r,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:r,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+n),greedy:!0,inside:{interpolation:r,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:r,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby})(Prism)),a}var u=g();const p=l(u),b=d({__proto__:null,default:p},[u]);export{b as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as u}from"./index-
|
|
1
|
+
import{g as u}from"./index-COGlWx3r.js";function d(t,n){for(var i=0;i<n.length;i++){const e=n[i];if(typeof e!="string"&&!Array.isArray(e)){for(const r in e)if(r!=="default"&&!(r in t)){const s=Object.getOwnPropertyDescriptor(e,r);s&&Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var o={},a;function c(){return a||(a=1,Prism.languages.solidity=Prism.languages.extend("clike",{"class-name":{pattern:/(\b(?:contract|enum|interface|library|new|struct|using)\s+)(?!\d)[\w$]+/,lookbehind:!0},keyword:/\b(?:_|anonymous|as|assembly|assert|break|calldata|case|constant|constructor|continue|contract|default|delete|do|else|emit|enum|event|external|for|from|function|if|import|indexed|inherited|interface|internal|is|let|library|mapping|memory|modifier|new|payable|pragma|private|public|pure|require|returns?|revert|selfdestruct|solidity|storage|struct|suicide|switch|this|throw|using|var|view|while)\b/,operator:/=>|->|:=|=:|\*\*|\+\+|--|\|\||&&|<<=?|>>=?|[-+*/%^&|<>!=]=?|[~?]/}),Prism.languages.insertBefore("solidity","keyword",{builtin:/\b(?:address|bool|byte|u?int(?:8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?|string|bytes(?:[1-9]|[12]\d|3[0-2])?)\b/}),Prism.languages.insertBefore("solidity","number",{version:{pattern:/([<>]=?|\^)\d+\.\d+\.\d+\b/,lookbehind:!0,alias:"number"}}),Prism.languages.sol=Prism.languages.solidity),o}var l=c();const m=u(l),y=d({__proto__:null,default:m},[l]);export{y as p};
|
package/dist/client/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="icon" href="/favicon-white.svg" media="(prefers-color-scheme: dark)" />
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
9
9
|
<title>difit - Git Diff Viewer</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-COGlWx3r.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-C6A1GvPr.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GeneratedCheckResult {
|
|
2
|
+
isGenerated: boolean;
|
|
3
|
+
reason?: 'path' | 'universal' | 'language-specific';
|
|
4
|
+
matchedPattern?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a file is generated.
|
|
8
|
+
* Uses a 3-layer approach:
|
|
9
|
+
* 1. Path/Filename patterns (fastest, no reading)
|
|
10
|
+
* 2. Universal header patterns (checks first 20 lines)
|
|
11
|
+
* 3. Language-specific header patterns (checks first 20 lines)
|
|
12
|
+
*
|
|
13
|
+
* @param parsedPath The decoded git path of the file
|
|
14
|
+
* @param getHeaderLines A function that lazily provides the first 20 lines of the file content
|
|
15
|
+
*/
|
|
16
|
+
export declare function isGeneratedFile(parsedPath: string, getHeaderLines?: () => string[]): GeneratedCheckResult;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// Layer 1: Path/Filename Patterns
|
|
2
|
+
const PATH_PATTERNS = [
|
|
3
|
+
// Lock files (all languages)
|
|
4
|
+
/package-lock\.json$/,
|
|
5
|
+
/pnpm-lock\.yaml$/,
|
|
6
|
+
/yarn\.lock$/,
|
|
7
|
+
/Gemfile\.lock$/,
|
|
8
|
+
/Pipfile\.lock$/,
|
|
9
|
+
/composer\.lock$/,
|
|
10
|
+
/Cargo\.lock$/,
|
|
11
|
+
/poetry\.lock$/,
|
|
12
|
+
/go\.sum$/,
|
|
13
|
+
/go\.mod$/,
|
|
14
|
+
/pubspec\.lock$/,
|
|
15
|
+
/flake\.lock$/,
|
|
16
|
+
/Package\.resolved$/,
|
|
17
|
+
/packages\.lock\.json$/,
|
|
18
|
+
/\.terraform\.lock\.hcl$/,
|
|
19
|
+
/bun\.lockb$/,
|
|
20
|
+
/gradle\.lockfile$/,
|
|
21
|
+
/uv\.lock$/,
|
|
22
|
+
/pdm\.lock$/,
|
|
23
|
+
// Minified / Bundled
|
|
24
|
+
/\.min\.(js|css)$/,
|
|
25
|
+
/\.bundle\.(js|css)$/,
|
|
26
|
+
/-min\.js$/,
|
|
27
|
+
/\.map$/,
|
|
28
|
+
// Generated naming conventions
|
|
29
|
+
/\.generated\.\w+$/,
|
|
30
|
+
/\.gen\.\w+$/,
|
|
31
|
+
/\.pb\.(go|rb|py|js|cc|h)$/, // protobuf
|
|
32
|
+
/\.pb2\.py$/, // protobuf python
|
|
33
|
+
/_pb2\.py$/,
|
|
34
|
+
/\.grpc\.pb\.go$/,
|
|
35
|
+
/_string\.go$/, // go generate stringer
|
|
36
|
+
/\.graphql\.(ts|js)$/, // GraphQL codegen
|
|
37
|
+
/\.openapi\.(ts|js)$/,
|
|
38
|
+
/mock_.*\.go$/, // mockgen
|
|
39
|
+
/mocks\/.*\.go$/,
|
|
40
|
+
/\.msw\.ts$/,
|
|
41
|
+
/\.zod\.ts$/,
|
|
42
|
+
/\.api\.ts$/,
|
|
43
|
+
/\.g\.dart$/,
|
|
44
|
+
/\.freezed\.dart$/,
|
|
45
|
+
/\.g\.cs$/,
|
|
46
|
+
/\.designer\.cs$/,
|
|
47
|
+
/_ide_helper\.php$/,
|
|
48
|
+
// Directories
|
|
49
|
+
/^vendor\//,
|
|
50
|
+
/^node_modules\//,
|
|
51
|
+
/^(dist|build|out)\//,
|
|
52
|
+
/\/generated\//,
|
|
53
|
+
/\/gen\//,
|
|
54
|
+
/\/__generated__\//, // Relay
|
|
55
|
+
];
|
|
56
|
+
// Layer 2: Universal Header Patterns
|
|
57
|
+
const UNIVERSAL_PATTERNS = [
|
|
58
|
+
// Most common markers
|
|
59
|
+
/@generated\b/,
|
|
60
|
+
/\bDO NOT EDIT\b/i,
|
|
61
|
+
/\bDO NOT MODIFY\b/i,
|
|
62
|
+
/\bAUTO[- ]?GENERATED\b/i,
|
|
63
|
+
/\bTHIS FILE IS GENERATED\b/i,
|
|
64
|
+
/\bGENERATED CODE\b/i,
|
|
65
|
+
/\bMACHINE GENERATED\b/i,
|
|
66
|
+
// Common tool output phrases
|
|
67
|
+
/Generated by\b/i,
|
|
68
|
+
/Autogenerated by\b/i,
|
|
69
|
+
/Created by .* - DO NOT EDIT/i,
|
|
70
|
+
/This file was generated/i,
|
|
71
|
+
/This is a generated file/i,
|
|
72
|
+
// XML/HTML style
|
|
73
|
+
/<auto-generated\s*\/?>/i,
|
|
74
|
+
/<!-- Generated by/i,
|
|
75
|
+
];
|
|
76
|
+
const LANGUAGE_SPECIFIC = [
|
|
77
|
+
{
|
|
78
|
+
extensions: ['.go'],
|
|
79
|
+
patterns: [
|
|
80
|
+
// Go official specification (https://golang.org/s/generatedcode)
|
|
81
|
+
/^\/\/ Code generated .* DO NOT EDIT\.$/m,
|
|
82
|
+
/Code generated by protoc-gen-go/,
|
|
83
|
+
/Code generated by Wire/,
|
|
84
|
+
/Code generated by ent/,
|
|
85
|
+
/Code generated by sqlc/,
|
|
86
|
+
/Code generated by MockGen/,
|
|
87
|
+
/Code generated by go-swagger/,
|
|
88
|
+
/Code generated by "stringer"/,
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
extensions: ['.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs'],
|
|
93
|
+
patterns: [
|
|
94
|
+
/generated using openapi-typescript-codegen/i,
|
|
95
|
+
/This file was auto-generated by openapi/i,
|
|
96
|
+
/Generated by orval/i,
|
|
97
|
+
/THIS FILE WAS GENERATED/,
|
|
98
|
+
/Generated by graphql-codegen/i,
|
|
99
|
+
/Prisma Client JS/,
|
|
100
|
+
/Generated by the protocol buffer/,
|
|
101
|
+
/GENERATED CODE -- DO NOT EDIT/,
|
|
102
|
+
/@generated SignedSource/,
|
|
103
|
+
/Generated by Apollo/,
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
extensions: ['.rb'],
|
|
108
|
+
patterns: [
|
|
109
|
+
/This file is auto-generated from the current state of the database/,
|
|
110
|
+
/This file is autogenerated/,
|
|
111
|
+
/Generated by the protocol buffer/,
|
|
112
|
+
/Autogenerated by Thrift/,
|
|
113
|
+
/DO NOT MODIFY.*schema/i,
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
extensions: ['.php'],
|
|
118
|
+
patterns: [
|
|
119
|
+
/This class was generated by/i,
|
|
120
|
+
/Doctrine .* Generated/i,
|
|
121
|
+
/Generated by the protocol buffer/,
|
|
122
|
+
/auto-generated by Symfony/i,
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
extensions: ['.py'],
|
|
127
|
+
patterns: [
|
|
128
|
+
/Generated by the protocol buffer compiler/,
|
|
129
|
+
/@generated by mypy-protobuf/,
|
|
130
|
+
/Generated by the gRPC/,
|
|
131
|
+
/Autogenerated by Thrift/,
|
|
132
|
+
/# Generated by Django/,
|
|
133
|
+
/autogenerated by sqlacodegen/i,
|
|
134
|
+
/generated by datamodel-codegen/,
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
extensions: ['.java', '.kt'],
|
|
139
|
+
patterns: [
|
|
140
|
+
/Generated by the protocol buffer/,
|
|
141
|
+
/@javax\.annotation\.Generated/,
|
|
142
|
+
/@Generated\(/,
|
|
143
|
+
/Generated by the gRPC/,
|
|
144
|
+
/Generated by Dagger/,
|
|
145
|
+
/generated at.*by JAXB/i,
|
|
146
|
+
/OpenAPI Generator/,
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
extensions: ['.cs'],
|
|
151
|
+
patterns: [
|
|
152
|
+
/<auto-generated>/,
|
|
153
|
+
/<autogenerated>/,
|
|
154
|
+
/Generated by the protocol buffer/,
|
|
155
|
+
/auto-generated by EF/i,
|
|
156
|
+
/This code was generated by a tool/,
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
/**
|
|
161
|
+
* Checks if a file is generated.
|
|
162
|
+
* Uses a 3-layer approach:
|
|
163
|
+
* 1. Path/Filename patterns (fastest, no reading)
|
|
164
|
+
* 2. Universal header patterns (checks first 20 lines)
|
|
165
|
+
* 3. Language-specific header patterns (checks first 20 lines)
|
|
166
|
+
*
|
|
167
|
+
* @param parsedPath The decoded git path of the file
|
|
168
|
+
* @param getHeaderLines A function that lazily provides the first 20 lines of the file content
|
|
169
|
+
*/
|
|
170
|
+
export function isGeneratedFile(parsedPath, getHeaderLines) {
|
|
171
|
+
// Layer 1: Path-based check (no file read)
|
|
172
|
+
// We check if the filename matches any known generated patterns
|
|
173
|
+
// or if the path is in a known generated directory
|
|
174
|
+
const fileName = parsedPath.split('/').pop() || '';
|
|
175
|
+
for (const pattern of PATH_PATTERNS) {
|
|
176
|
+
// Some patterns match the whole path (directories), others just the filename
|
|
177
|
+
const textToCheck = pattern.source.includes('/') ? parsedPath : fileName;
|
|
178
|
+
if (pattern.test(textToCheck)) {
|
|
179
|
+
return {
|
|
180
|
+
isGenerated: true,
|
|
181
|
+
reason: 'path',
|
|
182
|
+
matchedPattern: pattern.source,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Optimization: Skip content checks for markdown files as they are documentation
|
|
187
|
+
// and often contain examples of generated headers which trigger false positives.
|
|
188
|
+
if (/\.(md|markdown)$/i.test(fileName)) {
|
|
189
|
+
return { isGenerated: false };
|
|
190
|
+
}
|
|
191
|
+
// If no content provider is available, we can't check further
|
|
192
|
+
if (!getHeaderLines) {
|
|
193
|
+
return { isGenerated: false };
|
|
194
|
+
}
|
|
195
|
+
// Layer 2 & 3: Header-based check
|
|
196
|
+
const lines = getHeaderLines();
|
|
197
|
+
const header = lines.join('\n');
|
|
198
|
+
// Universal patterns
|
|
199
|
+
for (const pattern of UNIVERSAL_PATTERNS) {
|
|
200
|
+
if (pattern.test(header)) {
|
|
201
|
+
return {
|
|
202
|
+
isGenerated: true,
|
|
203
|
+
reason: 'universal',
|
|
204
|
+
matchedPattern: pattern.source,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Language-specific patterns
|
|
209
|
+
// Simple extension extraction
|
|
210
|
+
const extMatch = parsedPath.match(/\.[a-zA-Z0-9]+$/);
|
|
211
|
+
const ext = extMatch ? extMatch[0] : '';
|
|
212
|
+
const langPatterns = LANGUAGE_SPECIFIC.find((lang) => lang.extensions.includes(ext));
|
|
213
|
+
if (langPatterns) {
|
|
214
|
+
for (const pattern of langPatterns.patterns) {
|
|
215
|
+
if (pattern.test(header)) {
|
|
216
|
+
return {
|
|
217
|
+
isGenerated: true,
|
|
218
|
+
reason: 'language-specific',
|
|
219
|
+
matchedPattern: pattern.source,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return { isGenerated: false };
|
|
225
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { isGeneratedFile } from './generated-file-check';
|
|
3
|
+
describe('isGeneratedFile', () => {
|
|
4
|
+
describe('Layer 1: Path Patterns', () => {
|
|
5
|
+
it('detects Swift Package Manager generated files', () => {
|
|
6
|
+
expect(isGeneratedFile('Package.resolved').isGenerated).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
it('detects lock files', () => {
|
|
9
|
+
expect(isGeneratedFile('package-lock.json').isGenerated).toBe(true);
|
|
10
|
+
expect(isGeneratedFile('yarn.lock').isGenerated).toBe(true);
|
|
11
|
+
expect(isGeneratedFile('pnpm-lock.yaml').isGenerated).toBe(true);
|
|
12
|
+
expect(isGeneratedFile('go.sum').isGenerated).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
it('detects minified files', () => {
|
|
15
|
+
expect(isGeneratedFile('jquery.min.js').isGenerated).toBe(true);
|
|
16
|
+
expect(isGeneratedFile('style.min.css').isGenerated).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('detects generated naming conventions', () => {
|
|
19
|
+
expect(isGeneratedFile('user.generated.ts').isGenerated).toBe(true);
|
|
20
|
+
expect(isGeneratedFile('api.gen.go').isGenerated).toBe(true);
|
|
21
|
+
expect(isGeneratedFile('service.pb.go').isGenerated).toBe(true);
|
|
22
|
+
expect(isGeneratedFile('schema.graphql.ts').isGenerated).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
it('detects generated directories', () => {
|
|
25
|
+
expect(isGeneratedFile('node_modules/package/index.js').isGenerated).toBe(true);
|
|
26
|
+
expect(isGeneratedFile('dist/bundle.js').isGenerated).toBe(true);
|
|
27
|
+
expect(isGeneratedFile('src/__generated__/query.ts').isGenerated).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
it('returns false for regular files', () => {
|
|
30
|
+
expect(isGeneratedFile('src/index.ts').isGenerated).toBe(false);
|
|
31
|
+
expect(isGeneratedFile('README.md').isGenerated).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('Layer 2: Universal Header Patterns', () => {
|
|
35
|
+
it('detects @generated marker', () => {
|
|
36
|
+
const lines = ['/**', ' * @generated', ' */'];
|
|
37
|
+
expect(isGeneratedFile('src/unknown.ts', () => lines).isGenerated).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
it('detects DO NOT EDIT marker', () => {
|
|
40
|
+
const lines = ['// Code generated by tool. DO NOT EDIT.'];
|
|
41
|
+
expect(isGeneratedFile('src/client.ts', () => lines).isGenerated).toBe(true);
|
|
42
|
+
});
|
|
43
|
+
it("detects 'Generated by' phrase", () => {
|
|
44
|
+
const lines = ['# Generated by SomeTool'];
|
|
45
|
+
expect(isGeneratedFile('config.yaml', () => lines).isGenerated).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('Layer 3: Language-Specific Patterns', () => {
|
|
49
|
+
it('detects Go specific patterns', () => {
|
|
50
|
+
const lines = ['// Code generated by protoc-gen-go. DO NOT EDIT.'];
|
|
51
|
+
expect(isGeneratedFile('message.pb.go', () => lines).isGenerated).toBe(true); // Hits path first actually
|
|
52
|
+
// Try one that doesn't hit path
|
|
53
|
+
const otherLines = ['// Code generated by Wire. DO NOT EDIT.'];
|
|
54
|
+
expect(isGeneratedFile('wire_gen.go', () => otherLines).isGenerated).toBe(true);
|
|
55
|
+
});
|
|
56
|
+
it('detects TS/JS specific patterns', () => {
|
|
57
|
+
const lines = ['/* generated using openapi-typescript-codegen */'];
|
|
58
|
+
expect(isGeneratedFile('api.ts', () => lines).isGenerated).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
it('detects Python specific patterns', () => {
|
|
61
|
+
const lines = ['# Generated by Django'];
|
|
62
|
+
expect(isGeneratedFile('migrations/001_initial.py', () => lines).isGenerated).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('Lazy Evaluation', () => {
|
|
66
|
+
it('does not call getHeaderLines if path match is found', () => {
|
|
67
|
+
// We can't easily spy on a plain function passed as arg without a wrapper,
|
|
68
|
+
// but we can pass a dummy function and ensure it's not strictly needed for the result
|
|
69
|
+
// Actually simpler: if we pass a function that throws, it should NOT throw if path matches
|
|
70
|
+
const throwFn = () => {
|
|
71
|
+
throw new Error('Should not be called');
|
|
72
|
+
};
|
|
73
|
+
expect(isGeneratedFile('package-lock.json', throwFn).isGenerated).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('False Positives', () => {
|
|
77
|
+
it('does not mark CHANGELOG.md as generated even if it mentions markers', () => {
|
|
78
|
+
const path = 'CHANGELOG.md';
|
|
79
|
+
const content = [
|
|
80
|
+
'# Changelog',
|
|
81
|
+
'',
|
|
82
|
+
'- Support for detecting files with @generated or DO NOT EDIT headers',
|
|
83
|
+
];
|
|
84
|
+
const getHeaderLines = () => content;
|
|
85
|
+
const result = isGeneratedFile(path, getHeaderLines);
|
|
86
|
+
expect(result.isGenerated).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
it('does not mark other markdown files as generated', () => {
|
|
89
|
+
const path = 'docs/guide.md';
|
|
90
|
+
const content = ['# User Guide', 'Use the @generated annotation to mark files.'];
|
|
91
|
+
const getHeaderLines = () => content;
|
|
92
|
+
const result = isGeneratedFile(path, getHeaderLines);
|
|
93
|
+
expect(result.isGenerated).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
package/dist/server/git-diff.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { simpleGit, } from 'simple-git';
|
|
2
2
|
import { validateDiffArguments, shortHash, createCommitRangeString } from '../cli/utils.js';
|
|
3
|
+
import { isGeneratedFile } from './generated-file-check.js';
|
|
3
4
|
export class GitDiffParser {
|
|
4
5
|
git;
|
|
5
6
|
constructor(repoPath = process.cwd()) {
|
|
@@ -49,6 +50,27 @@ export class GitDiffParser {
|
|
|
49
50
|
const diffSummary = await this.git.diffSummary(diffArgs);
|
|
50
51
|
const diffRaw = await this.git.diff(['--color=never', ...diffArgs]);
|
|
51
52
|
const files = this.parseUnifiedDiff(diffRaw, diffSummary.files);
|
|
53
|
+
// Check generated status with content for files not yet identified
|
|
54
|
+
await Promise.all(files.map(async (file) => {
|
|
55
|
+
if (file.isGenerated)
|
|
56
|
+
return;
|
|
57
|
+
if (file.status === 'deleted')
|
|
58
|
+
return;
|
|
59
|
+
try {
|
|
60
|
+
// For content-based checks, we read the first 20 lines of the file
|
|
61
|
+
// We use targetCommitish to get the version of the file we are looking at
|
|
62
|
+
const buffer = await this.getBlobContent(file.path, targetCommitish);
|
|
63
|
+
const content = buffer.toString('utf8');
|
|
64
|
+
const lines = content.split('\n').slice(0, 20);
|
|
65
|
+
const result = isGeneratedFile(file.path, () => lines);
|
|
66
|
+
if (result.isGenerated) {
|
|
67
|
+
file.isGenerated = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Ignore errors (e.g. file too large, file not found in target ref)
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
52
74
|
return {
|
|
53
75
|
commit: resolvedCommit,
|
|
54
76
|
files,
|
|
@@ -246,6 +268,7 @@ export class GitDiffParser {
|
|
|
246
268
|
additions,
|
|
247
269
|
deletions,
|
|
248
270
|
chunks,
|
|
271
|
+
isGenerated: isGeneratedFile(path).isGenerated,
|
|
249
272
|
};
|
|
250
273
|
}
|
|
251
274
|
else if ('binary' in summary && summary.binary) {
|
|
@@ -255,6 +278,7 @@ export class GitDiffParser {
|
|
|
255
278
|
additions: 0,
|
|
256
279
|
deletions: 0,
|
|
257
280
|
chunks: [], // No chunks for binary files
|
|
281
|
+
isGenerated: isGeneratedFile(path).isGenerated,
|
|
258
282
|
};
|
|
259
283
|
}
|
|
260
284
|
else {
|
|
@@ -264,6 +288,7 @@ export class GitDiffParser {
|
|
|
264
288
|
additions: summary.insertions,
|
|
265
289
|
deletions: summary.deletions,
|
|
266
290
|
chunks,
|
|
291
|
+
isGenerated: isGeneratedFile(path).isGenerated,
|
|
267
292
|
};
|
|
268
293
|
}
|
|
269
294
|
}
|