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