mirror of
https://github.com/github/codeql-action
synced 2026-05-29 05:00:55 +03:00
23 lines
229 KiB
JavaScript
23 lines
229 KiB
JavaScript
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).prettierPlugins=e.prettierPlugins||{},e.prettierPlugins.espree=t())}(this,(function(){"use strict";var e=function(e,t){const u=new SyntaxError(e+" ("+t.start.line+":"+t.start.column+")");return u.loc=t,u};var t=function(...e){let t;for(const[u,i]of e.entries())try{return{result:i()}}catch(e){0===u&&(t=e)}return{error:t}},u=e=>"string"==typeof e?e.replace((({onlyFirst:e=!1}={})=>{const t=["[\\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(t,e?void 0:"g")})(),""):e;const i=e=>!Number.isNaN(e)&&(e>=4352&&(e<=4447||9001===e||9002===e||11904<=e&&e<=12871&&12351!==e||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141));var r=i,n=i;r.default=n;const s=e=>{if("string"!=typeof e||0===e.length)return 0;if(0===(e=u(e)).length)return 0;e=e.replace(/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80
|
||
|
|
Print (to stderr) where a cursor at the given position would move to after formatting.
|
||
|
|
This option cannot be used with --range-start and --range-end.
|
||
|
|
`,cliCategory:_u},endOfLine:{since:"1.15.0",category:ku,type:"choice",default:[{since:"1.15.0",value:"auto"},{since:"2.0.0",value:"lf"}],description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:Tu`
|
||
|
|
Maintain existing
|
||
|
|
(mixed values within one file are normalised by looking at what's used after the first line)
|
||
|
|
`}]},filepath:{since:"1.4.0",category:Nu,type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:Iu,cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{since:"1.8.0",category:Nu,type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:Iu},parser:{since:"0.0.10",category:ku,type:"choice",default:[{since:"0.0.10",value:"babylon"},{since:"1.13.0",value:void 0}],description:"Which parser to use.",exception:e=>"string"==typeof e||"function"==typeof e,choices:[{value:"flow",description:"Flow"},{value:"babel",since:"1.16.0",description:"JavaScript"},{value:"babel-flow",since:"1.16.0",description:"Flow"},{value:"babel-ts",since:"2.0.0",description:"TypeScript"},{value:"typescript",since:"1.4.0",description:"TypeScript"},{value:"espree",since:"2.2.0",description:"JavaScript"},{value:"meriyah",since:"2.2.0",description:"JavaScript"},{value:"css",since:"1.7.1",description:"CSS"},{value:"less",since:"1.7.1",description:"Less"},{value:"scss",since:"1.7.1",description:"SCSS"},{value:"json",since:"1.5.0",description:"JSON"},{value:"json5",since:"1.13.0",description:"JSON5"},{value:"json-stringify",since:"1.13.0",description:"JSON.stringify"},{value:"graphql",since:"1.5.0",description:"GraphQL"},{value:"markdown",since:"1.8.0",description:"Markdown"},{value:"mdx",since:"1.15.0",description:"MDX"},{value:"vue",since:"1.10.0",description:"Vue"},{value:"yaml",since:"1.14.0",description:"YAML"},{value:"glimmer",since:"2.3.0",description:"Ember / Handlebars"},{value:"html",since:"1.15.0",description:"HTML"},{value:"angular",since:"1.15.0",description:"Angular"},{value:"lwc",since:"1.17.0",description:"Lightning Web Components"}]},plugins:{since:"1.10.0",type:"path",array:!0,default:[{value:[]}],category:ku,description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>"string"==typeof e||"object"==typeof e,cliName:"plugin",cliCategory:wu},pluginSearchDirs:{since:"1.13.0",type:"path",array:!0,default:[{value:[]}],category:ku,description:Tu`
|
||
|
|
Custom directory that contains prettier plugins in node_modules subdirectory.
|
||
|
|
Overrides default behavior when plugins are searched relatively to the location of Prettier.
|
||
|
|
Multiple values are accepted.
|
||
|
|
`,exception:e=>"string"==typeof e||"object"==typeof e,cliName:"plugin-search-dir",cliCategory:wu},printWidth:{since:"0.0.0",category:ku,type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:Number.POSITIVE_INFINITY,step:1}},rangeEnd:{since:"1.4.0",category:Nu,type:"int",default:Number.POSITIVE_INFINITY,range:{start:0,end:Number.POSITIVE_INFINITY,step:1},description:Tu`
|
||
|
|
Format code ending at a given character offset (exclusive).
|
||
|
|
The range will extend forwards to the end of the selected statement.
|
||
|
|
This option cannot be used with --cursor-offset.
|
||
|
|
`,cliCategory:_u},rangeStart:{since:"1.4.0",category:Nu,type:"int",default:0,range:{start:0,end:Number.POSITIVE_INFINITY,step:1},description:Tu`
|
||
|
|
Format code starting at a given character offset.
|
||
|
|
The range will extend backwards to the start of the first line containing the selected statement.
|
||
|
|
This option cannot be used with --cursor-offset.
|
||
|
|
`,cliCategory:_u},requirePragma:{since:"1.7.0",category:Nu,type:"boolean",default:!1,description:Tu`
|
||
|
|
Require either '@prettier' or '@format' to be present in the file's first docblock comment
|
||
|
|
in order for it to be formatted.
|
||
|
|
`,cliCategory:Iu},tabWidth:{type:"int",category:ku,default:2,description:"Number of spaces per indentation level.",range:{start:0,end:Number.POSITIVE_INFINITY,step:1}},useTabs:{since:"1.0.0",category:ku,type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{since:"2.1.0",category:ku,type:"choice",default:[{since:"2.1.0",value:"auto"}],description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};const Pu=["cliName","cliCategory","cliDescription"],Ou={compare:xu,lt:Bu,gte:vu},Ru=Su,ju={CATEGORY_CONFIG:wu,CATEGORY_EDITOR:_u,CATEGORY_FORMAT:"Format",CATEGORY_OTHER:Iu,CATEGORY_OUTPUT:"Output",CATEGORY_GLOBAL:ku,CATEGORY_SPECIAL:Nu,options:Lu}.options;var Mu={getSupportInfo:function({plugins:e=[],showUnreleased:t=!1,showDeprecated:u=!1,showInternal:i=!1}={}){const r=Ru.split("-",1)[0],n=e.flatMap((e=>e.languages||[])).filter(c),s=(a=Object.assign({},...e.map((({options:e})=>e)),ju),o="name",Object.entries(a).map((([e,t])=>Object.assign({[o]:e},t)))).filter((e=>c(e)&&p(e))).sort(((e,t)=>e.name===t.name?0:e.name<t.name?-1:1)).map((function(e){if(i)return e;return D(e,Pu)})).map((t=>{t=Object.assign({},t),Array.isArray(t.default)&&(t.default=1===t.default.length?t.default[0].value:t.default.filter(c).sort(((e,t)=>Ou.compare(t.since,e.since)))[0].value),Array.isArray(t.choices)&&(t.choices=t.choices.filter((e=>c(e)&&p(e))),"parser"===t.name&&function(e,t,u){const i=new Set(e.choices.map((e=>e.value)));for(const r of t)if(r.parsers)for(const t of r.parsers)if(!i.has(t)){i.add(t);const n=u.find((e=>e.parsers&&e.parsers[t]));let s=r.name;n&&n.name&&(s+=` (plugin: ${n.name})`),e.choices.push({value:t,description:s})}}(t,n,e));const u=Object.fromEntries(e.filter((e=>e.defaultOptions&&void 0!==e.defaultOptions[t.name])).map((e=>[e.name,e.defaultOptions[t.name]])));return Object.assign(Object.assign({},t),{},{pluginDefaults:u})}));var a,o;return{languages:n,options:s};function c(e){return t||!("since"in e)||e.since&&Ou.gte(r,e.since)}function p(e){return u||!("deprecated"in e)||e.deprecated&&Ou.lt(r,e.deprecated)}}};const{getSupportInfo:Vu}=Mu,Uu=/[^\x20-\x7F]/;function $u(e){return(t,u,i)=>{const r=i&&i.backwards;if(!1===u)return!1;const{length:n}=t;let s=u;for(;s>=0&&s<n;){const u=t.charAt(s);if(e instanceof RegExp){if(!e.test(u))return s}else if(!e.includes(u))return s;r?s--:s++}return(-1===s||s===n)&&s}}const Gu=$u(/\s/),Xu=$u(" \t"),qu=$u(",; \t"),Wu=$u(/[^\n\r]/);function Hu(e,t){if(!1===t)return!1;if("/"===e.charAt(t)&&"*"===e.charAt(t+1))for(let u=t+2;u<e.length;++u)if("*"===e.charAt(u)&&"/"===e.charAt(u+1))return u+2;return t}function Ju(e,t){return!1!==t&&("/"===e.charAt(t)&&"/"===e.charAt(t+1)?Wu(e,t):t)}function zu(e,t,u){const i=u&&u.backwards;if(!1===t)return!1;const r=e.charAt(t);if(i){if("\r"===e.charAt(t-1)&&"\n"===r)return t-2;if("\n"===r||"\r"===r||"\u2028"===r||"\u2029"===r)return t-1}else{if("\r"===r&&"\n"===e.charAt(t+1))return t+2;if("\n"===r||"\r"===r||"\u2028"===r||"\u2029"===r)return t+1}return t}function Ku(e,t,u={}){const i=Xu(e,u.backwards?t-1:t,u);return i!==zu(e,i,u)}function Qu(e,t){let u=null,i=t;for(;i!==u;)u=i,i=qu(e,i),i=Hu(e,i),i=Xu(e,i);return i=Ju(e,i),i=zu(e,i),!1!==i&&Ku(e,i)}function Yu(e,t){let u=null,i=t;for(;i!==u;)u=i,i=Xu(e,i),i=Hu(e,i),i=Ju(e,i),i=zu(e,i);return i}function Zu(e,t,u){return Yu(e,u(t))}function ei(e,t,u=0){let i=0;for(let r=u;r<e.length;++r)"\t"===e[r]?i=i+t-i%t:i++;return i}function ti(e,t){const u=e.slice(1,-1),i={quote:'"',regex:/"/g},r={quote:"'",regex:/'/g},n="'"===t?r:i,s=n===r?i:r;let a=n.quote;if(u.includes(n.quote)||u.includes(s.quote)){a=(u.match(n.regex)||[]).length>(u.match(s.regex)||[]).length?s.quote:n.quote}return a}function ui(e,t,u){const i='"'===t?"'":'"',r=e.replace(/\\(.)|(["'])/gs,((e,r,n)=>r===i?r:n===t?"\\"+n:n||(u&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(r)?r:"\\"+r)));return t+r+t}function ii(e,t){(e.comme
|