1 line
22 KiB
Plaintext
1 line
22 KiB
Plaintext
|
{"version":3,"names":["Definition","PatternVisitor","OriginalPatternVisitor","Referencer","OriginalReferencer","Scope","ScopeManager","require","getKeys","fallback","visitorKeysMap","getVisitorValues","nodeType","client","FLOW_FLIPPED_ALIAS_KEYS","VISITOR_KEYS","getTypesInfo","flowFlippedAliasKeys","concat","Object","entries","o","keys","map","k","reduce","acc","key","value","includes","propertyTypes","callProperties","type","values","indexers","properties","types","params","argument","elementType","qualification","rest","returnType","typeAnnotation","typeParameters","id","ArrayPattern","node","elements","forEach","visit","ObjectPattern","_client","WeakMap","constructor","options","scopeManager","_classPrivateFieldInitSpec","_classPrivateFieldSet","visitPattern","callback","_checkIdentifierOrVisit","left","processRightHandNodes","visitor","rightHandNodes","visitClass","_node$superTypeParame","_visitArray","decorators","typeParamScope","_nestTypeParamScope","_visitTypeAnnotation","implements","superTypeParameters","close","visitFunction","visitProperty","_node$value","InterfaceDeclaration","_createScopeVariable","extends","body","TypeAlias","right","ClassProperty","_visitClassProperty","ClassPrivateProperty","PropertyDefinition","ClassPrivateMethod","MethodDefinition","DeclareModule","_visitDeclareX","DeclareFunction","DeclareVariable","DeclareClass","OptionalMemberExpression","MemberExpression","computed","__nestClassFieldInitializerScope","__nestScope","__currentScope","name","currentScope","variableScope","__define","parentScope","scope","j","length","bind","Array","isArray","visitorValues","_classPrivateFieldGet","i","visitorValue","propertyType","nodeProperty","loopPropertyNode","l","nodeList","module","exports","analyzeScope","ast","parserOptions","_parserOptions$ecmaFe","ignoreEval","optimistic","directive","nodejsScope","sourceType","ecmaFeatures","globalReturn","impliedStrict","ecmaVersion","childVisitorKeys","getVisitorKeys","referencer"],"sources":["../src/analyze-scope.cts"],"sourcesContent":["import type { Client } from \"./client.cts\";\n\nconst {\n Definition,\n PatternVisitor: OriginalPatternVisitor,\n Referencer: OriginalReferencer,\n Scope,\n ScopeManager,\n} = (\n process.env.BABEL_8_BREAKING\n ? require(\"eslint-scope\")\n : require(\"@nicolo-ribaudo/eslint-scope-5-internals\")\n) as import(\"./types.cts\").Scope;\nconst { getKeys: fallback } = require(\"eslint-visitor-keys\");\n\nlet visitorKeysMap: Record<string, string[]>;\nfunction getVisitorValues(nodeType: string, client: Client) {\n if (visitorKeysMap) return visitorKeysMap[nodeType];\n\n const { FLOW_FLIPPED_ALIAS_KEYS, VISITOR_KEYS } = client.getTypesInfo();\n\n const flowFlippedAliasKeys = FLOW_FLIPPED_ALIAS_KEYS.concat([\n \"ArrayPattern\",\n \"ClassDeclaration\",\n \"ClassExpression\",\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"Identifier\",\n \"ObjectPattern\",\n \"RestElement\",\n ]);\n\n visitorKeysMap = Object.entries(VISITOR_KEYS).reduce((acc, [key, value]) => {\n if (!flowFlippedAliasKeys.includes(value)) {\n // @ts-expect-error FIXME: value is not assignable to type string[]\n acc[key] = value;\n }\n return acc;\n }, {});\n\n return visitorKeysMap[nodeType];\n}\n\nconst propertyTypes = {\n // loops\n callProperties: { type: \"loop\", values: [\"value\"] },\n indexers: { type: \"loop\", values: [\"key\", \"value\"] },\n properties: { type: \"loop\", values: [\"argument\", \"value\"] },\n types: { type: \"loop\" },\n params: { type: \"loop\" },\n // single property\n argument: { type: \"single\" },\n elementType: { type: \"single\" },\n qualification: { type: \"single\" },\n rest: { type: \"single\" },\n returnType: { type: \"single\" },\n // others\n typeAnnotation: { type: \"typeAnnotation\" },\n typeParameters: { type: \"typeParameters\" },\n id: { type: \"id\" },\n};\n\nclass PatternVisitor extends OriginalPatternVisitor {\n ArrayPattern(node: any) {\n node.elements.forEach(this.visit, this);\n }\n\n ObjectPattern(node: any) {\n no
|