/
Alcatraz
/
Wagomon
Обзор
Документация
Войти
/
Alcatraz
/
Wagomon
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/prettier/plugins/babel.js
15 строк
319 KB
saitgalineu
fix
27 фев 2026, 12:39
27 фев 2026, 12:39
a5092f1
Код
Авторство
О чём код?
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.babel=e()}})(function(){"use strict";var Ti=Object.create;var be=Object.defineProperty;var bi=Object.getOwnPropertyDescriptor;var Ai=Object.getOwnPropertyNames;var Si=Object.getPrototypeOf,Ei=Object.prototype.hasOwnProperty;var Ci=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),Ue=(a,t)=>{for(var e in t)be(a,e,{get:t[e],enumerable:!0})},os=(a,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ai(t))!Ei.call(a,i)&&i!==e&&be(a,i,{get:()=>t[i],enumerable:!(s=bi(t,i))||s.enumerable});return a};var ls=(a,t,e)=>(e=a!=null?Ti(Si(a)):{},os(t||!a||!a.__esModule?be(e,"default",{value:a,enumerable:!0}):e,a)),wi=a=>os(be({},"__esModule",{value:!0}),a);var Tt=Ci(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});function Ii(a,t){if(a==null)return{};var e={};for(var s in a)if({}.hasOwnProperty.call(a,s)){if(t.indexOf(s)!==-1)continue;e[s]=a[s]}return e}var B=class{constructor(t,e,s){this.line=void 0,this.column=void 0,this.index=void 0,this.line=t,this.column=e,this.index=s}},se=class{constructor(t,e){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=t,this.end=e}};function D(a,t){let{line:e,column:s,index:i}=a;return new B(e,s+t,i+t)}var hs="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",Ni={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:hs},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:hs}},cs={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},Ee=a=>a.type==="UpdateExpression"?cs.UpdateExpression[`${a.prefix}`]:cs[a.type],ki={AccessorIsGenerator:({kind:a})=>`A ${a}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:a})=>`Missing initializer in ${a} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:a})=>`\`${a}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:a,exportName:t})=>`A string literal cannot be used as an exported binding without \`from\`. - Did you mean \`export { '${a}' as '${t}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:a})=>`'${a==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:a})=>`Unsyntactic ${a==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:a})=>`A string literal cannot be used as an imported binding. - Did you mean \`import { "${a}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument … [Строка слишком длинная. Вы можете скачать файл] `:`\r `):i=String.fromCharCode(s),++this.state.curLine,this.state.lineStart=this.state.pos,i}jsxReadString(e){let s="",i=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(p.Unterminat … [Строка слишком длинная. Вы можете скачать файл] `,++e,d===13&&t.charCodeAt(e)===10&&++e,++i,u=s=e):r.unterminated(n,o,l):++e}return{pos:e,str:h,firstInvalidLoc:c,lineStart:s,curLine:i,containsInvalid:!!c}}function gr(a,t,e,s){return a==="template"?t===96||t===36&&e.charCodeAt(s+1)===123:t===(a==="double"?34:39)}function Tr(a,t,e,s,i,r){let n=!i;t++;let o=h=>({pos:t,ch:h,lineStart:e,curLine:s}),l=a.charCodeAt(t++);switch(l){case 110:return o(` `);case 114:return o("\r");case 120:{let h;return{code:h,pos:t}=et(a,t,e,s,2,!1,n,r),o(h===null?null:String.fromCharCode(h))}case 117:{let h;return{code:h,pos:t}=Ms(a,t,e,s,n,r),o(h===null?null:String … [Строка слишком длинная. Вы можете скачать файл] `),cooked:r===null?null:r.slice(1,h)},o.tail=l,this.next();let u=this.finishNode(o,"TemplateElement");return this.resetEndLocation(u,D(this.state.lastTokEndLoc,h)),u}parseTemplate(t){let e=this.startN … [Строка слишком длинная. Вы можете скачать файл] `)return t-2;if(i===` `||i==="\r"||i==="\u2028"||i==="\u2029")return t-1}else{if(i==="\r"&&a.charAt(t+1)===` `)return t+2;if(i===` `||i==="\r"||i==="\u2028"||i==="\u2029")return t+1}return t}var Vs=Hr;function Kr(a,t){return t===!1?!1:a.charAt(t)==="/"&&a.charAt(t+1)==="/"?js(a,t):t}var qs=Kr;function Wr(a,t){let e=null,s=t;for(;s!==e;)e=s,s=Us(a,s),s=$s(a,s),s=qs(a,s),s=Vs(a,s);return s}var zs=Wr;function Jr(a){let t=[];for(let e of a)try{return e()}catch(s){t.push(s)}throw Object.assign(new Error("All combinations failed"),{errors:t})}var Hs=Jr;function Xr(a){if(!a.startsWith("#!"))return"";let t=a.indexOf(` `);return t===-1?a:a.slice(0,t)}var De=Xr;var Gr=(a,t,e)=>{if(!(a&&t==null)){if(t.findLast)return t.findLast(e);for(let s=t.length-1;s>=0;s--){let i=t[s];if(e(i,s,t))return i}}},Ks=Gr;var Yr=(a,t,e)=>{if(!(a&&t==null))return Array.isArray(t)||typeof t=="string"?t[e<0?t.length+e:e]:t.at(e)},Ws=Yr;var Qr=new Proxy(()=>{},{get:()=>Qr});function v(a){var s,i,r;let t=((s=a.range)==null?void 0:s[0])??a.start,e=(r=((i=a.declaration)==null?void 0:i.decorators)??a.decorators)==null?void 0:r[0];return e?Math.min(v(e),t):t}function k(a){var e;return((e=a.range)==null?void 0:e[1])??a.end}function Zr(a){let t=new Set(a);return e=>t.has(e==null?void 0:e.type)}var ae=Zr;function ea(a,t,e){let s=a.originalText.slice(t,e);for(let i of a[Symbol.for("comments")]){let r=v(i);if(r>e)break;let n=k(i);if(n<t)continue;let o=n-r;s=s.slice(0,r-t)+" ".repeat(o)+s.slice(n-t)}return s}var Js=ea;var ta=ae(["Block","CommentBlock","MultiLine"]),G=ta;var sa=ae(["Line","CommentLine","SingleLine","HashbangComment","HTMLOpen","HTMLClose","Hashbang","InterpreterDirective"]),bt=sa;var At=new WeakMap;function ia(a){return At.has(a)||At.set(a,G(a)&&a.value[0]==="*"&&/@(?:type|satisfies)\b/u.test(a.value)),At.get(a)}var Xs=ia;function ra(a){if(!G(a))return!1;let t=`*${a.value}*`.split(` `);return t.length>1&&t.every(e=>e.trimStart()[0]==="*")}var St=new WeakMap;function aa(a){return St.has(a)||St.set(a,ra(a)),St.get(a)}var Et=aa;function na(a){if(a.length<2)return;let t;for(let e=a.l … [Строка слишком длинная. Вы можете скачать файл] `;a=ne(!1,a.replace(ma,"").replace(da,""),ga,"$1");let e="";for(;e!==a;)e=a,a=ne(!1,a,Pa,`${t}$1 $2${t}`);a=a.replace(ai,"").trimEnd();let s=Object.create(null),i=ne(!1,a,ni,"").replace(ai,"").trimEnd(),r;for(;r=ni.exec(a);){let n=ne(!1,r[2],xa,"");if(typeof s[r[1]]=="string"||Array.isArray(s[r[1]])){let o=s[r[1]];s[r[1]]=[...Ta,...Array.isArray(o)?o:[o],n]}else s[r[1]]=n}return{comments:i,pragmas:s}}var hi=["noformat","noprettier"],ci=["format","prettier"];function pi(a){let t=De(a);t&&(a=a.slice(t.length+1));let e=oi(a),{pragmas:s,comments:i}=li(e);return{shebang:t,text:a,pragmas:s,comments:i}}function ui(a){let{pragmas:t}=pi(a);return ci.some(e=>Object.prototype.hasOwnProperty.call(t,e))}function fi(a){let{pragmas:t}=pi(a);return hi.some(e=>Object.prototype.hasOwnProperty.call(t,e))}function ba(a){return a=typeof a=="function"?{parse:a}:a,{astFormat:"estree",hasPragma:ui,hasIgnorePragma:fi,locStart:v,locEnd:k,...a}}var Y=ba;var Nt="module",kt="script";function di(a){if(typeof a=="string"){if(a=a.toLowerCase(),/\.(?:mjs|mts)$/iu.test(a))return Nt;if(/\.(?:cjs|cts)$/iu.test(a))return kt}}function Aa(a,t){let{type:e="JsExpressionRoot",rootMarker:s,text:i}=t,{tokens:r,comments:n}=a;return delete a.tokens,delete a.comments,{tokens:r,comments:n,type:e,node:a,range:[0,i.length],rootMarker:s}}var Fe=Aa;var oe=a=>Y(Ia(a)),Sa={sourceType:Nt,allowImportExportEverywhere:!0,allowReturnOutsideFunction:!0,allowNewTargetOutsideFunction:!0,allowSuperOutsideMethod:!0,allowUndeclaredExports:!0,errorRecovery:!0,createParenthesizedExpressions:!0,createImportExpressions:!0,attachComment:!1,plugins:["doExpressions","exportDefaultFrom","functionBind","functionSent","throwExpressions","partialApplication","decorators","moduleBlocks","asyncDoExpressions","destructuringPrivate","decoratorAutoAccessors","explicitResourceManagement","sourcePhaseImports","deferredImportEvaluation",["optionalChainingAssign",{version:"2023-07"}]],tokens:!1,ranges:!1},mi="v8intrinsic",yi=[["pipelineOperator",{proposal:"hack",topicToken:"%"}],["pipelineOperator",{proposal:"fsharp"}]],j=(a,t=Sa)=>({...t,plugins:[...t.plugins,...a]}),Ea=/@(?:no)?flow\b/u;function Ca(a,t){if(t!=null&&t.endsWith(".js.flow"))return!0;let e=De(a);e&&(a=a.slice(e.length));let s=zs(a,0);return s!==!1&&(a=a.slice(0,s)),Ea.test(a)}function wa(a,t,e){let s=a(t,e),i=s.errors.find(r=>!Na.has(r.reasonCode));if(i)throw i;return s}function Ia({isExpression:a=!1,optionsCombinations:t}){return(e,s={})=>{let{filepath:i}=s;if(typeof i!="string"&&(i=void 0),(s.parser==="babel"||s.parser==="__babel_estree")&&Ca(e,i))return s.parser="babel-flow",Pi.parse(e,s);let r=t,n=s.__babelSourceType??di(i);n===kt&&(r=r.map(c=>({...c,sourceType:n})));let o=/%[A-Z]/u.test(e);e.includes("|>")?r=(o?[...yi,mi]:yi).flatMap(u=>r.map(f=>j([u],f))):o&&(r=r.map(c=>j([mi],c)));let l=a?Be.parseExpression:Be.parse,h;try{h=Hs(r.map(c=>()=>wa(l,e,c)))}catch({errors:[c]}){throw Oe(c)}return a&&(h=Fe(h,{text:e,rootMarker:s.rootMarker})),ii(h,{text:e})}}var Na=new Set(["StrictNumericEscape","StrictWith","StrictOctalLiteral","StrictDelete","StrictEvalArguments","StrictEvalArgumentsBinding","StrictFunction","ForInOfLoopInitializer","EmptyTypeArguments","EmptyTypeParameters","ConstructorHasTypeParameters","UnsupportedParameterPropertyKind","DecoratorExportClass","ParamDupe","InvalidDecimal","RestTrailingComma","UnsupportedParameterDecorator","UnterminatedJsxContent","UnexpectedReservedWord","ModuleAttributesWithDuplicateKeys","InvalidEscapeSequenceTemplate","NonAbstractClassHasAbstractMethod","OptionalTypeBeforeRequired","PatternIsOptional","OptionalBindingPattern","DeclareClassFieldHasInitializer","TypeImportCannotSpecifyDefaultAndNamed","ConstructorClassField","VarRedeclaration","InvalidPrivateFieldResolution","DuplicateExport","ImportAttributesUseAssert","DeclarationMissingInitializer"]),xi=[j(["jsx"])],ka=oe({optionsCombinations:xi}),va=oe({optionsCombinations:[j(["jsx","typescript"]),j(["typescript"])]}),La=oe({isExpression:!0,optionsCombinations:[j(["jsx"])]}),Da=oe({isExpression:!0,optionsCombinations:[j(["typescript"])]}),Pi=oe({optionsCombinations:[j(["jsx",["flow",{all:!0}],"flowComments"])]}),Ma=oe({optionsCombinations:xi.map(a=>j(["estree"],a))});var Dt={};Ue(Dt,{json:()=>Ba,"json-stringify":()=>Ua,json5:()=>Ra,jsonc:()=>_a});var Re=ls(Tt(),1);function Oa(a){return Array.isArray(a)&&a.length>0}var Lt=Oa;var gi={tokens:!1,ranges:!1,attachComment:!1,createParenthesizedExpressions:!0};function Fa(a){let t=(0,Re.parse)(a,gi),{program:e}=t;if(e.body.length===0&&e.directives.length===0&&!e.interpreter)return t}function _e(a,t={}){let{allowComments:e=!0,allowEmpty:s=!1}=t,i;try{i=(0,Re.parseExpression)(a,gi)}catch(r){if(s&&r.code==="BABEL_PARSER_SYNTAX_ERROR"&&r.reasonCode==="ParseExpressionEmptyInput")try{i=Fa(a)}catch{}if(!i)throw Oe(r)}if(!e&&Lt(i.comments))throw K(i.comments[0],"Comment");return i=Fe(i,{type:"JsonRoot",text:a}),i.node.type==="File"?delete i.node:le(i.node),i}function K(a,t){let[e,s]=[a.loc.start,a.loc.end].map(({line:i,column:r})=>({line:i,column:r+1}));return Me(`${t} is not allowed in JSON.`,{loc:{start:e,end:s}})}function le(a){switch(a.type){case"ArrayExpression":for(let t of a.elements)t!==null&&le(t);return;case"ObjectExpression":for(let t of a.properties)le(t);return;case"ObjectProperty":if(a.computed)throw K(a.key,"Computed key");if(a.shorthand)throw K(a.key,"Shorthand property");a.key.type!=="Identifier"&&le(a.key),le(a.value);return;case"UnaryExpression":{let{operator:t,argument:e}=a;if(t!=="+"&&t!=="-")throw K(a,`Operator '${a.operator}'`);if(e.type==="NumericLiteral"||e.type==="Identifier"&&(e.name==="Infinity"||e.name==="NaN"))return;throw K(e,`Operator '${t}' before '${e.type}'`)}case"Identifier":if(a.name!=="Infinity"&&a.name!=="NaN"&&a.name!=="undefined")throw K(a,`Identifier '${a.name}'`);return;case"TemplateLiteral":if(Lt(a.expressions))throw K(a.expressions[0],"'TemplateLiteral' with expression");for(let t of a.quasis)le(t);return;case"NullLiteral":case"BooleanLiteral":case"NumericLiteral":case"StringLiteral":case"TemplateElement":return;default:throw K(a,`'${a.type}'`)}}var Ba=Y({parse:a=>_e(a),hasPragma:()=>!0,hasIgnorePragma:()=>!1}),Ra=Y(a=>_e(a)),_a=Y(a=>_e(a,{allowEmpty:!0})),Ua=Y({parse:a=>_e(a,{allowComments:!1}),astFormat:"estree-json"});var ja={...vt,...Dt};return wi($a);});