Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
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.
terminal-cv/node_modules/prettier/parser-typescript.js

23 lines
3.2 MiB

!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.typescript=t())}(this,(function(){"use strict";var e=function(e,t){const r=new SyntaxError(e+" ("+t.start.line+":"+t.start.column+")");return r.loc=t,r};var t,r=function(...e){let t;for(const[r,n]of e.entries())try{return{result:n()}}catch(e){0===r&&(t=e)}return{error:t}},n=void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function i(){if(void 0===t){var e=new ArrayBuffer(2),r=new Uint8Array(e),n=new Uint16Array(e);if(r[0]=1,r[1]=2,258===n[0])t="BE";else{if(513!==n[0])throw new Error("unable to figure out endianess");t="LE"}}return t}function a(){return void 0!==n.location?n.location.hostname:""}function o(){return[]}function s(){return 0}function c(){return Number.MAX_VALUE}function u(){return Number.MAX_VALUE}function l(){return[]}function _(){return"Browser"}function d(){return void 0!==n.navigator?n.navigator.appVersion:""}function p(){}function f(){}function g(){return"javascript"}function m(){return"browser"}function y(){return"/tmp"}var v=y,h={EOL:"\n",arch:g,platform:m,tmpdir:v,tmpDir:y,networkInterfaces:p,getNetworkInterfaces:f,release:d,type:_,cpus:l,totalmem:u,freemem:c,uptime:s,loadavg:o,hostname:a,endianness:i},D=Object.freeze({__proto__:null,endianness:i,hostname:a,loadavg:o,uptime:s,freemem:c,totalmem:u,cpus:l,type:_,release:d,networkInterfaces:p,getNetworkInterfaces:f,arch:g,platform:m,tmpDir:y,tmpdir:v,EOL:"\n",default:h});const b=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");const t=e.match(/(?:\r?\n)/g)||[];if(0===t.length)return;const r=t.filter((e=>"\r\n"===e)).length;return r>t.length-r?"\r\n":"\n"};var x=b;x.graceful=e=>"string"==typeof e&&b(e)||"\n";var S="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function C(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function E(e){var t={exports:{}};return e(t,t.exports),t.exports}var T=C(D),k=function(e){const t=e.match(L);return t?t[0].trimLeft():""},A=function(e){const t=e.match(L);return t&&t[0]?e.substring(t[0].length):e},F=function(e){return U(e).pragmas},N=U,P=function({comments:e="",pragmas:t={}}){const r=(0,I().default)(e)||w().EOL,n=" *",i=Object.keys(t),a=i.map((e=>V(e,t[e]))).reduce(((e,t)=>e.concat(t)),[]).map((e=>" * "+e+r)).join("");if(!e){if(0===i.length)return"";if(1===i.length&&!Array.isArray(t[i[0]])){const e=t[i[0]];return`/** ${V(i[0],e)[0]} */`}}const o=e.split(r).map((e=>` * ${e}`)).join(r)+r;return"/**"+r+(e?o:"")+(e&&i.length?n+r:"")+a+" */"};function w(){const e=T;return w=function(){return e},e}function I(){const e=(t=x)&&t.__esModule?t:{default:t};var t;return I=function(){return e},e}const O=/\*\/$/,M=/^\/\*\*/,L=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,R=/(^|\s+)\/\/([^\r\n]*)/g,B=/^(\r?\n)+/,j=/(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g,J=/(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g,K=/(\r?\n|^) *\* ?/g,z=[];function U(e){const t=(0,I().default)(e)||w().EOL;e=e.replace(M,"").replace(O,"").replace(K,"$1");let r="";for(;r!==e;)r=e,e=e.replace(j,`${t}$1 $2${t}`);e=e.replace(B,"").trimRight();const n=Object.create(null),i=e.replace(J,"").replace(B,"").trimRight();let a;for(;a=J.exec(e);){const e=a[2].replace(R,"");"string"==typeof n[a[1]]||Array.isArray(n[a[1]])?n[a[1]]=z.concat(n[a[1]],e):n[a[1]]=e}return{comments:i,pragmas:n}}function V(e,t){return z.concat(t).map((t=>`@${e} ${t}`.trim()))}var q=Object.defineProperty({extract:k,strip:A,parse:F,parseWithComments:N,print:P},"__esModule",{value:!0}),W=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 H=e=>!Number.isNa
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:bn},endOfLine:{since:"1.15.0",category:Sn,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:hn`
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:Cn,type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:xn,cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{since:"1.8.0",category:Cn,type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:xn},parser:{since:"0.0.10",category:Sn,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:Sn,description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>"string"==typeof e||"object"==typeof e,cliName:"plugin",cliCategory:Dn},pluginSearchDirs:{since:"1.13.0",type:"path",array:!0,default:[{value:[]}],category:Sn,description:hn`
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:Dn},printWidth:{since:"0.0.0",category:Sn,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:Cn,type:"int",default:Number.POSITIVE_INFINITY,range:{start:0,end:Number.POSITIVE_INFINITY,step:1},description:hn`
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:bn},rangeStart:{since:"1.4.0",category:Cn,type:"int",default:0,range:{start:0,end:Number.POSITIVE_INFINITY,step:1},description:hn`
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:bn},requirePragma:{since:"1.7.0",category:Cn,type:"boolean",default:!1,description:hn`
Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.
`,cliCategory:xn},tabWidth:{type:"int",category:Sn,default:2,description:"Number of spaces per indentation level.",range:{start:0,end:Number.POSITIVE_INFINITY,step:1}},useTabs:{since:"1.0.0",category:Sn,type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{since:"2.1.0",category:Sn,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 Tn=["cliName","cliCategory","cliDescription"],kn={compare:gn,lt:mn,gte:yn},An="2.4.1",Fn={CATEGORY_CONFIG:Dn,CATEGORY_EDITOR:bn,CATEGORY_FORMAT:"Format",CATEGORY_OTHER:xn,CATEGORY_OUTPUT:"Output",CATEGORY_GLOBAL:Sn,CATEGORY_SPECIAL:Cn,options:En}.options;var Nn={getSupportInfo:function({plugins:e=[],showUnreleased:t=!1,showDeprecated:r=!1,showInternal:n=!1}={}){const i=An.split("-",1)[0],a=e.flatMap((e=>e.languages||[])).filter(u),o=(s=Object.assign({},...e.map((({options:e})=>e)),Fn),c="name",Object.entries(s).map((([e,t])=>Object.assign({[c]:e},t)))).filter((e=>u(e)&&l(e))).sort(((e,t)=>e.name===t.name?0:e.name<t.name?-1:1)).map((function(e){if(n)return e;return te(e,Tn)})).map((t=>{t=Object.assign({},t),Array.isArray(t.default)&&(t.default=1===t.default.length?t.default[0].value:t.default.filter(u).sort(((e,t)=>kn.compare(t.since,e.since)))[0].value),Array.isArray(t.choices)&&(t.choices=t.choices.filter((e=>u(e)&&l(e))),"parser"===t.name&&function(e,t,r){const n=new Set(e.choices.map((e=>e.value)));for(const i of t)if(i.parsers)for(const t of i.parsers)if(!n.has(t)){n.add(t);const a=r.find((e=>e.parsers&&e.parsers[t]));let o=i.name;a&&a.name&&(o+=` (plugin: ${a.name})`),e.choices.push({value:t,description:o})}}(t,a,e));const r=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:r})}));var s,c;return{languages:a,options:o};function u(e){return t||!("since"in e)||e.since&&kn.gte(i,e.since)}function l(e){return r||!("deprecated"in e)||e.deprecated&&kn.lt(i,e.deprecated)}}};const{getSupportInfo:Pn}=Nn,wn=/[^\x20-\x7F]/;function In(e){return(t,r,n)=>{const i=n&&n.backwards;if(!1===r)return!1;const{length:a}=t;let o=r;for(;o>=0&&o<a;){const r=t.charAt(o);if(e instanceof RegExp){if(!e.test(r))return o}else if(!e.includes(r))return o;i?o--:o++}return(-1===o||o===a)&&o}}const On=In(/\s/),Mn=In(" \t"),Ln=In(",; \t"),Rn=In(/[^\n\r]/);function Bn(e,t){if(!1===t)return!1;if("/"===e.charAt(t)&&"*"===e.charAt(t+1))for(let r=t+2;r<e.length;++r)if("*"===e.charAt(r)&&"/"===e.charAt(r+1))return r+2;return t}function jn(e,t){return!1!==t&&("/"===e.charAt(t)&&"/"===e.charAt(t+1)?Rn(e,t):t)}function Jn(e,t,r){const n=r&&r.backwards;if(!1===t)return!1;const i=e.charAt(t);if(n){if("\r"===e.charAt(t-1)&&"\n"===i)return t-2;if("\n"===i||"\r"===i||"\u2028"===i||"\u2029"===i)return t-1}else{if("\r"===i&&"\n"===e.charAt(t+1))return t+2;if("\n"===i||"\r"===i||"\u2028"===i||"\u2029"===i)return t+1}return t}function Kn(e,t,r={}){const n=Mn(e,r.backwards?t-1:t,r);return n!==Jn(e,n,r)}function zn(e,t){let r=null,n=t;for(;n!==r;)r=n,n=Ln(e,n),n=Bn(e,n),n=Mn(e,n);return n=jn(e,n),n=Jn(e,n),!1!==n&&Kn(e,n)}function Un(e,t){let r=null,n=t;for(;n!==r;)r=n,n=Mn(e,n),n=Bn(e,n),n=jn(e,n),n=Jn(e,n);return n}function Vn(e,t,r){return Un(e,r(t))}function qn(e,t,r=0){let n=0;for(let i=r;i<e.length;++i)"\t"===e[i]?n=n+t-n%t:n++;return n}function Wn(e,t){const r=e.slice(1,-1),n={quote:'"',regex:/"/g},i={quote:"'",regex:/'/g},a="'"===t?i:n,o=a===i?n:i;let s=a.quote;if(r.includes(a.quote)||r.includes(o.quote)){s=(r.match(a.regex)||[]).length>(r.match(o.regex)||[]).length?o.quote:a.quote}return s}function Hn(e,t,r){const n='"'===t?"'":'"',i=e.replace(/\\(.)|(["'])/gs,((e,i,a)=>i===n?i:a===t?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(i)?i:"\\"+i)));return t+i+t}function Gn(e,t){(e