paths-filter/dist/index.js

7 lines
552 KiB
JavaScript
Raw Normal View History

2022-08-14 15:01:45 +01:00
(()=>{var __webpack_modules__={7757:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const p=a(1514);async function exec(e,t,a){a=a||{};let r="";let i="";a.listeners={stdout:e=>r+=e.toString(),stderr:e=>i+=e.toString()};const s=await(0,p.exec)(e,t,a);return{code:s,stdout:r,stderr:i}}t["default"]=exec},4014:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ChangeStatus=void 0;var a;(function(e){e["Added"]="added";e["Copied"]="copied";e["Deleted"]="deleted";e["Modified"]="modified";e["Renamed"]="renamed";e["Unmerged"]="unmerged"})(a=t.ChangeStatus||(t.ChangeStatus={}))},3707:function(e,t,a){"use strict";var p=this&&this.__createBinding||(Object.create?function(e,t,a,p){if(p===undefined)p=a;var r=Object.getOwnPropertyDescriptor(t,a);if(!r||("get"in r?!t.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return t[a]}}}Object.defineProperty(e,p,r)}:function(e,t,a,p){if(p===undefined)p=a;e[p]=t[a]});var r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))p(t,e,a);r(t,e);return t};var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.Filter=void 0;const d=i(a(1917));const o=s(a(8569));const n=a(4014);const l={dot:true,ignore:[]};class Filter{constructor(e){this.rules={};if(e){this.load(e)}}load(e){const t=d.load(e);if(typeof t!=="object"){this.throwInvalidFormatError("Root element is not an object")}for(const[e,a]of Object.entries(t)){if(typeof e!=="string"){this.throwInvalidFormatError(`Filter rule element at the root key: ${JSON.stringify(e)} must be a string.`)}else if(typeof a!=="string"&&!Array.isArray(a)){this.throwInvalidFormatError(`Filter rules must only be an array or a single string but we got ${JSON.stringify(a)} type: ${typeof a} isarray?: ${Array.isArray(a)}`)}this.rules[e]=this.parseFilterItemYaml(a)}}match(e){const t={};for(const[a,p]of Object.entries(this.rules)){t[a]=e.filter((e=>this.isMatch(e,p)))}return t}isMatch(e,t){return t.some((t=>(t.status===undefined||t.status.includes(e.status))&&t.isMatch(e.filename)))}parseFilterItemYaml(e,t=[]){var a=Object.assign(l);a.ignore=t;if(Array.isArray(e)){return flat(e.map((e=>this.parseFilterItemYaml(e,t))))}if(typeof e==="string"){return[{status:undefined,isMatch:(0,o.default)(e,a)}]}if(typeof e==="object"){var p=Object.keys(e).length;if(p==2&&e.paths_ignore&&e.paths){return this.parseFilterItemYaml(e.paths,e.paths_ignore)}else if(p==1){return Object.entries(e).map((([e,t])=>{if(typeof e!=="string"||typeof t!=="string"&&(!Array.isArray(t)?true:!this.isStringsArray(t))){this.throwInvalidFormatError(`Expected [key:string]= pattern:string | string[], but [${e}:${typeof e}]= ${t}:${typeof t} Where pattern isArray:${Array.isArray(t)} isArrayofStrings:${this.isStringsArray(t)} found.`)}return{status:e.split("|").map((e=>e.trim())).filter((e=>e.length>0)).map((e=>this.isChangeStatus(e)&&e.toLowerCase())),isMatch:(0,o.default)(t,a)}}))}else{this.throwInvalidFormatError(`Expected a filter rule object with keys paths & paths_ignore, or a single key for change status filter. Instead object keys: ${JSON.stringify(Object.keys(e))} found.`)}}this.throwInvalidFormatError(`Unexpected element type '${typeof e}'`)}isStringsArray(e){if(Array.isArray(e)?e.every((e=>typeof e==="string")):false){return true}}isChangeStatus(e){if(Object.values(n.ChangeStatus).includes(e)){return true}this.throwInvalidFormatError(`Change Status Filter Validation: Expected one of ${JSON.stringify(Object.values(n.ChangeStatus))}, instead ${e} found.`)}throwInvalidFormatError(e){throw new Error(`Invalid filter YAML format: ${e}.`)}}t.Filter=Filter;function flat(e){return e.reduce(((e,t)=>e.concat(t)),[])}},3374:function(e,t,a){"use strict";var p=this&&this.__createBinding||(Object.create?functi
2022-08-13 15:47:59 +01:00
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
2022-08-14 15:01:45 +01:00
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,a;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;a=t.prototype;if(isObject(a)===false)return false;if(a.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},1917:(e,t,a)=>{"use strict";var p=a(1161);var r=a(8866);function renamed(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. "+"Use yaml."+t+" instead, which is now safe by default.")}}e.exports.Type=a(6073);e.exports.Schema=a(1082);e.exports.FAILSAFE_SCHEMA=a(8562);e.exports.JSON_SCHEMA=a(1035);e.exports.CORE_SCHEMA=a(2011);e.exports.DEFAULT_SCHEMA=a(8759);e.exports.load=p.load;e.exports.loadAll=p.loadAll;e.exports.dump=r.dump;e.exports.YAMLException=a(8179);e.exports.types={binary:a(7900),float:a(2705),map:a(6150),null:a(721),pairs:a(6860),set:a(9548),timestamp:a(9212),bool:a(4993),int:a(1615),merge:a(6104),omap:a(9046),seq:a(7283),str:a(3619)};e.exports.safeLoad=renamed("safeLoad","load");e.exports.safeLoadAll=renamed("safeLoadAll","loadAll");e.exports.safeDump=renamed("safeDump","dump")},6829:e=>{"use strict";function isNothing(e){return typeof e==="undefined"||e===null}function isObject(e){return typeof e==="object"&&e!==null}function toArray(e){if(Array.isArray(e))return e;else if(isNothing(e))return[];return[e]}function extend(e,t){var a,p,r,i;if(t){i=Object.keys(t);for(a=0,p=i.length;a<p;a+=1){r=i[a];e[r]=t[r]}}return e}function repeat(e,t){var a="",p;for(p=0;p<t;p+=1){a+=e}return a}function isNegativeZero(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}e.exports.isNothing=isNothing;e.exports.isObject=isObject;e.exports.toArray=toArray;e.exports.repeat=repeat;e.exports.isNegativeZero=isNegativeZero;e.exports.extend=extend},8866:(e,t,a)=>{"use strict";var p=a(6829);var r=a(8179);var i=a(8759);var s=Object.prototype.toString;var d=Object.prototype.hasOwnProperty;var o=65279;var n=9;var l=10;var m=13;var u=32;var c=33;var h=34;var v=35;var g=37;var w=38;var _=39;var b=42;var E=44;var T=45;var y=58;var S=61;var A=62;var O=63;var D=64;var C=91;var k=93;var P=96;var R=123;var N=124;var G=125;var x={};x[0]="\\0";x[7]="\\a";x[8]="\\b";x[9]="\\t";x[10]="\\n";x[11]="\\v";x[12]="\\f";x[13]="\\r";x[27]="\\e";x[34]='\\"';x[92]="\\\\";x[133]="\\N";x[160]="\\_";x[8232]="\\L";x[8233]="\\P";var F=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];var U=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function compileStyleMap(e,t){var a,p,r,i,s,o,n;if(t===null)return{};a={};p=Object.keys(t);for(r=0,i=p.length;r<i;r+=1){s=p[r];o=String(t[s]);if(s.slice(0,2)==="!!"){s="tag:yaml.org,2002:"+s.slice(2)}n=e.compiledTypeMap["fallback"][s];if(n&&d.call(n.styleAliases,o)){o=n.styleAliases[o]}a[s]=o}return a}function encodeHex(e){var t,a,i;t=e.toString(16).toUpperCase();if(e<=255){a="x";i=2}else if(e<=65535){a="u";i=4}else if(e<=4294967295){a="U";i=8}else{throw new r("code point within a string may not be greater than 0xFFFFFFFF")}return"\\"+a+p.repeat("0",i-t.length)+t}var L=1,V=2;function State(e){this.schema=e["schema"]||i;this.indent=Math.max(1,e["indent"]||2);this.noArrayIndent=e["noArrayIndent"]||false;this.skipInvalid=e["skipInvalid"]||false;this.flowLevel=p.isNothing(e["flowLevel"])?-1:e["flowLevel"];this.styleMap=compileStyleMap(this.schema,e["styles"]||null);this.sortKeys=e["sortKeys"]||false;this.lineWidth=e["lineWidth"]||80;this.noRefs=e["noRefs"]||false;this.noCompatMode=e["noCompatMode"]||false;this.condenseFlow=e["condenseFlow"]||false;this.quotingType=e["quotingType"]==='"'?V:L;this.forceQuotes=e["forceQuotes"]||false;this.replacer=typeof e["replacer"]==="function"?e["replacer"]:null;this.implicitTypes=this.schema.compiledImplicit;this.explicitTypes=this.schema.compiledExplicit;this.tag=null;this.result="";this.duplicates=[];this.usedDuplicates=null}function indentString(e,t){var a=p.repeat(" ",t),r=0,i=-1,s="",d,o=e.length;while(r<o){i=e.indexOf("\n",r);if(i===-1){d=e.slice(r);r=o}else{d=e.slice(r,i+1);r=i+1}if(d.leng