humanify: Syntax Error on Babel?

image

file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14
`);return t.length>1&&t.every(e=>e.trimStart()[0]==="*")}var wt=wr;function Cr(a){return ge(a)&&a.value[0]==="*"&&/@(?:type|satisfies)\b/u.test(a.value)}var xs=Cr;var Te=null;function be(a){if(Te!==null&&typeof Te.property){let t=Te;return Te=be.prototype=null,t}return Te=be.prototype=a??Object.create(null),new be}var Er=10;for(let a=0;a<=Er;a++)be();function Ct(a){return be(a)}function Ir(a,t="type"){Ct(a);function e(s){let i=s[t],r=a[i];if(!Array.isArray(r))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:s});return r}return e}var Ps=Ir;var gs={ArrayExpression:["elements"],AssignmentExpression:["left","right"],BinaryExpression:["left","right"],InterpreterDirective:[],Directive:["value"],DirectiveLiteral:[],BlockStatement:["directives","body"],BreakStatement:["label"],CallExpression:["callee","arguments","typeParameters","typeArguments"],CatchClause:["param","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["test","body"],EmptyStatement:[],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","body","returnType","typeParameters","predicate"],FunctionExpression:["id","params","body","returnType","typeParameters"],Identifier:["typeAnnotation","decorators"],IfStatement:["test","consequent","alternate"],LabeledStatement:["label","body"],StringLiteral:[],NumericLiteral:[],NullLiteral:[],BooleanLiteral:[],RegExpLiteral:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],NewExpression:["callee","arguments","typeParameters","typeArguments"],Program:["directives","body"],ObjectExpression:["properties"],ObjectMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectProperty:["key","value","decorators"],RestElement:["argument","typeAnnotation","decorators"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ParenthesizedExpression:["expression"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],AssignmentPattern:["left","right","decorators","typeAnnotation"],ArrayPattern:["elements","typeAnnotation","decorators"],ArrowFunctionExpression:["params","body","returnType","typeParameters","predicate"],ClassBody:["body"],ClassExpression:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ClassDeclaration:["id","body","superClass","mixins","typeParameters","superTypeParameters","implements","decorators","superTypeArguments"],ExportAllDeclaration:["source","attributes","exported"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ForOfStatement:["left","right","body"],ImportDeclaration:["specifiers","source","attributes"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["local","imported"],ImportExpression:["source","options","attributes"],MetaProperty:["meta","property"],ClassMethod:["key","params","body","decorators","returnType","typeParameters"],ObjectPattern:["properties","typeAnnotation","decorators"],SpreadElement:["argument"],Super:[],TaggedTemplateExpression:["tag","quasi","typeParameters","typeArguments"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],YieldExpression:["argument"],AwaitExpression:["argument"],Import:[],BigIntLiteral:[],ExportNamespaceSpecifier:["exported"],OptionalMemberExpression:["object","property"],OptionalCallExpression:["callee","arguments","typeParameters","typeArguments"],ClassProperty:["key","value","typeAnnotation","decorators","variance"],ClassAccessorProperty:["key","value","typeAnnotation","decorators"],ClassPrivateProperty:["key","value","decorators","typeAnnotation","variance"],ClassPrivateMethod:["key","params","body","decorators","returnType","typeParameters"],PrivateName:["id"],StaticBlock:["body"],AnyTypeAnnotation:[],ArrayTypeAnnotation:["elementType"],BooleanTypeAnnotation:[],BooleanLiteralTypeAnnotation:[],NullLiteralTypeAnnotation:[],ClassImplements:["id","typeParameters"],DeclareClass:["id","typeParameters","extends","mixins","implements","body"],DeclareFunction:["id","predicate"],DeclareInterface:["id","typeParameters","extends","body"],DeclareModule:["id","body"],DeclareModuleExports:["typeAnnotation"],DeclareTypeAlias:["id","typeParameters","right"],DeclareOpaqueType:["id","typeParameters","supertype"],DeclareVariable:["id"],DeclareExportDeclaration:["declaration","specifiers","source"],DeclareExportAllDeclaration:["source"],DeclaredPredicate:["value"],ExistsTypeAnnotation:[],FunctionTypeAnnotation:["typeParameters","params","rest","returnType","this"],FunctionTypeParam:["name","typeAnnotation"],GenericTypeAnnotation:["id","typeParameters"],InferredPredicate:[],InterfaceExtends:["id","typeParameters"],InterfaceDeclaration:["id","typeParameters","extends","body"],InterfaceTypeAnnotation:["extends","body"],IntersectionTypeAnnotation:["types"],MixedTypeAnnotation:[],EmptyTypeAnnotation:[],NullableTypeAnnotation:["typeAnnotation"],NumberLiteralTypeAnnotation:[],NumberTypeAnnotation:[],ObjectTypeAnnotation:["properties","indexers","callProperties","internalSlots"],ObjectTypeInternalSlot:["id","value"],ObjectTypeCallProperty:["value"],ObjectTypeIndexer:["id","key","value","variance"],ObjectTypeProperty:["key","value","variance"],ObjectTypeSpreadProperty:["argument"],OpaqueType:["id","typeParameters","supertype","impltype"],QualifiedTypeIdentifier:["id","qualification"],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],SymbolTypeAnnotation:[],ThisTypeAnnotation:[],TupleTypeAnnotation:["types","elementTypes"],TypeofTypeAnnotation:["argument","typeArguments"],TypeAlias:["id","typeParameters","right"],TypeAnnotation:["typeAnnotation"],TypeCastExpression:["expression","typeAnnotation"],TypeParameter:["bound","default","variance"],TypeParameterDeclaration:["params"],TypeParameterInstantiation:["params"],UnionTypeAnnotation:["types"],Variance:[],VoidTypeAnnotation:[],EnumDeclaration:["id","body"],EnumBooleanBody:["members"],EnumNumberBody:["members"],EnumStringBody:["members"],EnumSymbolBody:["members"],EnumBooleanMember:["id","init"],EnumNumberMember:["id","init"],EnumStringMember:["id","init"],EnumDefaultedMember:["id"],IndexedAccessType:["objectType","indexType"],OptionalIndexedAccessType:["objectType","indexType"],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","children","closingElement"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXSpreadChild:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes","typeArguments","typeParameters"],JSXSpreadAttribute:["argument"],JSXText:[],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningFragment:[],JSXClosingFragment:[],Noop:[],Placeholder:[],V8IntrinsicIdentifier:[],ArgumentPlaceholder:[],BindExpression:["object","callee"],ImportAttribute:["key","value"],Decorator:["expression"],DoExpression:["body"],ExportDefaultSpecifier:["exported"],RecordExpression:["properties"],TupleExpression:["elements"],DecimalLiteral:[],ModuleExpression:["body"],TopicReference:[],PipelineTopicExpression:["expression"],PipelineBareFunction:["callee"],PipelinePrimaryTopicReference:[],TSParameterProperty:["parameter","decorators"],TSDeclareFunction:["id","typeParameters","params","returnType","body"],TSDeclareMethod:["decorators","key","typeParameters","params","returnType"],TSQualifiedName:["left","right"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation","params","returnType"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation","params","returnType"],TSIndexSignature:["parameters","typeAnnotation"],TSAnyKeyword:[],TSBooleanKeyword:[],TSBigIntKeyword:[],TSIntrinsicKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSFunctionType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSConstructorType:["typeParameters","parameters","typeAnnotation","params","returnType"],TSTypeReference:["typeName","typeParameters","typeArguments"],TSTypePredicate:["parameterName","typeAnnotation"],TSTypeQuery:["exprName","typeParameters","typeArguments"],TSTypeLiteral:["members"],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSNamedTupleMember:["label","elementType"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","typeAnnotation","nameType"],TSLiteralType:["literal"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSInstantiationExpression:["expression","typeParameters","typeArguments"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportType:["argument","qualifier","typeParameters","typeArguments"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSNonNullExpression:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterInstantiation:["params"],TSTypeParameterDeclaration:["params"],TSTypeParameter:["constraint","default","name"],ChainExpression:["expression"],ExperimentalRestProperty:["argument"],ExperimentalSpreadProperty:["argument"],Literal:[],MethodDefinition:["decorators","key","value"],PrivateIdentifier:[],Property:["key","value"],PropertyDefinition:["decorators","key","typeAnnotation","value","variance"],AccessorProperty:["decorators","key","typeAnnotation","value"],TSAbstractAccessorProperty:["decorators","key","typeAnnotation"],TSAbstractKeyword:[],TSAbstractMethodDefinition:["key","value"],TSAbstractPropertyDefinition:["decorators","key","typeAnnotation"],TSAsyncKeyword:[],TSClassImplements:["expression","typeArguments","typeParameters"],TSDeclareKeyword:[],TSEmptyBodyFunctionExpression:["id","typeParameters","params","returnType"],TSEnumBody:["members"],TSExportKeyword:[],TSInterfaceHeritage:["expression","typeArguments","typeParameters"],TSPrivateKeyword:[],TSProtectedKeyword:[],TSPublicKeyword:[],TSReadonlyKeyword:[],TSStaticKeyword:[],TSTemplateLiteralType:["quasis","types"],AsConstExpression:["expression"],AsExpression:["expression","typeAnnotation"],BigIntLiteralTypeAnnotation:[],BigIntTypeAnnotation:[],ComponentDeclaration:["id","params","body","typeParameters","rendersType"],ComponentParameter:["name","local"],ComponentTypeAnnotation:["params","rest","typeParameters","rendersType"],ComponentTypeParameter:["name","typeAnnotation"],ConditionalTypeAnnotation:["checkType","extendsType","trueType","falseType"],DeclareComponent:["id","params","rest","typeParameters","rendersType"],DeclareEnum:["id","body"],DeclareHook:["id"],DeclareNamespace:["id","body"],EnumBigIntBody:["members"],EnumBigIntMember:["id","init"],HookDeclaration:["id","params","body","typeParameters","returnType"],HookTypeAnnotation:["params","returnType","rest","typeParameters"],InferTypeAnnotation:["typeParameter"],KeyofTypeAnnotation:["argument"],ObjectTypeMappedTypeProperty:["keyTparam","propType","sourceType","variance"],QualifiedTypeofIdentifier:["qualification","id"],TupleTypeLabeledElement:["label","elementType","variance"],TupleTypeSpreadElement:["label","typeAnnotation"],TypeOperator:["typeAnnotation"],TypePredicate:["parameterName","typeAnnotation","asserts"],NGRoot:["node"],NGPipeExpression:["left","right","arguments"],NGChainedExpression:["expressions"],NGEmptyExpression:[],NGMicrosyntax:["body"],NGMicrosyntaxKey:[],NGMicrosyntaxExpression:["expression","alias"],NGMicrosyntaxKeyedExpression:["key","expression"],NGMicrosyntaxLet:["key","value"],NGMicrosyntaxAs:["key","alias"],JsExpressionRoot:["node"],JsonRoot:["node"],TSJSDocAllType:[],TSJSDocUnknownType:[],TSJSDocNullableType:["typeAnnotation"],TSJSDocNonNullableType:["typeAnnotation"],NeverTypeAnnotation:[],UndefinedTypeAnnotation:[],UnknownTypeAnnotation:[],SatisfiesExpression:["expression","typeAnnotation"]};var Nr=Ps(gs),Ts=Nr;function Et(a,t){if(!(a!==null&&typeof a=="object"))return a;if(Array.isArray(a)){for(let s=0;s<a.length;s++)a[s]=Et(a[s],t);return a}let e=Ts(a);for(let s=0;s<e.length;s++)a[e[s]]=Et(a[e[s]],t);return t(a)||a}var Fe=Et;function kr(a,t){let{parser:e,text:s}=t;if(a.type==="File"&&a.program.interpreter){let{program:{interpreter:i},comments:r}=a;delete a.program.interpreter,r.unshift(i);}if(e==="babel"){let i=new Set;a=Fe(a,r=>{var n;(n=r.leadingComments)!=null&&n.some(xs)&&i.add(D(r));}),a=Fe(a,r=>{if(r.type==="ParenthesizedExpression"){let{expression:n}=r;if(n.type==="TypeCastExpression")return n.range=[...r.range],n;let o=D(r);if(!i.has(o))return n.extra={...n.extra,parenthesized:!0},n}});}if(a=Fe(a,i=>{var r;switch(i.type){case"LogicalExpression":if(bs(i))return It(i);break;case"VariableDeclaration":{let n=St(!1,i.declarations,-1);n!=null&&n.init&&s[B(n)]!==";"&&(i.range=[D(i),B(n)]);break}case"TSParenthesizedType":return i.typeAnnotation;case"TSTypeParameter":if(typeof i.name=="string"){let n=D(i);i.name={type:"Identifier",name:i.name,range:[n,n+i.name.length]};}break;case"TopicReference":a.extra={...a.extra,__isUsingHackPipeline:!0};break;case"ExportAllDeclaration":if(e==="meriyah"&&((r=i.exported)==null?void 0:r.type)==="Identifier"){let{exported:n}=i,o=s.slice(D(n),B(n));(o.startsWith('"')||o.startsWith("'"))&&(i.exported={...i.exported,type:"Literal",value:i.exported.name,raw:o});}break;case"TSUnionType":case"TSIntersectionType":if(i.types.length===1)return i.types[0];break}}),Pe(a.comments)){let i=St(!1,a.comments,-1);for(let r=a.comments.length-2;r>=0;r--){let n=a.comments[r];B(n)===D(i)&&ge(n)&&ge(i)&&wt(n)&&wt(i)&&(a.comments.splice(r+1,1),n.value+="*//*"+i.value,n.range=[D(n),B(i)]),i=n;}}return a.type==="Program"&&(a.range=[0,s.length]),a}function bs(a){return a.type==="LogicalExpression"&&a.right.type==="LogicalExpression"&&a.operator===a.right.operator}function It(a){return bs(a)?It({type:"LogicalExpression",operator:a.operator,left:It({type:"LogicalExpression",operator:a.operator,left:a.left,right:a.right.left,range:[D(a.left),B(a.right.left)]}),right:a.right.right,range:[D(a),B(a)]}):a}var As=kr;function vr(a,t){let e=new SyntaxError(a+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(e,t)}var Be=vr;function Lr(a){let{message:t,loc:{line:e,column:s},reasonCode:i}=a,r=a;(i==="MissingPlugin"||i==="MissingOneOfPlugins")&&(t="Unexpected token.",r=void 0);let n=` (${e}:${s})`;return t.endsWith(n)&&(t=t.slice(0,-n.length)),Be(t,{loc:{start:{line:e,column:s+1}},cause:r})}var Re=Lr;var Dr=(a,t,e,s)=>{if(!(a&&t==null))return t.replaceAll?t.replaceAll(e,s):e.global?t.replace(e,s):t.split(e).join(s)},ie=Dr;var Mr=/\*\/$/,Or=/^\/\*\*?/,Fr=/^\s*(\/\*\*?(.|\r?\n)*?\*\/)/,Br=/(^|\s+)\/\/([^\n\r]*)/g,Ss=/^(\r?\n)+/,Rr=/(?:^|\r?\n) *(@[^\n\r]*?) *\r?\n *(?![^\n\r@]*\/\/[^]*)([^\s@][^\n\r@]+?) *\r?\n/g,ws=/(?:^|\r?\n) *@(\S+) *([^\n\r]*)/g,Ur=/(\r?\n|^) *\* ?/g,_r=[];function Cs(a){let t=a.match(Fr);return t?t[0].trimStart():""}function Es(a){let t=`





