mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
2 lines
260 KiB
JavaScript
2 lines
260 KiB
JavaScript
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t=t||self).prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.babel={}))}(this,(function(t){"use strict";var e=function(t,e){const s=new SyntaxError(t+" ("+e.start.line+":"+e.start.column+")");return s.loc=e,s};function s(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t,e){return t(e={exports:{}},e.exports),e.exports}var r=Object.freeze({__proto__:null,default:{EOL:"\n"}});const a=t=>{if("string"!=typeof t)throw new TypeError("Expected a string");const e=t.match(/(?:\r?\n)/g)||[];if(0===e.length)return;const s=e.filter(t=>"\r\n"===t).length;return s>e.length-s?"\r\n":"\n"};var n=a;n.graceful=t=>"string"==typeof t&&a(t)||"\n";var o,h=(o=r)&&o.default||o,p=i((function(t,e){function s(){const t=h;return s=function(){return t},t}function i(){const t=(e=n)&&e.__esModule?e:{default:e};var e;return i=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),e.extract=function(t){const e=t.match(o);return e?e[0].trimLeft():""},e.strip=function(t){const e=t.match(o);return e&&e[0]?t.substring(e[0].length):t},e.parse=function(t){return m(t).pragmas},e.parseWithComments=m,e.print=function({comments:t="",pragmas:e={}}){const r=(0,i().default)(t)||s().EOL,a=Object.keys(e),n=a.map(t=>f(t,e[t])).reduce((t,e)=>t.concat(e),[]).map(t=>" * "+t+r).join("");if(!t){if(0===a.length)return"";if(1===a.length&&!Array.isArray(e[a[0]])){const t=e[a[0]];return"".concat("/**"," ").concat(f(a[0],t)[0]).concat(" */")}}const o=t.split(r).map(t=>"".concat(" *"," ").concat(t)).join(r)+r;return"/**"+r+(t?o:"")+(t&&a.length?" *"+r:"")+n+" */"};const r=/\*\/$/,a=/^\/\*\*/,o=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,p=/(^|\s+)\/\/([^\r\n]*)/g,c=/^(\r?\n)+/,u=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,l=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,d=/(\r?\n|^) *\* ?/g;function m(t){const e=(0,i().default)(t)||s().EOL;t=t.replace(a,"").replace(r,"").replace(d,"$1");let n="";for(;n!==t;)n=t,t=t.replace(u,"".concat(e,"$1 $2").concat(e));t=t.replace(c,"").trimRight();const o=Object.create(null),h=t.replace(l,"").replace(c,"").trimRight();let m;for(;m=l.exec(t);){const t=m[2].replace(p,"");"string"==typeof o[m[1]]||Array.isArray(o[m[1]])?o[m[1]]=[].concat(o[m[1]],t):o[m[1]]=t}return{comments:h,pragmas:o}}function f(t,e){return[].concat(e).map(e=>"@".concat(t," ").concat(e).trim())}}));s(p);p.extract,p.strip,p.parse,p.parseWithComments,p.print;var c={hasPragma:function(t){const e=Object.keys(p.parse(p.extract(t)));return e.includes("prettier")||e.includes("format")},insertPragma:function(t){const e=p.parseWithComments(p.extract(t)),s=Object.assign({format:""},e.pragmas),i=p.print({pragmas:s,comments:e.comments.replace(/^(\s+?\r?\n)+/,"")}).replace(/(\r\n|\r)/g,"\n"),r=p.strip(t);return i+(r.startsWith("\n")?"\n":"\n\n")+r}},u=t=>t[t.length-1];function l(t,e){return!(e=e||{}).ignoreDecorators&&t.declaration&&t.declaration.decorators&&t.declaration.decorators.length>0?l(t.declaration.decorators[0]):!e.ignoreDecorators&&t.decorators&&t.decorators.length>0?l(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 e=t.nodes&&u(t.nodes);if(e&&t.source&&!t.source.end&&(t=e),t.__location)return t.__location.endOffset;const s=t.range?t.range[1]:"number"==typeof t.end?t.end:null;return t.typeAnnotation?Math.max(s,d(t.typeAnnotation)):t.loc&&!s?t.loc.end:s}var m={locStart:l,locEnd:d,composeLoc:function(t,e=t){const s="number"==typeof e?e:-1,i=l(t),r=-1!==s?i+s:d(e),a=t.loc.start;return{start:i,end:r,range:[i,r],loc:{start:a,end:-1!==s?{line:a.line,column:a.column+s}:e.loc.end}}}},f=t=>"string"==typeof t?t.replace((({onlyFirst:t=!1}={})=>{const 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?void 0:"g")})(),""):
|