webhook-action/node_modules/prettier/parser-flow.js

2 lines
1.7 MiB
JavaScript
Raw Normal View History

!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(((t=t||self).prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.flow={}))}(this,(function(t){var r=function(t,r){const e=new SyntaxError(t+" ("+r.start.line+":"+r.start.column+")");return e.loc=r,e};var e=function(t,r){if(!t.startsWith("#!"))return;const e=t.indexOf("\n"),n={type:"Line",value:t.slice(2,e),range:[0,e],loc:{start:{line:1,column:0},end:{line:1,column:e}}};r.comments=[n].concat(r.comments)};function n(t,r){return t(r={exports:{}},r.exports),r.exports}function u(t){return t&&t.default||t}var a=Object.freeze({__proto__:null,default:{EOL:"\n"}});const i=t=>{if("string"!=typeof t)throw new TypeError("Expected a string");const r=t.match(/(?:\r?\n)/g)||[];if(0===r.length)return;const e=r.filter(t=>"\r\n"===t).length;return e>r.length-e?"\r\n":"\n"};var f=i;f.graceful=t=>"string"==typeof t&&i(t)||"\n";var c,s=u(a),o=n((function(t,r){function e(){const t=s;return e=function(){return t},t}function n(){const t=(r=f)&&r.__esModule?r:{default:r};var r;return n=function(){return t},t}Object.defineProperty(r,"__esModule",{value:!0}),r.extract=function(t){const r=t.match(i);return r?r[0].trimLeft():""},r.strip=function(t){const r=t.match(i);return r&&r[0]?t.substring(r[0].length):t},r.parse=function(t){return D(t).pragmas},r.parseWithComments=D,r.print=function({comments:t="",pragmas:r={}}){const u=(0,n().default)(t)||e().EOL,a=Object.keys(r),i=a.map(t=>p(t,r[t])).reduce((t,r)=>t.concat(r),[]).map(t=>" * "+t+u).join("");if(!t){if(0===a.length)return"";if(1===a.length&&!Array.isArray(r[a[0]])){const t=r[a[0]];return"".concat("/**"," ").concat(p(a[0],t)[0]).concat(" */")}}const f=t.split(u).map(t=>"".concat(" *"," ").concat(t)).join(u)+u;return"/**"+u+(t?f:"")+(t&&a.length?" *"+u:"")+i+" */"};const u=/\*\/$/,a=/^\/\*\*/,i=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,c=/(^|\s+)\/\/([^\r\n]*)/g,o=/^(\r?\n)+/,v=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,l=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,b=/(\r?\n|^) *\* ?/g;function D(t){const r=(0,n().default)(t)||e().EOL;t=t.replace(a,"").replace(u,"").replace(b,"$1");let i="";for(;i!==t;)i=t,t=t.replace(v,"".concat(r,"$1 $2").concat(r));t=t.replace(o,"").trimRight();const f=Object.create(null),s=t.replace(l,"").replace(o,"").trimRight();let D;for(;D=l.exec(t);){const t=D[2].replace(c,"");"string"==typeof f[D[1]]||Array.isArray(f[D[1]])?f[D[1]]=[].concat(f[D[1]],t):f[D[1]]=t}return{comments:s,pragmas:f}}function p(t,r){return[].concat(r).map(r=>"@".concat(t," ").concat(r).trim())}}));(c=o)&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")&&c.default;o.extract,o.strip,o.parse,o.parseWithComments,o.print;var v={hasPragma:function(t){const r=Object.keys(o.parse(o.extract(t)));return r.includes("prettier")||r.includes("format")},insertPragma:function(t){const r=o.parseWithComments(o.extract(t)),e=Object.assign({format:""},r.pragmas),n=o.print({pragmas:e,comments:r.comments.replace(/^(\s+?\r?\n)+/,"")}).replace(/(\r\n|\r)/g,"\n"),u=o.strip(t);return n+(u.startsWith("\n")?"\n":"\n\n")+u}},l=t=>t[t.length-1];function b(t,r){return!(r=r||{}).ignoreDecorators&&t.declaration&&t.declaration.decorators&&t.declaration.decorators.length>0?b(t.declaration.decorators[0]):!r.ignoreDecorators&&t.decorators&&t.decorators.length>0?b(t.decorators[0]):t.__location?t.__location.startOffset:t.range?t.range[0]:"number"==typeof t.start?t.start:t.loc?t.loc.start:null}function D(t){const r=t.nodes&&l(t.nodes);if(r&&t.source&&!t.source.end&&(t=r),t.__location)return t.__location.endOffset;const e=t.range?t.range[1]:"number"==typeof t.end?t.end:null;return t.typeAnnotation?Math.max(e,D(t.typeAnnotation)):t.loc&&!e?t.loc.end:e}var p={locStart:b,locEnd:D,composeLoc:function(t,r=t){const e="number"==typeof r?r:-1,n=b(t),u=-1!==e?n+e:D(r),a=t.loc.start;return{start:n,end:u,range:[n,u],loc:{start:a,end:-1!==e?{line:a.line,column:a.column+e}:r.loc.end}}}},k=t=>"string"==typeof t?t.replace((({onlyFirst:t=!1}={})=>{const r=["[\\u001B\\u0