SyntaxError: Unexpected token, expected "," (1327:23)
  1325 |       return dataPointDetails;
  1326 |     }
> 1327 |     static Qp(_static calculateQualityParameter, qualityParameter) {
       |                       ^
  1328 |       let qualityCalculator = new InvestmentBalance();
  1329 |       var qualityParameterValue = _UtilityClass.J(_static calculateQualityParameter.d0, getPeWithEmptyStringUtil);
  1330 |       var qualityData = _UtilityClass.J(_static calculateQualityParameter.d1, getPeWithEmptyStringUtil);
    at vr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15472)
    at Lr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15798)
    at Object.parse (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:15:2885)
    at parse4 (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:21890:24)
    at async coreFormat (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:22343:7)
    at async formatWithCursor (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:22545:14)
    at async Object.format2 (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:23920:25)
    at async unminify (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:202:27)
    at async Command.<anonymous> (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:56797:3) {
  loc: { start: { line: 1327, column: 23 } },
  cause: SyntaxError: Unexpected token, expected "," (1327:22)
      at s (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:3:11485)
      at De.raise (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:5:19392)
      at De.unexpected (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:5:19754)
      at De.expect (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:5:24308)
      at De.parseBindingList (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:11470)
      at De.parseFunctionParams (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:31272)
      at De.parseMethod (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:4732)
      at De.pushClassMethod (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:36905)
      at De.parseClassMemberWithIsStatic (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:34345)
      at De.parseClassMember (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:33374)
      at file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:32547
      at De.withSmartMixTopicForbiddingContext (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:11378)
      at De.parseClassBody (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:32223)
      at De.parseClass (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:31668)
      at De.parseStatementContent (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:17039)
      at De.parseStatementLike (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:16403)
      at De.parseStatementListItem (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:16040)
      at De.parseBlockOrModuleBlockBody (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:28122)
      at De.parseBlockBody (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:27942)
      at De.parseBlock (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:27663)
      at De.parseFunctionBody (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:6109)
      at De.parseFunctionBodyAndFinish (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:5776)
      at file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:30909
      at De.withSmartMixTopicForbiddingContext (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:11378)
      at De.parseFunction (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:30864)
      at De.parseFunctionOrFunctionSent (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:96871)
      at De.parseExprAtom (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:92532)
      at De.parseExprAtom (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:5336)
      at De.parseExprSubscripts (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:86862)
      at De.parseUpdate (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:86489)
      at De.parseMaybeUnary (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:86123)
      at De.parseMaybeUnaryOrPrivate (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:83079)
      at De.parseExprOps (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:83177)
      at De.parseMaybeConditional (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:82683)
      at De.parseMaybeAssign (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:81947)
      at file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:81526
      at De.allowInAnd (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:8:11654)
      at De.parseMaybeAssignAllowIn (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:81506)
      at De.parseParenAndDistinguishExpression (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:99364)
      at De.parseExprAtom (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:92238)
      at De.parseExprAtom (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:5336)
      at De.parseExprSubscripts (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:86862)
      at De.parseUpdate (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:86489)
      at De.parseMaybeUnary (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:86123)
      at De.parseMaybeUnaryOrPrivate (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:83079)
      at De.parseExprOps (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:83177)
      at De.parseMaybeConditional (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:82683)
      at De.parseMaybeAssign (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:81947)
      at De.parseExpressionBase (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:81136)
      at file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:7:81056 {
    code: 'BABEL_PARSER_SYNTAX_ERROR',
    reasonCode: 'UnexpectedToken',
    loc: F { line: 1327, column: 22, index: 52743 },
    pos: 52743
  },
  codeFrame: '\x1B[0m \x1B[90m 1325 |\x1B[39m       \x1B[36mreturn\x1B[39m dataPointDetails\x1B[33m;\x1B[39m\n' +
    ' \x1B[90m 1326 |\x1B[39m     }\n' +
    '\x1B[31m\x1B[1m>\x1B[22m\x1B[39m\x1B[90m 1327 |\x1B[39m     \x1B[36mstatic\x1B[39m \x1B[33mQp\x1B[39m(_static calculateQualityParameter\x1B[33m,\x1B[39m qualityParameter) {\n' +
    ' \x1B[90m      |\x1B[39m                       \x1B[31m\x1B[1m^\x1B[22m\x1B[39m\n' +
    ' \x1B[90m 1328 |\x1B[39m       \x1B[36mlet\x1B[39m qualityCalculator \x1B[33m=\x1B[39m \x1B[36mnew\x1B[39m \x1B[33mInvestmentBalance\x1B[39m()\x1B[33m;\x1B[39m\n' +
    ' \x1B[90m 1329 |\x1B[39m       \x1B[36mvar\x1B[39m qualityParameterValue \x1B[33m=\x1B[39m _UtilityClass\x1B[33m.\x1B[39m\x1B[33mJ\x1B[39m(_static calculateQualityParameter\x1B[33m.\x1B[39md0\x1B[33m,\x1B[39m getPeWithEmptyStringUtil)\x1B[33m;\x1B[39m\n' +
    ' \x1B[90m 1330 |\x1B[39m       \x1B[36mvar\x1B[39m qualityData \x1B[33m=\x1B[39m _UtilityClass\x1B[33m.\x1B[39m\x1B[33mJ\x1B[39m(_static calculateQualityParameter\x1B[33m.\x1B[39md1\x1B[33m,\x1B[39m getPeWithEmptyStringUtil)\x1B[33m;\x1B[39m\x1B[0m'
}

