Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
1.5 MiB

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