@stoplight/path
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -1,1 +0,1 @@ | ||
"use strict";function format(e){let r="";return e.absolute&&("file"===e.protocol?(e.drive&&(r+=e.drive),r+="/"):(r+=e.protocol+"://",e.origin&&(r+=e.origin+"/"))),""===(r+=e.path.join("/"))&&(r="."),r}function peg$subclass(e,r){function t(){this.constructor=e}t.prototype=r.prototype,e.prototype=new t}function peg$SyntaxError(e,r,t,n){this.message=e,this.expected=r,this.found=t,this.location=n,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,peg$SyntaxError)}function peg$parse(e,r){r=void 0!==r?r:{};var t,n,o,a,s={},i={Path:0},u=0,l=[function(e,r,t,n){return{protocol:e,origin:r,absolute:!0,...t,...n}},function(e,r,t){return{protocol:e,origin:r,absolute:!0,...t,path:[]}},"http://",d("http://",!0),function(e){return"http"},"https://",d("https://",!0),function(e){return"https"},"",function(){return null},function(e,r,t){return{protocol:e,origin:null,absolute:!0,...r,...t}},"file://",d("file://",!0),"file:",d("file:",!0),function(e){return"file"},function(e,r){return{protocol:"file",origin:null,absolute:!0,...e,...r}},function(){return{drive:null}},/^[A-Za-z]/,m([["A","Z"],["a","z"]],!1,!1),":",d(":",!1),function(e){return{drive:e.toLowerCase()+":"}},function(){return{drive:null}},function(e){return{protocol:null,origin:null,absolute:!1,drive:null,...e}},function(e){return{path:e}},function(e,r){return[e,...r]},function(e){return[e]},".",d(".",!1),"/",d("/",!1),"\\",d("\\",!1),/^[^\/\\]/,m(["/","\\"],!0,!1)],p=[k(";!./ &;&.) &;(.# &;-"),k("%;\"/F#;%/=$;*/4$;./+$8$: $$#\"! )($'#(#'#(\"'#&'#.F &%;\"/<#;%/3$;,/*$8#:!##\"! )(#'#(\"'#&'#"),k(";#.# &;$"),k('%3"""5\'7#/\' 8!:$!! )'),k("%3%\"\"5(7&/' 8!:'!! )"),k('%$;5/�#*;5&&&#/"!&,).. &% (/& 8!:)! )'),k("%;'/<#;)/3$;./*$8#:*##\"! )(#'#(\"'#&'#"),k('%3+""5\'7,.) &3-""5%7./\' 8!:/!! )'),k('%;)/2#;./)$8":0""! )("\'#&\'#'),k(";*.# &;+"),k("%;4/& 8!:1! )"),k('%42""5!73/@#24""6475/1$;4/($8#:6#!")(#\'#("\'#&\'#'),k("% (/& 8!:7! )"),k('%;0/1#;./($8":8"! )("\'#&\'#'),k("%;//' 8!:9!! )"),k("%;1/;#;4/2$;//)$8#::#\"\" )(#'#(\"'#&'#./ &%;1/' 8!:;!! )"),k(";2.# &;3"),k('%$;5/�#*;5&&&#/"!&,).# & ('),k('%2<""6<7=/,#;4/#$+")("\'#&\'#'),k(" ("),k('2>""6>7?.) &2@""6@7A'),k('4B""5!7C')],c=0,h=[{line:1,column:1}],f=0,g=[],b=0;if("startRule"in r){if(!(r.startRule in i))throw new Error("Can't start parsing from rule \""+r.startRule+'".');u=i[r.startRule]}function d(e,r){return{type:"literal",text:e,ignoreCase:r}}function m(e,r,t){return{type:"class",parts:e,inverted:r,ignoreCase:t}}function x(r){var t,n=h[r];if(n)return n;for(t=r-1;!h[t];)t--;for(n={line:(n=h[t]).line,column:n.column};t<r;)10===e.charCodeAt(t)?(n.line++,n.column=1):n.column++,t++;return h[r]=n,n}function $(e,r){var t=x(e),n=x(r);return{start:{offset:e,line:t.line,column:t.column},end:{offset:r,line:n.line,column:n.column}}}function v(e){c<f||(c>f&&(f=c,g=[]),g.push(e))}function k(e){var r,t=new Array(e.length);for(r=0;r<e.length;r++)t[r]=e.charCodeAt(r)-32;return t}if((t=function r(t){for(var n,o,a=p[t],i=0,u=[],h=a.length,f=[],g=[];;){for(;i<h;)switch(a[i]){case 0:g.push(l[a[i+1]]),i+=2;break;case 1:g.push(void 0),i++;break;case 2:g.push(null),i++;break;case 3:g.push(s),i++;break;case 4:g.push([]),i++;break;case 5:g.push(c),i++;break;case 6:g.pop(),i++;break;case 7:c=g.pop(),i++;break;case 8:g.length-=a[i+1],i+=2;break;case 9:g.splice(-2,1),i++;break;case 10:g[g.length-2].push(g.pop()),i++;break;case 11:g.push(g.splice(g.length-a[i+1],a[i+1])),i+=2;break;case 12:g.push(e.substring(g.pop(),c)),i++;break;case 13:f.push(h),u.push(i+3+a[i+1]+a[i+2]),g[g.length-1]?(h=i+3+a[i+1],i+=3):(h=i+3+a[i+1]+a[i+2],i+=3+a[i+1]);break;case 14:f.push(h),u.push(i+3+a[i+1]+a[i+2]),g[g.length-1]===s?(h=i+3+a[i+1],i+=3):(h=i+3+a[i+1]+a[i+2],i+=3+a[i+1]);break;case 15:f.push(h),u.push(i+3+a[i+1]+a[i+2]),g[g.length-1]!==s?(h=i+3+a[i+1],i+=3):(h=i+3+a[i+1]+a[i+2],i+=3+a[i+1]);break;case 16:g[g.length-1]!==s?(f.push(h),u.push(i),h=i+2+a[i+1],i+=2):i+=2+a[i+1];break;case 17:f.push(h),u.push(i+3+a[i+1]+a[i+2]),e.length>c?(h=i+3+a[i+1],i+=3):(h=i+3+a[i+1]+a[i+2],i+=3+a[i+1]);break;case 18:f.push(h),u.push(i+4+a[i+2]+a[i+3]),e.substr(c,l[a[i+1]].length)===l[a[i+1]]?(h=i+4+a[i+2],i+=4):(h=i+4+a[i+2]+a[i+3],i+=4+a[i+2]);break;case 19:f.push(h),u.push(i+4+a[i+2]+a[i+3]),e.substr(c,l[a[i+1]].length).toLowerCase()===l[a[i+1]]?(h=i+4+a[i+2],i+=4):(h=i+4+a[i+2]+a[i+3],i+=4+a[i+2]);break;case 20:f.push(h),u.push(i+4+a[i+2]+a[i+3]),l[a[i+1]].test(e.charAt(c))?(h=i+4+a[i+2],i+=4):(h=i+4+a[i+2]+a[i+3],i+=4+a[i+2]);break;case 21:g.push(e.substr(c,a[i+1])),c+=a[i+1],i+=2;break;case 22:g.push(l[a[i+1]]),c+=l[a[i+1]].length,i+=2;break;case 23:g.push(s),0===b&&v(l[a[i+1]]),i+=2;break;case 24:g[g.length-1-a[i+1]],i+=2;break;case 25:c,i++;break;case 26:for(n=a.slice(i+4,i+4+a[i+3]),o=0;o<a[i+3];o++)n[o]=g[g.length-1-n[o]];g.splice(g.length-a[i+2],a[i+2],l[a[i+1]].apply(null,n)),i+=4+a[i+3];break;case 27:g.push(r(a[i+1])),i+=2;break;case 28:b++,i++;break;case 29:b--,i++;break;default:throw new Error("Invalid opcode: "+a[i]+".")}if(!(f.length>0))break;h=f.pop(),i=u.pop()}return g[0]}(u))!==s&&c===e.length)return t;throw t!==s&&c<e.length&&v({type:"end"}),n=g,o=f<e.length?e.charAt(f):null,a=f<e.length?$(f,f+1):$(f,f),new peg$SyntaxError(peg$SyntaxError.buildMessage(n,o),n,o,a)}Object.defineProperty(exports,"__esModule",{value:!0}),peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.buildMessage=function(e,r){var t={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var r,t="";for(r=0;r<e.parts.length;r++)t+=e.parts[r]instanceof Array?a(e.parts[r][0])+"-"+a(e.parts[r][1]):a(e.parts[r]);return"["+(e.inverted?"^":"")+t+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}function a(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}return"Expected "+function(e){var r,n,o,a=new Array(e.length);for(r=0;r<e.length;r++)a[r]=(o=e[r],t[o.type](o));if(a.sort(),a.length>0){for(r=1,n=1;r<a.length;r++)a[r-1]!==a[r]&&(a[n]=a[r],n++);a.length=n}switch(a.length){case 1:return a[0];case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(r)+" found."};var grammar={SyntaxError:peg$SyntaxError,parse:peg$parse},grammar_1=grammar.parse;function parse(e){if("string"!=typeof e)throw new Error(`@stoplight/path: Cannot parse ${e} because it is not a string`);return grammar_1(e,{})}function normalize(e){return format(normalizeParsed(parse(e)))}function normalizeParsed(e){let r=e.path;r=r.filter(e=>""!==e&&"."!==e);const t=[];for(const n of r)".."===n&&t.length&&".."!==t[t.length-1]?t.pop():".."===n&&e.absolute||t.push(n);return e.path=t,e}function parseBase(e){let r=e.lastIndexOf(".");".."===e&&(r=-1),"."===e&&(r=-1);let t=e,n="";return r>0&&(t=e.slice(0,r),n=e.slice(r)),{name:t,ext:n}}const basename=(e,r)=>{const t=normalizeParsed(parse(e)).path.pop();if(!t)return"";const{name:n,ext:o}=parseBase(t);return!0===r||r===o?n:`${n}${o}`},dirname=e=>{const r=normalizeParsed(parse(e));return r.path.pop(),format(normalizeParsed(r))},extname=e=>{const r=normalizeParsed(parse(e)).path.pop();if(!r)return"";const{ext:t}=parseBase(r);return t};function isAbsolute(e){return parse(e).absolute}function isURL(e){const r=parse(e);return"http"===r.protocol||"https"===r.protocol}const join=(...e)=>{if(0===e.length)return".";const r=e.map(parse),t=Object.assign({},r[0]);for(let n=1;n<r.length;n++){const o=r[n];if(o.absolute)throw new Error('Cannot join an absolute path "'+e[n]+'" in the middle of other paths.');for(const e of o.path)t.path.push(e)}return format(normalizeParsed(t))};function relative(e,r){const t=normalizeParsed(parse(r));if(!t.absolute)return format(t);const n=normalizeParsed(parse(e));if(t.origin!==n.origin)return format(t);if(!n.absolute)return format(t);if(n.drive!==t.drive)return format(t);const o=Math.min(n.path.length,t.path.length);for(let e=0;e<o&&n.path[0]===t.path[0];e++)n.path.shift(),t.path.shift();return t.path.unshift(...n.path.fill("..")),format({origin:null,drive:null,absolute:!1,protocol:null,path:t.path})}function resolve(...e){if(0===e.length)return".";const r=normalizeParsed(parse(e[e.length-1]));return r.absolute?format(r):join(...e)}const sep="/",startsWithWindowsDrive=e=>{return null!==parse(e).drive},stripRoot=e=>parse(e).path.filter(Boolean).join("/");function deserializeSrn(e){const[r,t,n,...o]=e.split("/"),a=o.length?`/${o.join("/")}`:void 0;let s,i;return a&&(s=o.find(e=>e.includes(".")))&&(i=parseBase(s).ext),{shortcode:r,orgSlug:t,projectSlug:n,uri:a,file:s,ext:i}}function serializeSrn({shortcode:e,orgSlug:r,projectSlug:t,uri:n=""}){return[e,r,t,n.replace(/^\//,"")].filter(Boolean).join("/")}exports.basename=basename,exports.deserializeSrn=deserializeSrn,exports.dirname=dirname,exports.extname=extname,exports.format=format,exports.isAbsolute=isAbsolute,exports.isURL=isURL,exports.join=join,exports.normalize=normalize,exports.parse=parse,exports.relative=relative,exports.resolve=resolve,exports.sep="/",exports.serializeSrn=serializeSrn,exports.startsWithWindowsDrive=startsWithWindowsDrive,exports.stripRoot=stripRoot,exports.toFSPath=normalize; | ||
"use strict";function format(r){let t="";return r.absolute&&("file"===r.protocol?(r.drive&&(t+=r.drive),t+="/"):(t+=r.protocol+"://",r.origin&&(t+=r.origin+"/"))),""===(t+=r.path.join("/"))&&(t="."),t}function peg$subclass(r,t){function e(){this.constructor=r}e.prototype=t.prototype,r.prototype=new e}function peg$SyntaxError(r,t,e,n){this.message=r,this.expected=t,this.found=e,this.location=n,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,peg$SyntaxError)}function peg$parse(r,t){t=void 0!==t?t:{};var e,n,o,a,i={},u={Path:rr},s=rr,l=function(r,t,e,n){return{protocol:r,origin:t,absolute:!0,...e,...n}},c=function(r,t,e){return{protocol:r,origin:t,absolute:!0,...e,path:[]}},p="http://",f=N("http://",!0),h=function(r){return"http"},g="https://",d=N("https://",!0),m=function(r){return"https"},x="",v=function(){return null},b=function(r,t,e){return{protocol:r,origin:null,absolute:!0,...t,...e}},y="file://",S=N("file://",!0),z="file:",w=N("file:",!0),A=function(r){return"file"},C=function(r,t){return{protocol:"file",origin:null,absolute:!0,...r,...t}},E=function(){return{drive:null}},$=/^[A-Za-z]/,j=Q([["A","Z"],["a","z"]],!1,!1),P=":",R=N(":",!1),F=function(r){return{drive:r.toLowerCase()+":"}},L=function(){return{drive:null}},B=function(r){return{protocol:null,origin:null,absolute:!1,drive:null,...r}},W=function(r){return{path:r}},M=function(r,t){return[r,...t]},U=function(r){return[r]},_=".",D=N(".",!1),O="/",k=N("/",!1),T="\\",Z=N("\\",!1),I=/^[^\/\\]/,q=Q(["/","\\"],!0,!1),G=0,H=[{line:1,column:1}],J=0,K=[];if("startRule"in t){if(!(t.startRule in u))throw new Error("Can't start parsing from rule \""+t.startRule+'".');s=u[t.startRule]}function N(r,t){return{type:"literal",text:r,ignoreCase:t}}function Q(r,t,e){return{type:"class",parts:r,inverted:t,ignoreCase:e}}function V(t){var e,n=H[t];if(n)return n;for(e=t-1;!H[e];)e--;for(n={line:(n=H[e]).line,column:n.column};e<t;)10===r.charCodeAt(e)?(n.line++,n.column=1):n.column++,e++;return H[t]=n,n}function X(r,t){var e=V(r),n=V(t);return{start:{offset:r,line:e.line,column:e.column},end:{offset:t,line:n.line,column:n.column}}}function Y(r){G<J||(G>J&&(J=G,K=[]),K.push(r))}function rr(){var t;return(t=function(){var r,t,e,n,o;r=G,(t=tr())!==i&&(e=er())!==i&&(n=or())!==i&&(o=ar())!==i?(t=l(t,e,n,o),r=t):(G=r,r=i);r===i&&(r=G,(t=tr())!==i&&(e=er())!==i&&(n=function(){var r;G,(r=x)!==i&&(r=L());return r}())!==i?(t=c(t,e,n),r=t):(G=r,r=i));return r}())===i&&(t=function(){var t,e,n,o;t=G,(e=function(){var t;return r.substr(G,7).toLowerCase()===y?(t=r.substr(G,7),G+=7):(t=i,Y(S)),t===i&&(r.substr(G,5).toLowerCase()===z?(t=r.substr(G,5),G+=5):(t=i,Y(w))),t!==i&&(t=A()),t}())!==i&&(n=nr())!==i&&(o=ar())!==i?(e=b(e,n,o),t=e):(G=t,t=i);return t}())===i&&(t=function(){var r,t,e;r=G,(t=nr())!==i&&(e=ar())!==i?(t=C(t,e),r=t):(G=r,r=i);return r}())===i&&(t=function(){var t,e,n;t=G,(e=function(){var t;return(t=function(){var t,e,n;return t=G,46===r.charCodeAt(G)?(e=_,G++):(e=i,Y(D)),e!==i&&(n=ur())!==i?t=e=[e,n]:(G=t,t=i),t}())===i&&(t=x),t}())!==i&&(n=ar())!==i?(e=B(n),t=e):(G=t,t=i);return t}()),t}function tr(){var t;return(t=function(){var t;G,r.substr(G,7).toLowerCase()===p?(t=r.substr(G,7),G+=7):(t=i,Y(f));t!==i&&(t=h());return t}())===i&&(t=function(){var t;G,r.substr(G,8).toLowerCase()===g?(t=r.substr(G,8),G+=8):(t=i,Y(d));t!==i&&(t=m());return t}()),t}function er(){var t,e,n;if(t=G,e=[],(n=sr())!==i)for(;n!==i;)e.push(n),n=sr();else e=i;return(t=e!==i?r.substring(t,G):e)===i&&(t=G,(e=x)!==i&&(e=v()),t=e),t}function nr(){var t;return(t=or())===i&&(t=function(){var t,e,n;t=G,$.test(r.charAt(G))?(e=r.charAt(G),G++):(e=i,Y(j));e!==i?(58===r.charCodeAt(G)?(n=P,G++):(n=i,Y(R)),n!==i&&ur()!==i?(e=F(e),t=e):(G=t,t=i)):(G=t,t=i);return t}()),t}function or(){var r;return G,(r=ur())!==i&&(r=E()),r}function ar(){var r;return G,(r=function r(){var t,e,n;t=G;e=ir();e!==i&&ur()!==i&&(n=r())!==i?(e=M(e,n),t=e):(G=t,t=i);t===i&&(t=G,(e=ir())!==i&&(e=U(e)),t=e);return t}())!==i&&(r=W(r)),r}function ir(){var t,e,n;if(t=G,e=[],(n=sr())!==i)for(;n!==i;)e.push(n),n=sr();else e=i;return(t=e!==i?r.substring(t,G):e)===i&&(t=x),t}function ur(){var t;return 47===r.charCodeAt(G)?(t=O,G++):(t=i,Y(k)),t===i&&(92===r.charCodeAt(G)?(t=T,G++):(t=i,Y(Z))),t}function sr(){var t;return I.test(r.charAt(G))?(t=r.charAt(G),G++):(t=i,Y(q)),t}if((e=s())!==i&&G===r.length)return e;throw e!==i&&G<r.length&&Y({type:"end"}),n=K,o=J<r.length?r.charAt(J):null,a=J<r.length?X(J,J+1):X(J,J),new peg$SyntaxError(peg$SyntaxError.buildMessage(n,o),n,o,a)}Object.defineProperty(exports,"__esModule",{value:!0}),peg$subclass(peg$SyntaxError,Error),peg$SyntaxError.buildMessage=function(r,t){var e={literal:function(r){return'"'+o(r.text)+'"'},class:function(r){var t,e="";for(t=0;t<r.parts.length;t++)e+=r.parts[t]instanceof Array?a(r.parts[t][0])+"-"+a(r.parts[t][1]):a(r.parts[t]);return"["+(r.inverted?"^":"")+e+"]"},any:function(r){return"any character"},end:function(r){return"end of input"},other:function(r){return r.description}};function n(r){return r.charCodeAt(0).toString(16).toUpperCase()}function o(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(r){return"\\x0"+n(r)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(r){return"\\x"+n(r)})}function a(r){return r.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(r){return"\\x0"+n(r)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(r){return"\\x"+n(r)})}return"Expected "+function(r){var t,n,o,a=new Array(r.length);for(t=0;t<r.length;t++)a[t]=(o=r[t],e[o.type](o));if(a.sort(),a.length>0){for(t=1,n=1;t<a.length;t++)a[t-1]!==a[t]&&(a[n]=a[t],n++);a.length=n}switch(a.length){case 1:return a[0];case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(r)+" but "+function(r){return r?'"'+o(r)+'"':"end of input"}(t)+" found."};var grammar={SyntaxError:peg$SyntaxError,parse:peg$parse},grammar_1=grammar.parse;function parse(r){if("string"!=typeof r)throw new Error(`@stoplight/path: Cannot parse ${r} because it is not a string`);return grammar_1(r,{})}function normalize(r){return format(normalizeParsed(parse(r)))}function normalizeParsed(r){let t=r.path;t=t.filter(r=>""!==r&&"."!==r);const e=[];for(const n of t)".."===n&&e.length&&".."!==e[e.length-1]?e.pop():".."===n&&r.absolute||e.push(n);return r.path=e,r}function parseBase(r){let t=r.lastIndexOf(".");".."===r&&(t=-1),"."===r&&(t=-1);let e=r,n="";return t>0&&(e=r.slice(0,t),n=r.slice(t)),{name:e,ext:n}}const basename=(r,t)=>{const e=normalizeParsed(parse(r)).path.pop();if(!e)return"";const{name:n,ext:o}=parseBase(e);return!0===t||t===o?n:`${n}${o}`},dirname=r=>{const t=normalizeParsed(parse(r));return t.path.pop(),format(normalizeParsed(t))},extname=r=>{const t=normalizeParsed(parse(r)).path.pop();if(!t)return"";const{ext:e}=parseBase(t);return e};function isAbsolute(r){return parse(r).absolute}function isURL(r){const t=parse(r);return"http"===t.protocol||"https"===t.protocol}const join=(...r)=>{if(0===r.length)return".";const t=r.map(parse),e=Object.assign({},t[0]);for(let n=1;n<t.length;n++){const o=t[n];if(o.absolute)throw new Error('Cannot join an absolute path "'+r[n]+'" in the middle of other paths.');for(const r of o.path)e.path.push(r)}return format(normalizeParsed(e))};function relative(r,t){const e=normalizeParsed(parse(t));if(!e.absolute)return format(e);const n=normalizeParsed(parse(r));if(e.origin!==n.origin)return format(e);if(!n.absolute)return format(e);if(n.drive!==e.drive)return format(e);const o=Math.min(n.path.length,e.path.length);for(let r=0;r<o&&n.path[0]===e.path[0];r++)n.path.shift(),e.path.shift();return e.path.unshift(...n.path.fill("..")),format({origin:null,drive:null,absolute:!1,protocol:null,path:e.path})}function resolve(...r){if(0===r.length)return".";const t=normalizeParsed(parse(r[r.length-1]));return t.absolute?format(t):join(...r)}const sep="/",startsWithWindowsDrive=r=>{return null!==parse(r).drive},stripRoot=r=>parse(r).path.filter(Boolean).join("/");function deserializeSrn(r){const[t,e,n,...o]=r.split("/"),a=o.length?`/${o.join("/")}`:void 0;let i,u;return a&&(i=o.find(r=>r.includes(".")))&&(u=parseBase(i).ext),{shortcode:t,orgSlug:e,projectSlug:n,uri:a,file:i,ext:u}}function serializeSrn({shortcode:r,orgSlug:t,projectSlug:e,uri:n=""}){return[r,t,e,n.replace(/^\//,"")].filter(Boolean).join("/")}exports.basename=basename,exports.deserializeSrn=deserializeSrn,exports.dirname=dirname,exports.extname=extname,exports.format=format,exports.isAbsolute=isAbsolute,exports.isURL=isURL,exports.join=join,exports.normalize=normalize,exports.parse=parse,exports.relative=relative,exports.resolve=resolve,exports.sep="/",exports.serializeSrn=serializeSrn,exports.startsWithWindowsDrive=startsWithWindowsDrive,exports.stripRoot=stripRoot,exports.toFSPath=normalize; |
@@ -1,1 +0,1 @@ | ||
function t(t){let e="";return t.absolute&&("file"===t.protocol?(t.drive&&(e+=t.drive),e+="/"):(e+=t.protocol+"://",t.origin&&(e+=t.origin+"/"))),""===(e+=t.path.join("/"))&&(e="."),e}function e(t,n,r,o){this.message=t,this.expected=n,this.found=r,this.location=o,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}!function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}(e,Error),e.buildMessage=function(t,e){var n={literal:function(t){return'"'+o(t.text)+'"'},class:function(t){var e,n="";for(e=0;e<t.parts.length;e++)n+=t.parts[e]instanceof Array?u(t.parts[e][0])+"-"+u(t.parts[e][1]):u(t.parts[e]);return"["+(t.inverted?"^":"")+n+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function r(t){return t.charCodeAt(0).toString(16).toUpperCase()}function o(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+r(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+r(t)})}function u(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+r(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+r(t)})}return"Expected "+function(t){var e,r,o,u=new Array(t.length);for(e=0;e<t.length;e++)u[e]=(o=t[e],n[o.type](o));if(u.sort(),u.length>0){for(e=1,r=1;e<u.length;e++)u[e-1]!==u[e]&&(u[r]=u[e],r++);u.length=r}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}(t)+" but "+function(t){return t?'"'+o(t)+'"':"end of input"}(e)+" found."};var n=function(t,n){n=void 0!==n?n:{};var r,o,u,a,l={},c={Path:0},i=0,s=[function(t,e,n,r){return{protocol:t,origin:e,absolute:!0,...n,...r}},function(t,e,n){return{protocol:t,origin:e,absolute:!0,...n,path:[]}},"http://",k("http://",!0),function(t){return"http"},"https://",k("https://",!0),function(t){return"https"},"",function(){return null},function(t,e,n){return{protocol:t,origin:null,absolute:!0,...e,...n}},"file://",k("file://",!0),"file:",k("file:",!0),function(t){return"file"},function(t,e){return{protocol:"file",origin:null,absolute:!0,...t,...e}},function(){return{drive:null}},/^[A-Za-z]/,x([["A","Z"],["a","z"]],!1,!1),":",k(":",!1),function(t){return{drive:t.toLowerCase()+":"}},function(){return{drive:null}},function(t){return{protocol:null,origin:null,absolute:!1,drive:null,...t}},function(t){return{path:t}},function(t,e){return[t,...e]},function(t){return[t]},".",k(".",!1),"/",k("/",!1),"\\",k("\\",!1),/^[^\/\\]/,x(["/","\\"],!0,!1)],p=[w(";!./ &;&.) &;(.# &;-"),w("%;\"/F#;%/=$;*/4$;./+$8$: $$#\"! )($'#(#'#(\"'#&'#.F &%;\"/<#;%/3$;,/*$8#:!##\"! )(#'#(\"'#&'#"),w(";#.# &;$"),w('%3"""5\'7#/\' 8!:$!! )'),w("%3%\"\"5(7&/' 8!:'!! )"),w('%$;5/�#*;5&&&#/"!&,).. &% (/& 8!:)! )'),w("%;'/<#;)/3$;./*$8#:*##\"! )(#'#(\"'#&'#"),w('%3+""5\'7,.) &3-""5%7./\' 8!:/!! )'),w('%;)/2#;./)$8":0""! )("\'#&\'#'),w(";*.# &;+"),w("%;4/& 8!:1! )"),w('%42""5!73/@#24""6475/1$;4/($8#:6#!")(#\'#("\'#&\'#'),w("% (/& 8!:7! )"),w('%;0/1#;./($8":8"! )("\'#&\'#'),w("%;//' 8!:9!! )"),w("%;1/;#;4/2$;//)$8#::#\"\" )(#'#(\"'#&'#./ &%;1/' 8!:;!! )"),w(";2.# &;3"),w('%$;5/�#*;5&&&#/"!&,).# & ('),w('%2<""6<7=/,#;4/#$+")("\'#&\'#'),w(" ("),w('2>""6>7?.) &2@""6@7A'),w('4B""5!7C')],h=0,f=[{line:1,column:1}],g=0,b=[],d=0;if("startRule"in n){if(!(n.startRule in c))throw new Error("Can't start parsing from rule \""+n.startRule+'".');i=c[n.startRule]}function k(t,e){return{type:"literal",text:t,ignoreCase:e}}function x(t,e,n){return{type:"class",parts:t,inverted:e,ignoreCase:n}}function $(e){var n,r=f[e];if(r)return r;for(n=e-1;!f[n];)n--;for(r={line:(r=f[n]).line,column:r.column};n<e;)10===t.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return f[e]=r,r}function v(t,e){var n=$(t),r=$(e);return{start:{offset:t,line:n.line,column:n.column},end:{offset:e,line:r.line,column:r.column}}}function m(t){h<g||(h>g&&(g=h,b=[]),b.push(t))}function w(t){var e,n=new Array(t.length);for(e=0;e<t.length;e++)n[e]=t.charCodeAt(e)-32;return n}if((r=function e(n){for(var r,o,u=p[n],a=0,c=[],i=u.length,f=[],g=[];;){for(;a<i;)switch(u[a]){case 0:g.push(s[u[a+1]]),a+=2;break;case 1:g.push(void 0),a++;break;case 2:g.push(null),a++;break;case 3:g.push(l),a++;break;case 4:g.push([]),a++;break;case 5:g.push(h),a++;break;case 6:g.pop(),a++;break;case 7:h=g.pop(),a++;break;case 8:g.length-=u[a+1],a+=2;break;case 9:g.splice(-2,1),a++;break;case 10:g[g.length-2].push(g.pop()),a++;break;case 11:g.push(g.splice(g.length-u[a+1],u[a+1])),a+=2;break;case 12:g.push(t.substring(g.pop(),h)),a++;break;case 13:f.push(i),c.push(a+3+u[a+1]+u[a+2]),g[g.length-1]?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 14:f.push(i),c.push(a+3+u[a+1]+u[a+2]),g[g.length-1]===l?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 15:f.push(i),c.push(a+3+u[a+1]+u[a+2]),g[g.length-1]!==l?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 16:g[g.length-1]!==l?(f.push(i),c.push(a),i=a+2+u[a+1],a+=2):a+=2+u[a+1];break;case 17:f.push(i),c.push(a+3+u[a+1]+u[a+2]),t.length>h?(i=a+3+u[a+1],a+=3):(i=a+3+u[a+1]+u[a+2],a+=3+u[a+1]);break;case 18:f.push(i),c.push(a+4+u[a+2]+u[a+3]),t.substr(h,s[u[a+1]].length)===s[u[a+1]]?(i=a+4+u[a+2],a+=4):(i=a+4+u[a+2]+u[a+3],a+=4+u[a+2]);break;case 19:f.push(i),c.push(a+4+u[a+2]+u[a+3]),t.substr(h,s[u[a+1]].length).toLowerCase()===s[u[a+1]]?(i=a+4+u[a+2],a+=4):(i=a+4+u[a+2]+u[a+3],a+=4+u[a+2]);break;case 20:f.push(i),c.push(a+4+u[a+2]+u[a+3]),s[u[a+1]].test(t.charAt(h))?(i=a+4+u[a+2],a+=4):(i=a+4+u[a+2]+u[a+3],a+=4+u[a+2]);break;case 21:g.push(t.substr(h,u[a+1])),h+=u[a+1],a+=2;break;case 22:g.push(s[u[a+1]]),h+=s[u[a+1]].length,a+=2;break;case 23:g.push(l),0===d&&m(s[u[a+1]]),a+=2;break;case 24:g[g.length-1-u[a+1]],a+=2;break;case 25:a++;break;case 26:for(r=u.slice(a+4,a+4+u[a+3]),o=0;o<u[a+3];o++)r[o]=g[g.length-1-r[o]];g.splice(g.length-u[a+2],u[a+2],s[u[a+1]].apply(null,r)),a+=4+u[a+3];break;case 27:g.push(e(u[a+1])),a+=2;break;case 28:d++,a++;break;case 29:d--,a++;break;default:throw new Error("Invalid opcode: "+u[a]+".")}if(!(f.length>0))break;i=f.pop(),a=c.pop()}return g[0]}(i))!==l&&h===t.length)return r;throw r!==l&&h<t.length&&m({type:"end"}),o=b,u=g<t.length?t.charAt(g):null,a=g<t.length?v(g,g+1):v(g,g),new e(e.buildMessage(o,u),o,u,a)};function r(t){if("string"!=typeof t)throw new Error(`@stoplight/path: Cannot parse ${t} because it is not a string`);return n(t,{})}function o(e){return t(u(r(e)))}function u(t){let e=t.path;e=e.filter(t=>""!==t&&"."!==t);const n=[];for(const r of e)".."===r&&n.length&&".."!==n[n.length-1]?n.pop():".."===r&&t.absolute||n.push(r);return t.path=n,t}function a(t){let e=t.lastIndexOf(".");".."===t&&(e=-1),"."===t&&(e=-1);let n=t,r="";return e>0&&(n=t.slice(0,e),r=t.slice(e)),{name:n,ext:r}}const l=(t,e)=>{const n=u(r(t)).path.pop();if(!n)return"";const{name:o,ext:l}=a(n);return!0===e||e===l?o:`${o}${l}`},c=e=>{const n=u(r(e));return n.path.pop(),t(u(n))},i=t=>{const e=u(r(t)).path.pop();if(!e)return"";const{ext:n}=a(e);return n};function s(t){return r(t).absolute}function p(t){const e=r(t);return"http"===e.protocol||"https"===e.protocol}const h=(...e)=>{if(0===e.length)return".";const n=e.map(r),o=Object.assign({},n[0]);for(let t=1;t<n.length;t++){const r=n[t];if(r.absolute)throw new Error('Cannot join an absolute path "'+e[t]+'" in the middle of other paths.');for(const t of r.path)o.path.push(t)}return t(u(o))};function f(e,n){const o=u(r(n));if(!o.absolute)return t(o);const a=u(r(e));if(o.origin!==a.origin)return t(o);if(!a.absolute)return t(o);if(a.drive!==o.drive)return t(o);const l=Math.min(a.path.length,o.path.length);for(let t=0;t<l&&a.path[0]===o.path[0];t++)a.path.shift(),o.path.shift();return o.path.unshift(...a.path.fill("..")),t({origin:null,drive:null,absolute:!1,protocol:null,path:o.path})}function g(...e){if(0===e.length)return".";const n=u(r(e[e.length-1]));return n.absolute?t(n):h(...e)}const b="/",d=t=>{return null!==r(t).drive},k=t=>r(t).path.filter(Boolean).join("/");function x(t){const[e,n,r,...o]=t.split("/"),u=o.length?`/${o.join("/")}`:void 0;let l,c;return u&&(l=o.find(t=>t.includes(".")))&&(c=a(l).ext),{shortcode:e,orgSlug:n,projectSlug:r,uri:u,file:l,ext:c}}function $({shortcode:t,orgSlug:e,projectSlug:n,uri:r=""}){return[t,e,n,r.replace(/^\//,"")].filter(Boolean).join("/")}export{l as basename,x as deserializeSrn,c as dirname,i as extname,t as format,s as isAbsolute,p as isURL,h as join,o as normalize,r as parse,f as relative,g as resolve,b as sep,$ as serializeSrn,d as startsWithWindowsDrive,k as stripRoot,o as toFSPath}; | ||
function t(t){let n="";return t.absolute&&("file"===t.protocol?(t.drive&&(n+=t.drive),n+="/"):(n+=t.protocol+"://",t.origin&&(n+=t.origin+"/"))),""===(n+=t.path.join("/"))&&(n="."),n}function n(t,r,e,o){this.message=t,this.expected=r,this.found=e,this.location=o,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,n)}!function(t,n){function r(){this.constructor=t}r.prototype=n.prototype,t.prototype=new r}(n,Error),n.buildMessage=function(t,n){var r={literal:function(t){return'"'+o(t.text)+'"'},class:function(t){var n,r="";for(n=0;n<t.parts.length;n++)r+=t.parts[n]instanceof Array?u(t.parts[n][0])+"-"+u(t.parts[n][1]):u(t.parts[n]);return"["+(t.inverted?"^":"")+r+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function e(t){return t.charCodeAt(0).toString(16).toUpperCase()}function o(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+e(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+e(t)})}function u(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+e(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+e(t)})}return"Expected "+function(t){var n,e,o,u=new Array(t.length);for(n=0;n<t.length;n++)u[n]=(o=t[n],r[o.type](o));if(u.sort(),u.length>0){for(n=1,e=1;n<u.length;n++)u[n-1]!==u[n]&&(u[e]=u[n],e++);u.length=e}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}(t)+" but "+function(t){return t?'"'+o(t)+'"':"end of input"}(n)+" found."};var r=function(t,r){r=void 0!==r?r:{};var e,o,u,i,c={},a={Path:nt},l=nt,s=function(t,n,r,e){return{protocol:t,origin:n,absolute:!0,...r,...e}},f=function(t,n,r){return{protocol:t,origin:n,absolute:!0,...r,path:[]}},p="http://",h=W("http://",!0),g=function(t){return"http"},v="https://",d=W("https://",!0),b=function(t){return"https"},x="",m=function(){return null},C=function(t,n,r){return{protocol:t,origin:null,absolute:!0,...n,...r}},w="file://",A=W("file://",!0),y="file:",j=W("file:",!0),F=function(t){return"file"},S=function(t,n){return{protocol:"file",origin:null,absolute:!0,...t,...n}},E=function(){return{drive:null}},L=/^[A-Za-z]/,R=X([["A","Z"],["a","z"]],!1,!1),$=":",M=W(":",!1),k=function(t){return{drive:t.toLowerCase()+":"}},z=function(){return{drive:null}},B=function(t){return{protocol:null,origin:null,absolute:!1,drive:null,...t}},O=function(t){return{path:t}},P=function(t,n){return[t,...n]},T=function(t){return[t]},Z=".",I=W(".",!1),U="/",q=W("/",!1),D="\\",G=W("\\",!1),H=/^[^\/\\]/,J=X(["/","\\"],!0,!1),K=0,N=[{line:1,column:1}],Q=0,V=[];if("startRule"in r){if(!(r.startRule in a))throw new Error("Can't start parsing from rule \""+r.startRule+'".');l=a[r.startRule]}function W(t,n){return{type:"literal",text:t,ignoreCase:n}}function X(t,n,r){return{type:"class",parts:t,inverted:n,ignoreCase:r}}function Y(n){var r,e=N[n];if(e)return e;for(r=n-1;!N[r];)r--;for(e={line:(e=N[r]).line,column:e.column};r<n;)10===t.charCodeAt(r)?(e.line++,e.column=1):e.column++,r++;return N[n]=e,e}function _(t,n){var r=Y(t),e=Y(n);return{start:{offset:t,line:r.line,column:r.column},end:{offset:n,line:e.line,column:e.column}}}function tt(t){K<Q||(K>Q&&(Q=K,V=[]),V.push(t))}function nt(){var n;return(n=function(){var t,n,r,e,o;return t=K,(n=rt())!==c&&(r=et())!==c&&(e=ut())!==c&&(o=it())!==c?(n=s(n,r,e,o),t=n):(K=t,t=c),t===c&&(t=K,(n=rt())!==c&&(r=et())!==c&&(e=function(){var t;return(t=x)!==c&&(t=z()),t}())!==c?(n=f(n,r,e),t=n):(K=t,t=c)),t}())===c&&(n=function(){var n,r,e,o;return n=K,(r=function(){var n;return t.substr(K,7).toLowerCase()===w?(n=t.substr(K,7),K+=7):(n=c,tt(A)),n===c&&(t.substr(K,5).toLowerCase()===y?(n=t.substr(K,5),K+=5):(n=c,tt(j))),n!==c&&(n=F()),n}())!==c&&(e=ot())!==c&&(o=it())!==c?(r=C(r,e,o),n=r):(K=n,n=c),n}())===c&&(n=function(){var t,n,r;return t=K,(n=ot())!==c&&(r=it())!==c?(n=S(n,r),t=n):(K=t,t=c),t}())===c&&(n=function(){var n,r,e;return n=K,(r=function(){var n;return(n=function(){var n,r,e;return n=K,46===t.charCodeAt(K)?(r=Z,K++):(r=c,tt(I)),r!==c&&(e=at())!==c?n=r=[r,e]:(K=n,n=c),n}())===c&&(n=x),n}())!==c&&(e=it())!==c?(r=B(e),n=r):(K=n,n=c),n}()),n}function rt(){var n,r;return t.substr(K,7).toLowerCase()===p?(r=t.substr(K,7),K+=7):(r=c,tt(h)),r!==c&&(r=g()),(n=r)===c&&(n=function(){var n;return t.substr(K,8).toLowerCase()===v?(n=t.substr(K,8),K+=8):(n=c,tt(d)),n!==c&&(n=b()),n}()),n}function et(){var n,r,e;if(n=K,r=[],(e=lt())!==c)for(;e!==c;)r.push(e),e=lt();else r=c;return(n=r!==c?t.substring(n,K):r)===c&&(n=K,(r=x)!==c&&(r=m()),n=r),n}function ot(){var n;return(n=ut())===c&&(n=function(){var n,r,e;return n=K,L.test(t.charAt(K))?(r=t.charAt(K),K++):(r=c,tt(R)),r!==c?(58===t.charCodeAt(K)?(e=$,K++):(e=c,tt(M)),e!==c&&at()!==c?(r=k(r),n=r):(K=n,n=c)):(K=n,n=c),n}()),n}function ut(){var t;return(t=at())!==c&&(t=E()),t}function it(){var t;return(t=function t(){var n,r,e;return n=K,(r=ct())!==c&&at()!==c&&(e=t())!==c?(r=P(r,e),n=r):(K=n,n=c),n===c&&(n=K,(r=ct())!==c&&(r=T(r)),n=r),n}())!==c&&(t=O(t)),t}function ct(){var n,r,e;if(n=K,r=[],(e=lt())!==c)for(;e!==c;)r.push(e),e=lt();else r=c;return(n=r!==c?t.substring(n,K):r)===c&&(n=x),n}function at(){var n;return 47===t.charCodeAt(K)?(n=U,K++):(n=c,tt(q)),n===c&&(92===t.charCodeAt(K)?(n=D,K++):(n=c,tt(G))),n}function lt(){var n;return H.test(t.charAt(K))?(n=t.charAt(K),K++):(n=c,tt(J)),n}if((e=l())!==c&&K===t.length)return e;throw e!==c&&K<t.length&&tt({type:"end"}),o=V,u=Q<t.length?t.charAt(Q):null,i=Q<t.length?_(Q,Q+1):_(Q,Q),new n(n.buildMessage(o,u),o,u,i)};function e(t){if("string"!=typeof t)throw new Error(`@stoplight/path: Cannot parse ${t} because it is not a string`);return r(t,{})}function o(n){return t(u(e(n)))}function u(t){let n=t.path;n=n.filter(t=>""!==t&&"."!==t);const r=[];for(const e of n)".."===e&&r.length&&".."!==r[r.length-1]?r.pop():".."===e&&t.absolute||r.push(e);return t.path=r,t}function i(t){let n=t.lastIndexOf(".");".."===t&&(n=-1),"."===t&&(n=-1);let r=t,e="";return n>0&&(r=t.slice(0,n),e=t.slice(n)),{name:r,ext:e}}const c=(t,n)=>{const r=u(e(t)).path.pop();if(!r)return"";const{name:o,ext:c}=i(r);return!0===n||n===c?o:`${o}${c}`},a=n=>{const r=u(e(n));return r.path.pop(),t(u(r))},l=t=>{const n=u(e(t)).path.pop();if(!n)return"";const{ext:r}=i(n);return r};function s(t){return e(t).absolute}function f(t){const n=e(t);return"http"===n.protocol||"https"===n.protocol}const p=(...n)=>{if(0===n.length)return".";const r=n.map(e),o=Object.assign({},r[0]);for(let t=1;t<r.length;t++){const e=r[t];if(e.absolute)throw new Error('Cannot join an absolute path "'+n[t]+'" in the middle of other paths.');for(const t of e.path)o.path.push(t)}return t(u(o))};function h(n,r){const o=u(e(r));if(!o.absolute)return t(o);const i=u(e(n));if(o.origin!==i.origin)return t(o);if(!i.absolute)return t(o);if(i.drive!==o.drive)return t(o);const c=Math.min(i.path.length,o.path.length);for(let t=0;t<c&&i.path[0]===o.path[0];t++)i.path.shift(),o.path.shift();return o.path.unshift(...i.path.fill("..")),t({origin:null,drive:null,absolute:!1,protocol:null,path:o.path})}function g(...n){if(0===n.length)return".";const r=u(e(n[n.length-1]));return r.absolute?t(r):p(...n)}const v="/",d=t=>{return null!==e(t).drive},b=t=>e(t).path.filter(Boolean).join("/");function x(t){const[n,r,e,...o]=t.split("/"),u=o.length?`/${o.join("/")}`:void 0;let c,a;return u&&(c=o.find(t=>t.includes(".")))&&(a=i(c).ext),{shortcode:n,orgSlug:r,projectSlug:e,uri:u,file:c,ext:a}}function m({shortcode:t,orgSlug:n,projectSlug:r,uri:e=""}){return[t,n,r,e.replace(/^\//,"")].filter(Boolean).join("/")}export{c as basename,x as deserializeSrn,a as dirname,l as extname,t as format,s as isAbsolute,f as isURL,p as join,o as normalize,e as parse,h as relative,g as resolve,v as sep,m as serializeSrn,d as startsWithWindowsDrive,b as stripRoot,o as toFSPath}; |
{ | ||
"name": "@stoplight/path", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31814
135