2 lines
207 KiB
JavaScript
2 lines
207 KiB
JavaScript
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.babylon=e())}(this,function(){"use strict";var t=function(t,e){var s=new SyntaxError(t+" ("+e.start.line+":"+e.start.column+")");return s.loc=e,s};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function s(t,e){return t(e={exports:{}},e.exports),e.exports}var i=s(function(t){t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");var e=t.match(/(?:\r?\n)/g)||[];if(0===e.length)return null;var s=e.filter(function(t){return"\r\n"===t}).length;return s>e.length-s?"\r\n":"\n"},t.exports.graceful=function(e){return t.exports(e)||"\n"}}),r={EOL:"\n"},a=Object.freeze({default:r}),n=a&&r||a,o=s(function(t,e){var s,r;function a(){return s=(t=i)&&t.__esModule?t:{default:t};var t}function o(){return r=n}Object.defineProperty(e,"__esModule",{value:!0}),e.extract=function(t){var e=t.match(u);return e?e[0].trimLeft():""},e.strip=function(t){var e=t.match(u);return e&&e[0]?t.substring(e[0].length):t},e.parse=function(t){return y(t).pragmas},e.parseWithComments=y,e.print=function(t){var e=t.comments,i=void 0===e?"":e,n=t.pragmas,h=void 0===n?{}:n,p=(0,(s||a()).default)(i)||(r||o()).EOL,u=Object.keys(h),c=u.map(function(t){return D(t,h[t])}).reduce(function(t,e){return t.concat(e)},[]).map(function(t){return" * "+t+p}).join("");if(!i){if(0===u.length)return"";if(1===u.length&&!Array.isArray(h[u[0]])){var l=h[u[0]];return"".concat("/**"," ").concat(D(u[0],l)[0]).concat(" */")}}var d=i.split(p).map(function(t){return"".concat(" *"," ").concat(t)}).join(p)+p;return"/**"+p+(i?d:"")+(i&&u.length?" *"+p:"")+c+" */"};var h=/\*\/$/,p=/^\/\*\*/,u=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,c=/(^|\s+)\/\/([^\r\n]*)/g,l=/^(\r?\n)+/,d=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,f=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,m=/(\r?\n|^) *\* ?/g;function y(t){var e=(0,(s||a()).default)(t)||(r||o()).EOL;t=t.replace(p,"").replace(h,"").replace(m,"$1");for(var i="";i!==t;)i=t,t=t.replace(d,"".concat(e,"$1 $2").concat(e));t=t.replace(l,"").trimRight();for(var n,u=Object.create(null),y=t.replace(f,"").replace(l,"").trimRight();n=f.exec(t);){var D=n[2].replace(c,"");"string"==typeof u[n[1]]||Array.isArray(u[n[1]])?u[n[1]]=[].concat(u[n[1]],D):u[n[1]]=D}return{comments:y,pragmas:u}}function D(t,e){return[].concat(e).map(function(e){return"@".concat(t," ").concat(e).trim()})}});e(o);var h=function(t){var e=Object.keys(o.parse(o.extract(t)));return-1!==e.indexOf("prettier")||-1!==e.indexOf("format")},p=function(t){return t.length>0?t[t.length-1]:null};var u={locStart:function t(e,s){return!(s=s||{}).ignoreDecorators&&e.declaration&&e.declaration.decorators&&e.declaration.decorators.length>0?t(e.declaration.decorators[0]):!s.ignoreDecorators&&e.decorators&&e.decorators.length>0?t(e.decorators[0]):e.__location?e.__location.startOffset:e.range?e.range[0]:"number"==typeof e.start?e.start:e.loc?e.loc.start:null},locEnd:function t(e){var s=e.nodes&&p(e.nodes);if(s&&e.source&&!e.source.end&&(e=s),e.__location)return e.__location.endOffset;var i=e.range?e.range[1]:"number"==typeof e.end?e.end:null;return e.typeAnnotation?Math.max(i,t(e.typeAnnotation)):e.loc&&!i?e.loc.end:i}};function c(t){return(c="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 l=s(function(t){t.exports=function(t){t=Object.assign({onlyFirst:!1},t);var e=["[\\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(e,t.onlyFirst?void 0:"g")}}),d=s(function(t){t.exports=function(t){return!Number.isNaN(t)&&(t>=4352&&(t<=4447||9001===t||9002===t||11904<=t&&t<=12871&&12351!==t||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t
|