Node.js v20.5.0

obfuscated.txt

It’s on OPENAI. Cant decode this file in OpenAI, cant on Gemini, local etc, nothing 😦

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 34 (15 by maintainers)

Most upvoted comments

verbose-log.txt

@Yusufkulcu Thanks for that verbose log, it seems to confirm that the bug is what I thought it might have been, with the LLM choosing an invalid variable name:

It looks like the problem is less that there should be a ,, and more that that something is adding the _static prefix to the variable where it presumably shouldn’t be. I can see that a lot of the function names have a static prefix; not sure if that ended up confusing the LLM when it was trying to come up with useful param renames or similar; but that is where I would start looking.

This is still my main theory though, particularly given the same _static calculateQualityParameter ‘variable name’ can be seen on lines 1327, 1329, 1330:

SyntaxError: Unexpected token, expected "," (1327:23)
  1325 |       return dataPointDetails;
  1326 |     }
> 1327 |     static Qp(_static calculateQualityParameter, qualityParameter) {
       |                       ^
  1328 |       let qualityCalculator = new InvestmentBalance();
  1329 |       var qualityParameterValue = _UtilityClass.J(_static calculateQualityParameter.d0, getPeWithEmptyStringUtil);
  1330 |       var qualityData = _UtilityClass.J(_static calculateQualityParameter.d1, getPeWithEmptyStringUtil);
    at vr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15472)
    at Lr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15798)

I haven’t looked deeply at the code that handles variable names returned from openai, but I am assuming OpenAI said to use static calculateQualityParameter as a variable name, and then humanify prefixed it with _; or similar based on something like this:

Originally posted by @0xdevalias in #117 (comment)

In the original code, the _0x3becc8 seems to only exist in that functions parameter + the usage of it within the function. That is the same for ___dataProcessor within my version. So my best guess is that with @Yusufkulcu’s version, the LLM must have chosen the invalid variable name _subscribeHandler.syncErrorThrown as a replacement or similar, but I can’t really validate that as the screenshots/output shown in this comment #111 (comment) seem to not mention what variable renames were being applied; which should have been shown in the output from openaiRename (Ref) (assuming they were running humanify openai, and not humanify local or similar?) Originally posted by @0xdevalias in #117 (comment)

While the context it’s showing doesn’t make a lot of sense to me as to where _0x53274b fits into it, we can see that the variable name chosen by the LLM was setChangeDetection.prototype.updateValue, which obviously isn’t valid for a single variable name:

[2024-09-27 18:56:10]  Renaming _0x53274b
[2024-09-27 18:56:10]  Context:  setChangeDetection.prototype.writeValue = function (initModules) {
    if (initModules % 1 !== initModules) {
      this.value = Math.round(initModules);
      this.preValue = initModules;
      this.changeDet
[2024-09-27 18:56:11]  Renamed to setChangeDetection.prototype.updateValue

I noticed that the syntax error appears in a different file every time. This is something I don’t understand.

@Yusufkulcu This is happening because the bug is related to the LLM suggesting an invalid variable name. Because the LLM can come up with different answers every time it’s run (related: #97), this is why the error ends up being in a different file each time.

I think I found the root issue: The LLM generates this.kLength as a name -> detected as invalid and changed to _this.kLength:

@j4k0xb Agreed, that’s the bug as I see it too. Thanks for pointing out the safeRenamed / isValidIdentifier part. I knew I read something about prefixing variables somewhere (eg. #8, #20), but hadn’t looked deeply into the code to figure out where that was happening.

The proper fix would be to use toIdentifier from @babel/types

@j4k0xb @jehna From a 2sec search I couldn’t find rendered docs, but here’s the relevant source for each:

toIdentifier definitely seems like a more robust approach than the current ‘prefix with _’ approach for sure.

Though I wonder if a ‘proper fix’ should also involve tweaking how we prompt for/filter the suggestions coming back from the LLM itself as well. Like instead of just forcing an invalid suggestion to be valid (with toIdentifier), we could detect that it’s invalid (with isValidIdentifier) and then provide that feedback to the LLM, asking it to give a new suggestion; probably with some max retry limit; after which we could fall back to using the invalid suggestion run through toIdentifier, or log a warning and leave it un-renamed or similar.

Looking at the release notes for 2.14.0, there is a line that talks about extracting sequences from for loops; I wonder if that would also fix this issue:

That’s a different type of for-loop. But I’d recommend updating either way because of other bugs 😅

@j4k0xb Haha, yeah, that’s fair enough. I didn’t look too deeply + we didn’t have a lot more information at the time so was just throwing out ideas/potentials 😅

Where should the “toIdentifier” function be used? I don’t fully understand the solution to the problem

@Yusufkulcu Basically on this line:

https://github.com/jehna/humanify/blob/64a1b9511d2e42b705df0858674eab1f5e83dd0d/src/plugins/local-llm-rename/visit-all-identifiers.ts#L44

Since toIdentifier calls isValidIdentifier within itself, the basic workaround change could be as simple as:

- let safeRenamed = isValidIdentifier(renamed) ? renamed : `_${renamed}`;
+ let safeRenamed = toIdentifier(renamed);

Gonna make a PR in a few minutes

@j4k0xb Thanks for making a PR with the workaround fix!

Will add some thoughts to it (though realistically they can probably be handled as a separate PR)

Thank you for your help, my problem has been solved

Though I wonder if a ‘proper fix’ should also involve tweaking how we prompt for/filter the suggestions coming back from the LLM itself as well.

Yeah there’s for sure a way to improve (also mentioned in other issues afaik) if you’re willing to do the work. That PR is just a quick fix to prevent crashing.

@j4k0xb

This fix seems to have worked, the files that previously gave errors are now progressing smoothly. I will inform you when the process is completed.

Gonna make a PR in a few minutes

I think I found the root issue:

The LLM generates this.kLength as a name -> detected as invalid and changed to _this.kLength: https://github.com/jehna/humanify/blob/64a1b9511d2e42b705df0858674eab1f5e83dd0d/src/plugins/local-llm-rename/visit-all-identifiers.ts#L44-L50

The proper fix would be to use toIdentifier from @babel/types

I noticed that the syntax error appears in a different file every time. This is something I don’t understand.

LLM use a random sampling technique

Looking at the release notes for 2.14.0, there is a line that talks about extracting sequences from for loops; I wonder if that would also fix this issue:

That’s a different type of for-loop. But I’d recommend updating either way because of other bugs 😅 edit: https://github.com/jehna/humanify/pull/38 it’s already the newest, just not in package.json for some reason

@0xdevalias I am also grateful for your detailed Explanations

@0xdevalias Yeees, it exactly looks like different error now, im crazy right now, doesnt matter how much I try, I cant really deobfuscate this file 😆 I will try when I came back to home and let u know then, ty

Thank you for the detailed issue! I’ll look into it. It seems that this line is indeed missing a ,:

static Qp(_static calculateQualityParameter, qualityParameter) {

Tha does seem super strange to me, as there should definitely not be a space there. I’ll have a look at it a bit later.

If you have time, could you also look at my problem, I would be very grateful https://github.com/jehna/humanify/issues/111

Thank you for the detailed issue! I’ll look into it. It seems that this line is indeed missing a ,:

static Qp(_static calculateQualityParameter, qualityParameter) {

Tha does seem super strange to me, as there should definitely not be a space there. I’ll have a look at it a bit later.

I have the same problem, but no clear solution has been found