corsa-oxlint 0.35.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/checker.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createNodeMaps, toPosition } from "./node_map.js";
2
2
  import { sessionForContext } from "./registry.js";
3
+ import "./types.js";
3
4
  //#region src/bindings/nodejs/corsa_oxlint/ts/checker.ts
4
5
  function createProgram(context) {
5
6
  return {
@@ -44,6 +45,9 @@ function createTypeChecker(context) {
44
45
  getSymbolById(id) {
45
46
  return sessionForContext(context).session.getSymbol(id);
46
47
  },
48
+ getSymbolOfType(type) {
49
+ return sessionForContext(context).session.getSymbolOfType(type);
50
+ },
47
51
  getNode(node) {
48
52
  return sessionForContext(context).session.getNode(node);
49
53
  },
@@ -275,12 +279,47 @@ function implementedTypesFromSourceText(context, node, sourceText, checker) {
275
279
  end,
276
280
  range: [pos, end]
277
281
  };
278
- const symbol = checker.getSymbolAtLocation(lookupNode);
279
- const type = symbol ? checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol) : checker.getTypeAtLocation(lookupNode);
282
+ const nameNode = implementedClauseNameNode(lookupNode, raw);
283
+ const symbol = checker.getSymbolAtLocation(nameNode) ?? checker.getSymbolAtLocation(lookupNode);
284
+ const type = symbol ? checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol) : checker.getTypeAtLocation(nameNode) ?? checker.getTypeAtLocation(lookupNode);
280
285
  if (type) session.rememberTypeText(type.id, raw.slice(leading, raw.length - trailing));
281
286
  return type;
282
287
  }).filter((type) => type !== void 0);
283
288
  }
289
+ function implementedClauseNameNode(node, raw) {
290
+ const range = lastTypeNameIdentifierRange(raw);
291
+ if (!range) return node;
292
+ const pos = node.pos + range.start;
293
+ const end = node.pos + range.end;
294
+ return {
295
+ fileName: node.fileName,
296
+ pos,
297
+ end,
298
+ range: [pos, end]
299
+ };
300
+ }
301
+ function lastTypeNameIdentifierRange(text) {
302
+ let last;
303
+ const scanner = createScanner();
304
+ for (let index = 0; index < text.length; index += 1) {
305
+ const nextIndex = scanner.skip(text, index);
306
+ if (nextIndex > index) {
307
+ index = nextIndex - 1;
308
+ continue;
309
+ }
310
+ const char = text[index];
311
+ if (char === "<") break;
312
+ if (!isIdentifierStart(char)) continue;
313
+ let end = index + 1;
314
+ while (isIdentifierPart(text[end])) end += 1;
315
+ last = {
316
+ start: index,
317
+ end
318
+ };
319
+ index = end - 1;
320
+ }
321
+ return last;
322
+ }
284
323
  function findClassBodyOpen(text, start) {
285
324
  const scanner = createScanner();
286
325
  let angleDepth = 0;
@@ -322,7 +361,10 @@ function matchesKeyword(text, keyword, index) {
322
361
  return text.startsWith(keyword, index) && !isIdentifierPart(text[index - 1]) && !isIdentifierPart(text[index + keyword.length]);
323
362
  }
324
363
  function isIdentifierPart(char) {
325
- return char !== void 0 && /[A-Za-z0-9_$]/.test(char);
364
+ return char !== void 0 && (isIdentifierStart(char) || /[0-9]/.test(char));
365
+ }
366
+ function isIdentifierStart(char) {
367
+ return char !== void 0 && /[A-Za-z_$]/.test(char);
326
368
  }
327
369
  function splitTopLevelRanges(text, delimiter) {
328
370
  const ranges = [];
@@ -1 +1 @@
1
- {"version":3,"file":"checker.js","names":[],"sources":["../ts/checker.ts"],"sourcesContent":["import type { Node } from \"@oxlint/plugins\";\n\nimport { createNodeMaps, toPosition } from \"./node_map\";\nimport { sessionForContext } from \"./registry\";\nimport type {\n ContextWithParserOptions,\n CorsaNode,\n CorsaProgramShape,\n CorsaSignature,\n CorsaSymbol,\n CorsaType,\n CorsaTypeCheckerShape,\n} from \"./types\";\n\nexport function createProgram(\n context: ContextWithParserOptions,\n): CorsaProgramShape & { readonly nodeMaps: ReturnType<typeof createNodeMaps> } {\n const nodeMaps = createNodeMaps(context);\n return {\n nodeMaps,\n getCompilerOptions() {\n return sessionForContext(context).session.getCompilerOptions();\n },\n getCurrentDirectory() {\n return sessionForContext(context).project.rootDir;\n },\n getRootFileNames() {\n return sessionForContext(context).session.getRootFileNames();\n },\n getSourceFile(fileName = context.filename) {\n return { fileName, text: context.sourceCode.text };\n },\n getTypeChecker() {\n return createTypeChecker(context);\n },\n };\n}\n\nexport function createTypeChecker(context: ContextWithParserOptions): CorsaTypeCheckerShape {\n return {\n getTypeAtLocation(node) {\n if ((node as { readonly type?: string }).type === \"NewExpression\") {\n return typeOfNewExpression(node as Node, this);\n }\n const lookupNode = nodeForTypeLookup(node);\n return sessionForContext(context).session.getTypeAtSourceRange(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n endPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n nodeKind(lookupNode),\n );\n },\n getContextualType(node) {\n return this.getTypeAtLocation(node);\n },\n getSymbolAtLocation(node) {\n const lookupNode = nodeForTypeLookup(node);\n return sessionForContext(context).session.getSymbolAtPosition(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n );\n },\n getSymbol(symbol) {\n return sessionForContext(context).session.getSymbol(symbol);\n },\n getSymbolById(id) {\n return sessionForContext(context).session.getSymbol(id);\n },\n getNode(node) {\n return sessionForContext(context).session.getNode(node);\n },\n getNodeById(id) {\n return sessionForContext(context).session.getNode(id);\n },\n getTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getTypeOfSymbol(symbol);\n },\n getDeclaredTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getDeclaredTypeOfSymbol(symbol);\n },\n getTypeOfSymbolAtLocation(symbol, node) {\n return (\n this.getTypeOfSymbol(symbol) ??\n this.getDeclaredTypeOfSymbol(symbol) ??\n this.getTypeAtLocation(node)\n );\n },\n typeToString(type, enclosingDeclaration, flags) {\n void enclosingDeclaration;\n return sessionForContext(context).session.typeToString(type, flags);\n },\n getBaseTypeOfLiteralType(type) {\n return sessionForContext(context).session.getBaseTypeOfLiteralType(type);\n },\n getPropertiesOfType(type) {\n return sessionForContext(context).session.getPropertiesOfType(type);\n },\n getSignaturesOfType(type, kind) {\n return sessionForContext(context).session.getSignaturesOfType(type, kind);\n },\n getReturnTypeOfSignature(signature) {\n return sessionForContext(context).session.getReturnTypeOfSignature(signature);\n },\n getTypePredicateOfSignature(signature) {\n return sessionForContext(context).session.getTypePredicateOfSignature(signature);\n },\n getBaseTypes(type) {\n return sessionForContext(context).session.getBaseTypes(type);\n },\n getImplementedTypes(node) {\n if (\"pos\" in node) {\n return implementedTypesFromCorsaNode(context, node, this);\n }\n const sourceText = sourceTextFor(context, node);\n const sourceNode = sourceText ? corsaNodeFromEstree(context, node) : undefined;\n if (sourceText && sourceNode) {\n const implemented = implementedTypesFromSourceText(context, sourceNode, sourceText, this);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n return implementedClauseNodes(node)\n .map((clause) => {\n const expression = implementedClauseChildNode(clause, \"expression\") ?? clause;\n const symbol = this.getSymbolAtLocation(expression) ?? this.getSymbolAtLocation(clause);\n return symbol\n ? (this.getDeclaredTypeOfSymbol(symbol) ?? this.getTypeOfSymbol(symbol))\n : (this.getTypeAtLocation(expression) ?? this.getTypeAtLocation(clause));\n })\n .filter((type): type is CorsaType => type !== undefined);\n },\n getImplementedTypesOfType(type) {\n return implementedTypesFromTypeAndBases(context, type, this);\n },\n getTypeArguments(type) {\n return sessionForContext(context).session.getTypeArguments(type);\n },\n getTypesOfType(type) {\n return sessionForContext(context).session.getTypesOfType(type);\n },\n getTargetOfType(type) {\n return sessionForContext(context).session.getTargetOfType(type);\n },\n getTypeParametersOfType(type) {\n return sessionForContext(context).session.getTypeParametersOfType(type);\n },\n getOuterTypeParametersOfType(type) {\n return sessionForContext(context).session.getOuterTypeParametersOfType(type);\n },\n getLocalTypeParametersOfType(type) {\n return sessionForContext(context).session.getLocalTypeParametersOfType(type);\n },\n getObjectTypeOfType(type) {\n return sessionForContext(context).session.getObjectTypeOfType(type);\n },\n getIndexTypeOfType(type) {\n return sessionForContext(context).session.getIndexTypeOfType(type);\n },\n getCheckTypeOfType(type) {\n return sessionForContext(context).session.getCheckTypeOfType(type);\n },\n getExtendsTypeOfType(type) {\n return sessionForContext(context).session.getExtendsTypeOfType(type);\n },\n getBaseTypeOfType(type) {\n return sessionForContext(context).session.getBaseTypeOfType(type);\n },\n getConstraintOfType(type) {\n return sessionForContext(context).session.getConstraintOfType(type);\n },\n isUnionType(type) {\n return (type.flags & typeFlags.union) !== 0;\n },\n isIntersectionType(type) {\n return (type.flags & typeFlags.intersection) !== 0;\n },\n };\n}\n\nconst typeFlags = {\n union: 1 << 27,\n intersection: 1 << 28,\n} as const;\n\nfunction sourceTextFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string | undefined {\n return sourceTextForPath(context, filenameFor(context, node));\n}\n\nfunction sourceTextForPath(\n context: ContextWithParserOptions,\n fileName: string,\n): string | undefined {\n const normalizedFileName = fileName.toLowerCase();\n const normalizedContextFilename = context.filename.toLowerCase();\n return normalizedFileName === normalizedContextFilename ||\n normalizedFileName.endsWith(normalizedContextFilename) ||\n normalizedContextFilename.endsWith(normalizedFileName)\n ? context.sourceCode.text\n : sessionForContext(context).session.getSourceTextForPath(fileName);\n}\n\nfunction typeOfNewExpression(node: Node, checker: CorsaTypeCheckerShape): CorsaType | undefined {\n const callee = childNode(node, \"callee\");\n if (!callee) {\n return undefined;\n }\n const calleeType = checker.getTypeAtLocation(callee);\n if (!calleeType) {\n return undefined;\n }\n const constructSignature = checker.getSignaturesOfType(calleeType, 1)[0];\n return constructSignature\n ? (checker.getReturnTypeOfSignature(constructSignature) ?? calleeType)\n : calleeType;\n}\n\nfunction nodeForTypeLookup(node: Node | CorsaNode): Node | CorsaNode {\n if (\"pos\" in node) {\n return node;\n }\n switch ((node as { readonly type?: string }).type) {\n case \"ClassDeclaration\":\n case \"ClassExpression\":\n return childNode(node, \"id\") ?? node;\n case \"TSPropertySignature\":\n return childNode(node, \"key\") ?? node;\n default:\n return node;\n }\n}\n\nfunction endPosition(node: Node | CorsaNode): number {\n if (\"end\" in node) {\n return node.end;\n }\n const range = (node as Node & { readonly range?: readonly [number, number] }).range;\n if (!range) {\n throw new Error(\"corsa oxlint requires ESTree nodes with range data\");\n }\n return range[1];\n}\n\nfunction nodeKind(node: Node | CorsaNode): string | undefined {\n return \"pos\" in node ? undefined : (node as { readonly type?: string }).type;\n}\n\nfunction childNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedClauseNodes(node: Node | CorsaNode): readonly Node[] {\n if (\"pos\" in node) {\n return [];\n }\n const clauses = (node as unknown as { readonly implements?: unknown }).implements;\n if (!Array.isArray(clauses)) {\n return [];\n }\n return clauses.filter(isNode);\n}\n\nfunction implementedClauseChildNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedTypesFromCorsaNode(\n context: ContextWithParserOptions,\n node: CorsaNode,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const symbol = checker.getSymbolAtLocation(node);\n if (symbol) {\n const declaredType = checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol);\n if (declaredType) {\n const implemented = checker.getImplementedTypesOfType(declaredType);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n }\n const sourceText = sourceTextFor(context, node);\n if (sourceText) {\n return implementedTypesFromSourceText(context, node, sourceText, checker);\n }\n const type = checker.getTypeAtLocation(node);\n return type ? checker.getImplementedTypesOfType(type) : [];\n}\n\nfunction corsaNodeFromEstree(context: ContextWithParserOptions, node: Node): CorsaNode | undefined {\n const range = (node as { readonly range?: unknown }).range;\n if (\n !Array.isArray(range) ||\n range.length < 2 ||\n typeof range[0] !== \"number\" ||\n typeof range[1] !== \"number\"\n ) {\n return undefined;\n }\n return {\n fileName: context.filename,\n pos: range[0],\n end: range[1],\n range: [range[0], range[1]] as const,\n };\n}\n\nfunction implementedTypesFromTypeAndBases(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n // Iterative DFS over the base chain so we don't pay for one closure call\n // and one `push(...subResult)` spread per base (each spread used to copy\n // the entire growing accumulator). Visit order doesn't matter because we\n // dedupe by `type.id`.\n const seenTypes = new Set<string>();\n const seenImplementedTypes = new Set<string>();\n const implemented: CorsaType[] = [];\n const stack: CorsaType[] = [type];\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (seenTypes.has(current.id)) {\n continue;\n }\n seenTypes.add(current.id);\n\n const ownImplemented = implementedTypesFromTypeDeclaration(context, current, checker);\n for (let index = 0; index < ownImplemented.length; index += 1) {\n const ownType = ownImplemented[index]!;\n if (seenImplementedTypes.has(ownType.id)) {\n continue;\n }\n seenImplementedTypes.add(ownType.id);\n implemented.push(ownType);\n }\n\n const bases = checker.getBaseTypes(current);\n // Push in reverse so the natural visit order matches the recursive form.\n for (let index = bases.length - 1; index >= 0; index -= 1) {\n const baseType = bases[index]!;\n if (seenTypes.has(baseType.id)) {\n continue;\n }\n stack.push(baseType);\n }\n }\n return implemented;\n}\n\nfunction implementedTypesFromTypeDeclaration(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const session = sessionForContext(context).session;\n const symbol = type.symbol ? session.getSymbol(type.symbol) : undefined;\n const declaration = symbol?.valueDeclaration ?? symbol?.declarations?.[0];\n const declarationNode = declaration ? session.getNode(declaration) : undefined;\n const sourceText = declarationNode\n ? sourceTextForPath(context, declarationNode.fileName)\n : undefined;\n return declarationNode && sourceText\n ? implementedTypesFromSourceText(context, declarationNode, sourceText, checker)\n : [];\n}\n\nfunction implementedTypesFromSourceText(\n context: ContextWithParserOptions,\n node: CorsaNode,\n sourceText: string,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n if (node.pos < 0 || node.end > sourceText.length || node.pos >= node.end) {\n return [];\n }\n const classText = sourceText.slice(node.pos, node.end);\n const classStart = findKeywordOutsideTrivia(classText, \"class\");\n const headerStart = classStart >= 0 ? classStart : 0;\n const bodyOpen = findClassBodyOpen(classText, headerStart);\n const headerText = classText.slice(headerStart, bodyOpen >= 0 ? bodyOpen : classText.length);\n const implementsIndex = findKeywordOutsideTrivia(headerText, \"implements\");\n if (implementsIndex < 0) {\n return [];\n }\n const session = sessionForContext(context).session;\n const clauseText = headerText.slice(implementsIndex + \"implements\".length);\n const clauseStart = node.pos + headerStart + implementsIndex + \"implements\".length;\n return splitTopLevelRanges(clauseText, \",\")\n .map((range) => {\n const raw = clauseText.slice(range.start, range.end);\n const leading = raw.search(/\\S/);\n if (leading < 0) {\n return undefined;\n }\n const trailing = raw.match(/\\s*$/)?.[0].length ?? 0;\n const pos = clauseStart + range.start + leading;\n const end = clauseStart + range.end - trailing;\n const lookupNode: CorsaNode = {\n fileName: node.fileName,\n pos,\n end,\n range: [pos, end] as const,\n };\n const symbol = checker.getSymbolAtLocation(lookupNode);\n const type = symbol\n ? (checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol))\n : checker.getTypeAtLocation(lookupNode);\n if (type) {\n // Implemented-interface handles come back with empty `texts`, so warm\n // the type-text cache with the `implements` identifier. If upstream\n // later evicts the handle, `typeToString` falls back to this name\n // instead of throwing (GH#211).\n session.rememberTypeText(type.id, raw.slice(leading, raw.length - trailing));\n }\n return type;\n })\n .filter((type): type is CorsaType => type !== undefined);\n}\n\nfunction findClassBodyOpen(text: string, start: number): number {\n const scanner = createScanner();\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = start; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n const char = text[index];\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (\n char === \"{\" &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n return index;\n } else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n }\n return -1;\n}\n\nfunction findKeywordOutsideTrivia(text: string, keyword: string): number {\n const scanner = createScanner();\n for (let index = 0; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (matchesKeyword(text, keyword, index)) {\n return index;\n }\n }\n return -1;\n}\n\nfunction matchesKeyword(text: string, keyword: string, index: number): boolean {\n return (\n text.startsWith(keyword, index) &&\n !isIdentifierPart(text[index - 1]) &&\n !isIdentifierPart(text[index + keyword.length])\n );\n}\n\nfunction isIdentifierPart(char: string | undefined): boolean {\n return char !== undefined && /[A-Za-z0-9_$]/.test(char);\n}\n\nfunction splitTopLevelRanges(\n text: string,\n delimiter: string,\n): readonly { readonly start: number; readonly end: number }[] {\n const ranges: { start: number; end: number }[] = [];\n const scanner = createScanner();\n let start = 0;\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n char === delimiter &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n ranges.push({ start, end: index });\n start = index + 1;\n }\n }\n ranges.push({ start, end: text.length });\n return ranges;\n}\n\nfunction createScanner(): {\n skip(text: string, index: number): number;\n} {\n let quote: string | undefined;\n let escaped = false;\n let inLineComment = false;\n let inBlockComment = false;\n return {\n skip(text, index) {\n const char = text[index];\n const next = text[index + 1];\n if (inLineComment) {\n if (char === \"\\n\" || char === \"\\r\") {\n inLineComment = false;\n }\n return index + 1;\n }\n if (inBlockComment) {\n if (char === \"*\" && next === \"/\") {\n inBlockComment = false;\n return index + 2;\n }\n return index + 1;\n }\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = undefined;\n }\n return index + 1;\n }\n if (char === \"/\" && next === \"/\") {\n inLineComment = true;\n return index + 2;\n }\n if (char === \"/\" && next === \"*\") {\n inBlockComment = true;\n return index + 2;\n }\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n return index + 1;\n }\n return index;\n },\n };\n}\n\nfunction isNode(value: unknown): value is Node {\n return typeof value === \"object\" && value !== null && \"type\" in value && \"range\" in value;\n}\n\nfunction filenameFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string {\n if (\"fileName\" in node) {\n return node.fileName;\n }\n return context.filename;\n}\n"],"mappings":";;;AAcA,SAAgB,cACd,SAC8E;CAE9E,OAAO;EACL,UAFe,eAAe,QAEtB;EACR,qBAAqB;GACnB,OAAO,kBAAkB,QAAQ,CAAC,QAAQ,oBAAoB;;EAEhE,sBAAsB;GACpB,OAAO,kBAAkB,QAAQ,CAAC,QAAQ;;EAE5C,mBAAmB;GACjB,OAAO,kBAAkB,QAAQ,CAAC,QAAQ,kBAAkB;;EAE9D,cAAc,WAAW,QAAQ,UAAU;GACzC,OAAO;IAAE;IAAU,MAAM,QAAQ,WAAW;IAAM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,UAAU,SAAS,WAAW;;AAGtF,SAAS,YACP,SACA,MACQ;CACR,IAAI,cAAc,MAChB,OAAO,KAAK;CAEd,OAAO,QAAQ"}
1
+ {"version":3,"file":"checker.js","names":[],"sources":["../ts/checker.ts"],"sourcesContent":["import type { Node } from \"@oxlint/plugins\";\n\nimport { createNodeMaps, toPosition } from \"./node_map\";\nimport { sessionForContext } from \"./registry\";\nimport { SignatureKind } from \"./types\";\nimport type {\n ContextWithParserOptions,\n CorsaNode,\n CorsaProgramShape,\n CorsaSignature,\n CorsaSymbol,\n CorsaType,\n CorsaTypeCheckerShape,\n} from \"./types\";\n\nexport function createProgram(\n context: ContextWithParserOptions,\n): CorsaProgramShape & { readonly nodeMaps: ReturnType<typeof createNodeMaps> } {\n const nodeMaps = createNodeMaps(context);\n return {\n nodeMaps,\n getCompilerOptions() {\n return sessionForContext(context).session.getCompilerOptions();\n },\n getCurrentDirectory() {\n return sessionForContext(context).project.rootDir;\n },\n getRootFileNames() {\n return sessionForContext(context).session.getRootFileNames();\n },\n getSourceFile(fileName = context.filename) {\n return { fileName, text: context.sourceCode.text };\n },\n getTypeChecker() {\n return createTypeChecker(context);\n },\n };\n}\n\nexport function createTypeChecker(context: ContextWithParserOptions): CorsaTypeCheckerShape {\n return {\n getTypeAtLocation(node) {\n if ((node as { readonly type?: string }).type === \"NewExpression\") {\n return typeOfNewExpression(node as Node, this);\n }\n const lookupNode = nodeForTypeLookup(node);\n return sessionForContext(context).session.getTypeAtSourceRange(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n endPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n nodeKind(lookupNode),\n );\n },\n getContextualType(node) {\n return this.getTypeAtLocation(node);\n },\n getSymbolAtLocation(node) {\n const lookupNode = nodeForTypeLookup(node);\n return sessionForContext(context).session.getSymbolAtPosition(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n );\n },\n getSymbol(symbol) {\n return sessionForContext(context).session.getSymbol(symbol);\n },\n getSymbolById(id) {\n return sessionForContext(context).session.getSymbol(id);\n },\n getSymbolOfType(type) {\n return sessionForContext(context).session.getSymbolOfType(type);\n },\n getNode(node) {\n return sessionForContext(context).session.getNode(node);\n },\n getNodeById(id) {\n return sessionForContext(context).session.getNode(id);\n },\n getTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getTypeOfSymbol(symbol);\n },\n getDeclaredTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getDeclaredTypeOfSymbol(symbol);\n },\n getTypeOfSymbolAtLocation(symbol, node) {\n return (\n this.getTypeOfSymbol(symbol) ??\n this.getDeclaredTypeOfSymbol(symbol) ??\n this.getTypeAtLocation(node)\n );\n },\n typeToString(type, enclosingDeclaration, flags) {\n void enclosingDeclaration;\n return sessionForContext(context).session.typeToString(type, flags);\n },\n getBaseTypeOfLiteralType(type) {\n return sessionForContext(context).session.getBaseTypeOfLiteralType(type);\n },\n getPropertiesOfType(type) {\n return sessionForContext(context).session.getPropertiesOfType(type);\n },\n getSignaturesOfType(type, kind) {\n return sessionForContext(context).session.getSignaturesOfType(type, kind);\n },\n getReturnTypeOfSignature(signature) {\n return sessionForContext(context).session.getReturnTypeOfSignature(signature);\n },\n getTypePredicateOfSignature(signature) {\n return sessionForContext(context).session.getTypePredicateOfSignature(signature);\n },\n getBaseTypes(type) {\n return sessionForContext(context).session.getBaseTypes(type);\n },\n getImplementedTypes(node) {\n if (\"pos\" in node) {\n return implementedTypesFromCorsaNode(context, node, this);\n }\n const sourceText = sourceTextFor(context, node);\n const sourceNode = sourceText ? corsaNodeFromEstree(context, node) : undefined;\n if (sourceText && sourceNode) {\n const implemented = implementedTypesFromSourceText(context, sourceNode, sourceText, this);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n return implementedClauseNodes(node)\n .map((clause) => {\n const expression = implementedClauseChildNode(clause, \"expression\") ?? clause;\n const symbol = this.getSymbolAtLocation(expression) ?? this.getSymbolAtLocation(clause);\n return symbol\n ? (this.getDeclaredTypeOfSymbol(symbol) ?? this.getTypeOfSymbol(symbol))\n : (this.getTypeAtLocation(expression) ?? this.getTypeAtLocation(clause));\n })\n .filter((type): type is CorsaType => type !== undefined);\n },\n getImplementedTypesOfType(type) {\n return implementedTypesFromTypeAndBases(context, type, this);\n },\n getTypeArguments(type) {\n return sessionForContext(context).session.getTypeArguments(type);\n },\n getTypesOfType(type) {\n return sessionForContext(context).session.getTypesOfType(type);\n },\n getTargetOfType(type) {\n return sessionForContext(context).session.getTargetOfType(type);\n },\n getTypeParametersOfType(type) {\n return sessionForContext(context).session.getTypeParametersOfType(type);\n },\n getOuterTypeParametersOfType(type) {\n return sessionForContext(context).session.getOuterTypeParametersOfType(type);\n },\n getLocalTypeParametersOfType(type) {\n return sessionForContext(context).session.getLocalTypeParametersOfType(type);\n },\n getObjectTypeOfType(type) {\n return sessionForContext(context).session.getObjectTypeOfType(type);\n },\n getIndexTypeOfType(type) {\n return sessionForContext(context).session.getIndexTypeOfType(type);\n },\n getCheckTypeOfType(type) {\n return sessionForContext(context).session.getCheckTypeOfType(type);\n },\n getExtendsTypeOfType(type) {\n return sessionForContext(context).session.getExtendsTypeOfType(type);\n },\n getBaseTypeOfType(type) {\n return sessionForContext(context).session.getBaseTypeOfType(type);\n },\n getConstraintOfType(type) {\n return sessionForContext(context).session.getConstraintOfType(type);\n },\n isUnionType(type) {\n return (type.flags & typeFlags.union) !== 0;\n },\n isIntersectionType(type) {\n return (type.flags & typeFlags.intersection) !== 0;\n },\n };\n}\n\nconst typeFlags = {\n union: 1 << 27,\n intersection: 1 << 28,\n} as const;\n\nfunction sourceTextFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string | undefined {\n return sourceTextForPath(context, filenameFor(context, node));\n}\n\nfunction sourceTextForPath(\n context: ContextWithParserOptions,\n fileName: string,\n): string | undefined {\n const normalizedFileName = fileName.toLowerCase();\n const normalizedContextFilename = context.filename.toLowerCase();\n return normalizedFileName === normalizedContextFilename ||\n normalizedFileName.endsWith(normalizedContextFilename) ||\n normalizedContextFilename.endsWith(normalizedFileName)\n ? context.sourceCode.text\n : sessionForContext(context).session.getSourceTextForPath(fileName);\n}\n\nfunction typeOfNewExpression(node: Node, checker: CorsaTypeCheckerShape): CorsaType | undefined {\n const callee = childNode(node, \"callee\");\n if (!callee) {\n return undefined;\n }\n const calleeType = checker.getTypeAtLocation(callee);\n if (!calleeType) {\n return undefined;\n }\n const constructSignature = checker.getSignaturesOfType(calleeType, SignatureKind.Construct)[0];\n return constructSignature\n ? (checker.getReturnTypeOfSignature(constructSignature) ?? calleeType)\n : calleeType;\n}\n\nfunction nodeForTypeLookup(node: Node | CorsaNode): Node | CorsaNode {\n if (\"pos\" in node) {\n return node;\n }\n switch ((node as { readonly type?: string }).type) {\n case \"ClassDeclaration\":\n case \"ClassExpression\":\n return childNode(node, \"id\") ?? node;\n case \"TSPropertySignature\":\n return childNode(node, \"key\") ?? node;\n default:\n return node;\n }\n}\n\nfunction endPosition(node: Node | CorsaNode): number {\n if (\"end\" in node) {\n return node.end;\n }\n const range = (node as Node & { readonly range?: readonly [number, number] }).range;\n if (!range) {\n throw new Error(\"corsa oxlint requires ESTree nodes with range data\");\n }\n return range[1];\n}\n\nfunction nodeKind(node: Node | CorsaNode): string | undefined {\n return \"pos\" in node ? undefined : (node as { readonly type?: string }).type;\n}\n\nfunction childNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedClauseNodes(node: Node | CorsaNode): readonly Node[] {\n if (\"pos\" in node) {\n return [];\n }\n const clauses = (node as unknown as { readonly implements?: unknown }).implements;\n if (!Array.isArray(clauses)) {\n return [];\n }\n return clauses.filter(isNode);\n}\n\nfunction implementedClauseChildNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedTypesFromCorsaNode(\n context: ContextWithParserOptions,\n node: CorsaNode,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const symbol = checker.getSymbolAtLocation(node);\n if (symbol) {\n const declaredType = checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol);\n if (declaredType) {\n const implemented = checker.getImplementedTypesOfType(declaredType);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n }\n const sourceText = sourceTextFor(context, node);\n if (sourceText) {\n return implementedTypesFromSourceText(context, node, sourceText, checker);\n }\n const type = checker.getTypeAtLocation(node);\n return type ? checker.getImplementedTypesOfType(type) : [];\n}\n\nfunction corsaNodeFromEstree(context: ContextWithParserOptions, node: Node): CorsaNode | undefined {\n const range = (node as { readonly range?: unknown }).range;\n if (\n !Array.isArray(range) ||\n range.length < 2 ||\n typeof range[0] !== \"number\" ||\n typeof range[1] !== \"number\"\n ) {\n return undefined;\n }\n return {\n fileName: context.filename,\n pos: range[0],\n end: range[1],\n range: [range[0], range[1]] as const,\n };\n}\n\nfunction implementedTypesFromTypeAndBases(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n // Iterative DFS over the base chain so we don't pay for one closure call\n // and one `push(...subResult)` spread per base (each spread used to copy\n // the entire growing accumulator). Visit order doesn't matter because we\n // dedupe by `type.id`.\n const seenTypes = new Set<string>();\n const seenImplementedTypes = new Set<string>();\n const implemented: CorsaType[] = [];\n const stack: CorsaType[] = [type];\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (seenTypes.has(current.id)) {\n continue;\n }\n seenTypes.add(current.id);\n\n const ownImplemented = implementedTypesFromTypeDeclaration(context, current, checker);\n for (let index = 0; index < ownImplemented.length; index += 1) {\n const ownType = ownImplemented[index]!;\n if (seenImplementedTypes.has(ownType.id)) {\n continue;\n }\n seenImplementedTypes.add(ownType.id);\n implemented.push(ownType);\n }\n\n const bases = checker.getBaseTypes(current);\n // Push in reverse so the natural visit order matches the recursive form.\n for (let index = bases.length - 1; index >= 0; index -= 1) {\n const baseType = bases[index]!;\n if (seenTypes.has(baseType.id)) {\n continue;\n }\n stack.push(baseType);\n }\n }\n return implemented;\n}\n\nfunction implementedTypesFromTypeDeclaration(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const session = sessionForContext(context).session;\n const symbol = type.symbol ? session.getSymbol(type.symbol) : undefined;\n const declaration = symbol?.valueDeclaration ?? symbol?.declarations?.[0];\n const declarationNode = declaration ? session.getNode(declaration) : undefined;\n const sourceText = declarationNode\n ? sourceTextForPath(context, declarationNode.fileName)\n : undefined;\n return declarationNode && sourceText\n ? implementedTypesFromSourceText(context, declarationNode, sourceText, checker)\n : [];\n}\n\nfunction implementedTypesFromSourceText(\n context: ContextWithParserOptions,\n node: CorsaNode,\n sourceText: string,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n if (node.pos < 0 || node.end > sourceText.length || node.pos >= node.end) {\n return [];\n }\n const classText = sourceText.slice(node.pos, node.end);\n const classStart = findKeywordOutsideTrivia(classText, \"class\");\n const headerStart = classStart >= 0 ? classStart : 0;\n const bodyOpen = findClassBodyOpen(classText, headerStart);\n const headerText = classText.slice(headerStart, bodyOpen >= 0 ? bodyOpen : classText.length);\n const implementsIndex = findKeywordOutsideTrivia(headerText, \"implements\");\n if (implementsIndex < 0) {\n return [];\n }\n const session = sessionForContext(context).session;\n const clauseText = headerText.slice(implementsIndex + \"implements\".length);\n const clauseStart = node.pos + headerStart + implementsIndex + \"implements\".length;\n return splitTopLevelRanges(clauseText, \",\")\n .map((range) => {\n const raw = clauseText.slice(range.start, range.end);\n const leading = raw.search(/\\S/);\n if (leading < 0) {\n return undefined;\n }\n const trailing = raw.match(/\\s*$/)?.[0].length ?? 0;\n const pos = clauseStart + range.start + leading;\n const end = clauseStart + range.end - trailing;\n const lookupNode: CorsaNode = {\n fileName: node.fileName,\n pos,\n end,\n range: [pos, end] as const,\n };\n const nameNode = implementedClauseNameNode(lookupNode, raw);\n const symbol =\n checker.getSymbolAtLocation(nameNode) ?? checker.getSymbolAtLocation(lookupNode);\n const type = symbol\n ? (checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol))\n : (checker.getTypeAtLocation(nameNode) ?? checker.getTypeAtLocation(lookupNode));\n if (type) {\n // Implemented-interface handles come back with empty `texts`, so warm\n // the type-text cache with the `implements` identifier. If upstream\n // later evicts the handle, `typeToString` falls back to this name\n // instead of throwing (GH#211).\n session.rememberTypeText(type.id, raw.slice(leading, raw.length - trailing));\n }\n return type;\n })\n .filter((type): type is CorsaType => type !== undefined);\n}\n\nfunction implementedClauseNameNode(node: CorsaNode, raw: string): CorsaNode {\n const range = lastTypeNameIdentifierRange(raw);\n if (!range) {\n return node;\n }\n const pos = node.pos + range.start;\n const end = node.pos + range.end;\n return {\n fileName: node.fileName,\n pos,\n end,\n range: [pos, end] as const,\n };\n}\n\nfunction lastTypeNameIdentifierRange(\n text: string,\n): { readonly start: number; readonly end: number } | undefined {\n let last: { start: number; end: number } | undefined;\n const scanner = createScanner();\n for (let index = 0; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n const char = text[index];\n if (char === \"<\") {\n break;\n }\n if (!isIdentifierStart(char)) {\n continue;\n }\n let end = index + 1;\n while (isIdentifierPart(text[end])) {\n end += 1;\n }\n last = { start: index, end };\n index = end - 1;\n }\n return last;\n}\n\nfunction findClassBodyOpen(text: string, start: number): number {\n const scanner = createScanner();\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = start; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n const char = text[index];\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (\n char === \"{\" &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n return index;\n } else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n }\n return -1;\n}\n\nfunction findKeywordOutsideTrivia(text: string, keyword: string): number {\n const scanner = createScanner();\n for (let index = 0; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (matchesKeyword(text, keyword, index)) {\n return index;\n }\n }\n return -1;\n}\n\nfunction matchesKeyword(text: string, keyword: string, index: number): boolean {\n return (\n text.startsWith(keyword, index) &&\n !isIdentifierPart(text[index - 1]) &&\n !isIdentifierPart(text[index + keyword.length])\n );\n}\n\nfunction isIdentifierPart(char: string | undefined): boolean {\n return char !== undefined && (isIdentifierStart(char) || /[0-9]/.test(char));\n}\n\nfunction isIdentifierStart(char: string | undefined): boolean {\n return char !== undefined && /[A-Za-z_$]/.test(char);\n}\n\nfunction splitTopLevelRanges(\n text: string,\n delimiter: string,\n): readonly { readonly start: number; readonly end: number }[] {\n const ranges: { start: number; end: number }[] = [];\n const scanner = createScanner();\n let start = 0;\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n char === delimiter &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n ranges.push({ start, end: index });\n start = index + 1;\n }\n }\n ranges.push({ start, end: text.length });\n return ranges;\n}\n\nfunction createScanner(): {\n skip(text: string, index: number): number;\n} {\n let quote: string | undefined;\n let escaped = false;\n let inLineComment = false;\n let inBlockComment = false;\n return {\n skip(text, index) {\n const char = text[index];\n const next = text[index + 1];\n if (inLineComment) {\n if (char === \"\\n\" || char === \"\\r\") {\n inLineComment = false;\n }\n return index + 1;\n }\n if (inBlockComment) {\n if (char === \"*\" && next === \"/\") {\n inBlockComment = false;\n return index + 2;\n }\n return index + 1;\n }\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = undefined;\n }\n return index + 1;\n }\n if (char === \"/\" && next === \"/\") {\n inLineComment = true;\n return index + 2;\n }\n if (char === \"/\" && next === \"*\") {\n inBlockComment = true;\n return index + 2;\n }\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n return index + 1;\n }\n return index;\n },\n };\n}\n\nfunction isNode(value: unknown): value is Node {\n return typeof value === \"object\" && value !== null && \"type\" in value && \"range\" in value;\n}\n\nfunction filenameFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string {\n if (\"fileName\" in node) {\n return node.fileName;\n }\n return context.filename;\n}\n"],"mappings":";;;;AAeA,SAAgB,cACd,SAC8E;CAE9E,OAAO;EACL,UAFe,eAAe,QAEtB;EACR,qBAAqB;GACnB,OAAO,kBAAkB,QAAQ,CAAC,QAAQ,oBAAoB;;EAEhE,sBAAsB;GACpB,OAAO,kBAAkB,QAAQ,CAAC,QAAQ;;EAE5C,mBAAmB;GACjB,OAAO,kBAAkB,QAAQ,CA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ils_d_exports } from "./ast_utils.js";
2
- import { ContextWithParserOptions, CorsaNode, CorsaOxlintSettings, CorsaProgramShape, CorsaRuntimeOptions, CorsaSignature, CorsaStylisticSettings, CorsaSymbol, CorsaType, CorsaTypeCheckerShape, ParserServices, ParserServicesWithTypeInformation, ProjectServiceOptions, TypeAwareParserOptions } from "./types.js";
2
+ import { ContextWithParserOptions, CorsaNode, CorsaOxlintSettings, CorsaProgramShape, CorsaRuntimeOptions, CorsaSignature, CorsaStylisticSettings, CorsaSymbol, CorsaType, CorsaTypeCheckerShape, ParserServices, ParserServicesWithTypeInformation, ProjectServiceOptions, SignatureKind, TypeAwareParserOptions } from "./types.js";
3
3
  import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from "./compat.js";
4
4
  import { json_schema_d_exports } from "./json_schema.js";
5
5
  import { oxlintCompat, oxlint_compat_d_exports } from "./oxlint_compat.js";
@@ -24,5 +24,5 @@ type ESTree = {
24
24
  [key: string]: unknown;
25
25
  };
26
26
  //#endregion
27
- export { ast_utils_d_exports as ASTUtils, AST_NODE_TYPES, AST_TOKEN_TYPES, type ContextWithParserOptions, type CorsaNode, type CorsaOxlintSettings, type CorsaProgramShape, type CorsaRuntimeOptions, type CorsaSignature, type CorsaStylisticSettings, type CorsaSymbol, type CorsaType, type CorsaTypeCheckerShape, ESLintUtils, ESTree, json_schema_d_exports as JSONSchema, oxlint_compat_d_exports as OxlintCompat, OxlintUtils, type ParserServices, type ParserServicesWithTypeInformation, type Plugin, type ProjectServiceOptions, type Rule, RuleCreator, RuleTester, type RuleTesterConfig, TSESLint, TSESTree, ts_utils_d_exports as TSUtils, type TypeAwareParserOptions, utils_d_exports as Utils, compatPlugin, definePlugin, defineRule, getParserServices, oxlintCompat, index_d_exports as rules, stylistic_d_exports as stylistic };
27
+ export { ast_utils_d_exports as ASTUtils, AST_NODE_TYPES, AST_TOKEN_TYPES, type ContextWithParserOptions, type CorsaNode, type CorsaOxlintSettings, type CorsaProgramShape, type CorsaRuntimeOptions, type CorsaSignature, type CorsaStylisticSettings, type CorsaSymbol, type CorsaType, type CorsaTypeCheckerShape, ESLintUtils, ESTree, json_schema_d_exports as JSONSchema, oxlint_compat_d_exports as OxlintCompat, OxlintUtils, type ParserServices, type ParserServicesWithTypeInformation, type Plugin, type ProjectServiceOptions, type Rule, RuleCreator, RuleTester, type RuleTesterConfig, SignatureKind, TSESLint, TSESTree, ts_utils_d_exports as TSUtils, type TypeAwareParserOptions, utils_d_exports as Utils, compatPlugin, definePlugin, defineRule, getParserServices, oxlintCompat, index_d_exports as rules, stylistic_d_exports as stylistic };
28
28
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ast_utils_exports } from "./ast_utils.js";
2
+ import { SignatureKind } from "./types.js";
2
3
  import { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from "./compat.js";
3
4
  import { json_schema_exports } from "./json_schema.js";
4
5
  import { oxlintCompat, oxlint_compat_exports } from "./oxlint_compat.js";
@@ -11,4 +12,4 @@ import { RuleTester } from "./rule_tester.js";
11
12
  import { TSESLint } from "./ts_eslint.js";
12
13
  import { rules_exports } from "./rules/index.js";
13
14
  import { stylistic_exports } from "./stylistic.js";
14
- export { ast_utils_exports as ASTUtils, AST_NODE_TYPES, AST_TOKEN_TYPES, ESLintUtils, json_schema_exports as JSONSchema, oxlint_compat_exports as OxlintCompat, OxlintUtils, RuleCreator, RuleTester, TSESLint, TSESTree, ts_utils_exports as TSUtils, utils_exports as Utils, compatPlugin, definePlugin, defineRule, getParserServices, oxlintCompat, rules_exports as rules, stylistic_exports as stylistic };
15
+ export { ast_utils_exports as ASTUtils, AST_NODE_TYPES, AST_TOKEN_TYPES, ESLintUtils, json_schema_exports as JSONSchema, oxlint_compat_exports as OxlintCompat, OxlintUtils, RuleCreator, RuleTester, SignatureKind, TSESLint, TSESTree, ts_utils_exports as TSUtils, utils_exports as Utils, compatPlugin, definePlugin, defineRule, getParserServices, oxlintCompat, rules_exports as rules, stylistic_exports as stylistic };
@@ -91,6 +91,9 @@ function createEslintTypeChecker(checker, esTreeNodeToTSNodeMap) {
91
91
  getSymbolById(id) {
92
92
  return typeof id === "object" ? id : void 0;
93
93
  },
94
+ getSymbolOfType(type) {
95
+ return callChecker(source, "getSymbolOfType", type) ?? type.symbol;
96
+ },
94
97
  getNode(node) {
95
98
  return typeof node === "object" ? node : void 0;
96
99
  },
@@ -1 +1 @@
1
- {"version":3,"file":"parser_services.js","names":[],"sources":["../ts/parser_services.ts"],"sourcesContent":["import { createProgram, createTypeChecker } from \"./checker\";\nimport { resolveTypeAwareParserOptions } from \"./context\";\nimport { createNodeMaps } from \"./node_map\";\nimport type {\n ContextWithParserOptions,\n CorsaTypeCheckerShape,\n ParserServices,\n ParserServicesWithTypeInformation,\n} from \"./types\";\n\nconst parserServices = new WeakMap<object, ParserServices>();\n\n/**\n * Returns type-aware parser services backed by Corsa.\n *\n * @example\n * ```ts\n * const services = getParserServices(context);\n * const checker = services.program.getTypeChecker();\n * ```\n */\nexport function getParserServices(\n context: ContextWithParserOptions,\n allowWithoutFullTypeInformation = false,\n): ParserServices {\n const current = parserServices.get(context);\n if (current) {\n return current;\n }\n const parserOptions = resolveTypeAwareParserOptions(context);\n const eslintParserServices = resolveEslintParserServices(context);\n if (!parserOptions.corsa && eslintParserServices) {\n const services = createEslintParserServices(eslintParserServices);\n parserServices.set(context, services);\n return services;\n }\n try {\n const maps = createNodeMaps(context);\n const program = createProgram(context);\n const services: ParserServicesWithTypeInformation = {\n program,\n ...maps,\n hasFullTypeInformation: true,\n getTypeAtLocation(node) {\n return createTypeChecker(context).getTypeAtLocation(node);\n },\n getSymbolAtLocation(node) {\n return createTypeChecker(context).getSymbolAtLocation(node);\n },\n };\n parserServices.set(context, services);\n return services;\n } catch (error) {\n if (!allowWithoutFullTypeInformation) {\n throw error;\n }\n const fallback: ParserServices = {\n program: createProgram(context),\n ...createNodeMaps(context),\n hasFullTypeInformation: false,\n getTypeAtLocation() {\n return undefined;\n },\n getSymbolAtLocation() {\n return undefined;\n },\n };\n parserServices.set(context, fallback);\n return fallback;\n }\n}\n\nfunction createEslintParserServices(\n parserServices: ParserServices,\n): ParserServicesWithTypeInformation {\n const checker = createEslintTypeChecker(\n parserServices.program.getTypeChecker(),\n parserServices.esTreeNodeToTSNodeMap,\n );\n return {\n program: createEslintProgram(parserServices.program, checker),\n esTreeNodeToTSNodeMap: parserServices.esTreeNodeToTSNodeMap,\n tsNodeToESTreeNodeMap: parserServices.tsNodeToESTreeNodeMap,\n hasFullTypeInformation: true,\n getTypeAtLocation(node) {\n const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);\n return tsNode ? checker.getTypeAtLocation(tsNode) : undefined;\n },\n getSymbolAtLocation(node) {\n const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);\n return tsNode ? checker.getSymbolAtLocation(tsNode) : undefined;\n },\n };\n}\n\nfunction createEslintProgram(\n program: ParserServices[\"program\"],\n checker: CorsaTypeCheckerShape,\n): ParserServices[\"program\"] {\n return Object.assign(Object.create(program), {\n getTypeChecker() {\n return checker;\n },\n });\n}\n\nfunction createEslintTypeChecker(\n checker: CorsaTypeCheckerShape,\n esTreeNodeToTSNodeMap: ParserServices[\"esTreeNodeToTSNodeMap\"],\n): CorsaTypeCheckerShape {\n const source = checker as unknown as Record<string, unknown>;\n return {\n ...checker,\n getTypeAtLocation(node) {\n return callChecker(source, \"getTypeAtLocation\", tsNodeFor(node, esTreeNodeToTSNodeMap));\n },\n getContextualType(node) {\n return (\n callChecker(source, \"getContextualType\", tsNodeFor(node, esTreeNodeToTSNodeMap)) ??\n this.getTypeAtLocation(node)\n );\n },\n getSymbolAtLocation(node) {\n return callChecker(source, \"getSymbolAtLocation\", tsNodeFor(node, esTreeNodeToTSNodeMap));\n },\n getSymbol(symbol) {\n return typeof symbol === \"object\" ? symbol : undefined;\n },\n getSymbolById(id) {\n return typeof id === \"object\" ? id : undefined;\n },\n getNode(node) {\n return typeof node === \"object\" ? node : undefined;\n },\n getNodeById(id) {\n return typeof id === \"object\" ? id : undefined;\n },\n getTypeOfSymbol(symbol) {\n return callChecker(source, \"getTypeOfSymbol\", symbol);\n },\n getDeclaredTypeOfSymbol(symbol) {\n return callChecker(source, \"getDeclaredTypeOfSymbol\", symbol);\n },\n getTypeOfSymbolAtLocation(symbol, node) {\n return (\n callChecker(\n source,\n \"getTypeOfSymbolAtLocation\",\n symbol,\n tsNodeFor(node, esTreeNodeToTSNodeMap),\n ) ??\n this.getTypeOfSymbol(symbol) ??\n this.getDeclaredTypeOfSymbol(symbol)\n );\n },\n typeToString(type, enclosingDeclaration, flags) {\n return (\n callChecker(\n source,\n \"typeToString\",\n type,\n enclosingDeclaration ? tsNodeFor(enclosingDeclaration, esTreeNodeToTSNodeMap) : undefined,\n flags,\n ) ?? fallbackTypeText(type)\n );\n },\n getBaseTypeOfLiteralType(type) {\n return callChecker(source, \"getBaseTypeOfLiteralType\", type) ?? type;\n },\n getPropertiesOfType(type) {\n return asReadonlyArray(callChecker(source, \"getPropertiesOfType\", type));\n },\n getSignaturesOfType(type, kind) {\n return asReadonlyArray(callChecker(source, \"getSignaturesOfType\", type, kind));\n },\n getReturnTypeOfSignature(signature) {\n return callChecker(source, \"getReturnTypeOfSignature\", signature);\n },\n getTypePredicateOfSignature(signature) {\n return callChecker(source, \"getTypePredicateOfSignature\", signature);\n },\n getBaseTypes(type) {\n const baseTypes = asReadonlyArray(callChecker(source, \"getBaseTypes\", type));\n return baseTypes.length > 0 ? baseTypes : heritageTypes(type, source, \"extends\");\n },\n getImplementedTypes(node) {\n return heritageTypesFromDeclaration(\n tsNodeFor(node, esTreeNodeToTSNodeMap),\n source,\n \"implements\",\n );\n },\n getImplementedTypesOfType(type) {\n return implementedTypesIncludingBases(type, source);\n },\n getTypeArguments(type) {\n return asReadonlyArray(callChecker(source, \"getTypeArguments\", type));\n },\n getTypesOfType(type) {\n return asReadonlyArray((type as { readonly types?: unknown }).types);\n },\n getTargetOfType(type) {\n return (type as { readonly target?: unknown }).target as never;\n },\n getTypeParametersOfType(type) {\n return asReadonlyArray((type as { readonly typeParameters?: unknown }).typeParameters);\n },\n getOuterTypeParametersOfType(type) {\n return asReadonlyArray(\n (type as { readonly outerTypeParameters?: unknown }).outerTypeParameters,\n );\n },\n getLocalTypeParametersOfType(type) {\n return asReadonlyArray(\n (type as { readonly localTypeParameters?: unknown }).localTypeParameters,\n );\n },\n getObjectTypeOfType(type) {\n return (type as { readonly objectType?: unknown }).objectType as never;\n },\n getIndexTypeOfType(type) {\n return (type as { readonly indexType?: unknown }).indexType as never;\n },\n getCheckTypeOfType(type) {\n return (type as { readonly checkType?: unknown }).checkType as never;\n },\n getExtendsTypeOfType(type) {\n return (type as { readonly extendsType?: unknown }).extendsType as never;\n },\n getBaseTypeOfType(type) {\n return (type as { readonly baseType?: unknown }).baseType as never;\n },\n getConstraintOfType(type) {\n return callChecker(source, \"getBaseConstraintOfType\", type);\n },\n isUnionType(type) {\n const value = type as { readonly isUnion?: unknown };\n return typeof value.isUnion === \"function\" ? Boolean(value.isUnion()) : false;\n },\n isIntersectionType(type) {\n const value = type as { readonly isIntersection?: unknown };\n return typeof value.isIntersection === \"function\" ? Boolean(value.isIntersection()) : false;\n },\n } as CorsaTypeCheckerShape;\n}\n\nfunction callChecker(\n checker: Record<string, unknown>,\n method: string,\n ...args: readonly unknown[]\n): never | undefined {\n const candidate = checker[method];\n return typeof candidate === \"function\" ? candidate.apply(checker, args) : undefined;\n}\n\nfunction asReadonlyArray<T>(value: unknown): readonly T[] {\n return Array.isArray(value) ? value : [];\n}\n\nfunction tsNodeFor(\n node: unknown,\n esTreeNodeToTSNodeMap: ParserServices[\"esTreeNodeToTSNodeMap\"],\n): unknown {\n return hasNode(esTreeNodeToTSNodeMap, node) ? esTreeNodeToTSNodeMap.get(node as never) : node;\n}\n\nfunction hasNode(\n esTreeNodeToTSNodeMap: ParserServices[\"esTreeNodeToTSNodeMap\"],\n node: unknown,\n): boolean {\n return typeof node === \"object\" && node !== null && esTreeNodeToTSNodeMap.has(node as never);\n}\n\nfunction fallbackTypeText(type: unknown): string {\n const name = (type as { readonly name?: unknown }).name;\n return typeof name === \"string\" || typeof name === \"number\" || typeof name === \"boolean\"\n ? String(name)\n : \"\";\n}\n\nfunction heritageTypes(\n type: unknown,\n checker: Record<string, unknown>,\n keyword: \"extends\" | \"implements\",\n): readonly never[] {\n const declarations = asReadonlyArray(\n (type as { readonly symbol?: { readonly declarations?: unknown } }).symbol?.declarations,\n );\n return declarations.flatMap((declaration) =>\n heritageTypesFromDeclaration(declaration, checker, keyword),\n );\n}\n\n/**\n * Mirrors the tsgo-backed `getImplementedTypesOfType` behaviour by walking the\n * base-type chain so a class that implements an interface only through a base\n * class still reports that interface. Without this, a rule shared between\n * oxlint (tsgo) and ESLint (this `@typescript-eslint` fallback checker) would\n * see different implemented types for the same source (GH#207).\n *\n * The traversal is a DFS so we can use `pop()` (O(1)) instead of a queue with\n * `shift()` (O(n)) — visit order doesn't matter because we dedupe implemented\n * types by identity. We also `continue` on already-visited bases before\n * touching `Set.add`, so a deep diamond hierarchy never quadruples work.\n */\nfunction implementedTypesIncludingBases(\n type: unknown,\n checker: Record<string, unknown>,\n): readonly never[] {\n if (type === undefined || type === null) {\n return [];\n }\n const visited = new Set<unknown>();\n const seenImplemented = new Set<unknown>();\n const implemented: never[] = [];\n const stack: unknown[] = [type];\n while (stack.length > 0) {\n const current = stack.pop();\n if (current === undefined || current === null || visited.has(current)) {\n continue;\n }\n visited.add(current);\n const ownImplemented = heritageTypes(current, checker, \"implements\");\n for (let index = 0; index < ownImplemented.length; index += 1) {\n const ownType = ownImplemented[index];\n if (seenImplemented.has(ownType)) {\n continue;\n }\n seenImplemented.add(ownType);\n implemented.push(ownType);\n }\n const directBases = asReadonlyArray(callChecker(checker, \"getBaseTypes\", current));\n const bases = directBases.length > 0 ? directBases : heritageTypes(current, checker, \"extends\");\n for (let index = bases.length - 1; index >= 0; index -= 1) {\n const baseType = bases[index];\n if (baseType === undefined || baseType === null || visited.has(baseType)) {\n continue;\n }\n stack.push(baseType);\n }\n }\n return implemented;\n}\n\nfunction heritageTypesFromDeclaration(\n declaration: unknown,\n checker: Record<string, unknown>,\n keyword: \"extends\" | \"implements\",\n): readonly never[] {\n const clauses = asReadonlyArray(\n (declaration as { readonly heritageClauses?: unknown }).heritageClauses,\n );\n return clauses\n .filter((clause) => heritageClauseText(clause).trimStart().startsWith(keyword))\n .flatMap((clause) => asReadonlyArray((clause as { readonly types?: unknown }).types))\n .map((node) => {\n const expression = (node as { readonly expression?: unknown }).expression ?? node;\n return callChecker(checker, \"getTypeAtLocation\", expression);\n })\n .filter((type): type is never => type !== undefined);\n}\n\nfunction heritageClauseText(clause: unknown): string {\n const getText = (clause as { readonly getText?: unknown }).getText;\n return typeof getText === \"function\" ? String(getText.call(clause)) : \"\";\n}\n\nfunction resolveEslintParserServices(\n context: ContextWithParserOptions,\n): ParserServices | undefined {\n const candidates = [context.parserServices, context.sourceCode.parserServices] as const;\n for (const candidate of candidates) {\n if (hasEslintParserServices(candidate)) {\n return candidate;\n }\n }\n return undefined;\n}\n\nfunction hasEslintParserServices(value: unknown): value is ParserServices {\n return Boolean(\n value &&\n typeof value === \"object\" &&\n \"program\" in value &&\n \"esTreeNodeToTSNodeMap\" in value &&\n \"tsNodeToESTreeNodeMap\" in value,\n );\n}\n"],"mappings":";;;;AAUA,MAAM,iCAAiB,IAAI,SAAiC;;;;;;;;;;AAW5D,SAAgB,kBACd,SACA,kCAAkC,OAClB;CAChB,MAAM,UAAU,eAAe,IAAI,QAAQ;CAC3C,IAAI,SACF,OAAO;CAET,MAAM,gBAAgB,8BAA8B,QAAQ;CAC5D,MAAM,uBAAuB,4BAA4B,QAAQ;CACjE,IAAI,CAAC,cAAc,SAAS,sBAAsB;EAChD,MAAM,WAAW,2BAA2B,qBAAqB;EACjE,eAAe,IAAI,SAAS,SAAS;EACrC,OAAO;;CAET,IAAI;EACF,MAAM,OAAO,eA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,SAAS,UAAU;EAC/F,KAAK,IAAI,QAAQ,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG;GACzD,MAAM,WAAW,MAAM;GACvB,IAAI,aAAa,KAAA,KAAa,aAAa,QAAQ,QAAQ,IAAI,SAAS,EACtE;GAEF,MAAM,KAAK,SAAS;;;CAGxB,OAAO;;AAGT,SAAS,6BACP,aACA,SACA,SACkB;CAIlB,OAHgB,gBACb,YAAuD,gBAE5C,CACX,QAAQ,WAAW,mBAAmB,OAAO,CAAC,WAAW,CAAC,WAAW,QAAQ,CAAC,CAC9E,SAAS,WAAW,gBAAiB,OAAwC,MAAM,CAAC,CACpF,KAAK,SAAS;EAEb,OAAO,YAAY,SAAS,qBADR,KAA2C,cAAc,KACjB;GAC5D,CACD,QAAQ,SAAwB,SAAS,KAAA,EAAU;;AAGxD,SAAS,mBAAmB,QAAyB;CACnD,MAAM,UAAW,OAA0C;CAC3D,OAAO,OAAO,YAAY,aAAa,OAAO,QAAQ,KAAK,OAAO,CAAC,GAAG;;AAGxE,SAAS,4BACP,SAC4B;CAC5B,MAAM,aAAa,CAAC,QAAQ,gBAAgB,QAAQ,WAAW,eAAe;CAC9E,KAAK,MAAM,aAAa,YACtB,IAAI,wBAAwB,UAAU,EACpC,OAAO;;AAMb,SAAS,wBAAwB,OAAyC;CACxE,OAAO,QACL,SACA,OAAO,UAAU,YACjB,aAAa,SACb,2BAA2B,SAC3B,2BAA2B,MAC5B"}
1
+ {"version":3,"file":"parser_services.js","names":[],"sources":["../ts/parser_services.ts"],"sourcesContent":["import { createProgram, createTypeChecker } from \"./checker\";\nimport { resolveTypeAwareParserOptions } from \"./context\";\nimport { createNodeMaps } from \"./node_map\";\nimport type {\n ContextWithParserOptions,\n CorsaTypeCheckerShape,\n ParserServices,\n ParserServicesWithTypeInformation,\n} from \"./types\";\n\nconst parserServices = new WeakMap<object, ParserServices>();\n\n/**\n * Returns type-aware parser services backed by Corsa.\n *\n * @example\n * ```ts\n * const services = getParserServices(context);\n * const checker = services.program.getTypeChecker();\n * ```\n */\nexport function getParserServices(\n context: ContextWithParserOptions,\n allowWithoutFullTypeInformation = false,\n): ParserServices {\n const current = parserServices.get(context);\n if (current) {\n return current;\n }\n const parserOptions = resolveTypeAwareParserOptions(context);\n const eslintParserServices = resolveEslintParserServices(context);\n if (!parserOptions.corsa && eslintParserServices) {\n const services = createEslintParserServices(eslintParserServices);\n parserServices.set(context, services);\n return services;\n }\n try {\n const maps = createNodeMaps(context);\n const program = createProgram(context);\n const services: ParserServicesWithTypeInformation = {\n program,\n ...maps,\n hasFullTypeInformation: true,\n getTypeAtLocation(node) {\n return createTypeChecker(context).getTypeAtLocation(node);\n },\n getSymbolAtLocation(node) {\n return createTypeChecker(context).getSymbolAtLocation(node);\n },\n };\n parserServices.set(context, services);\n return services;\n } catch (error) {\n if (!allowWithoutFullTypeInformation) {\n throw error;\n }\n const fallback: ParserServices = {\n program: createProgram(context),\n ...createNodeMaps(context),\n hasFullTypeInformation: false,\n getTypeAtLocation() {\n return undefined;\n },\n getSymbolAtLocation() {\n return undefined;\n },\n };\n parserServices.set(context, fallback);\n return fallback;\n }\n}\n\nfunction createEslintParserServices(\n parserServices: ParserServices,\n): ParserServicesWithTypeInformation {\n const checker = createEslintTypeChecker(\n parserServices.program.getTypeChecker(),\n parserServices.esTreeNodeToTSNodeMap,\n );\n return {\n program: createEslintProgram(parserServices.program, checker),\n esTreeNodeToTSNodeMap: parserServices.esTreeNodeToTSNodeMap,\n tsNodeToESTreeNodeMap: parserServices.tsNodeToESTreeNodeMap,\n hasFullTypeInformation: true,\n getTypeAtLocation(node) {\n const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);\n return tsNode ? checker.getTypeAtLocation(tsNode) : undefined;\n },\n getSymbolAtLocation(node) {\n const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);\n return tsNode ? checker.getSymbolAtLocation(tsNode) : undefined;\n },\n };\n}\n\nfunction createEslintProgram(\n program: ParserServices[\"program\"],\n checker: CorsaTypeCheckerShape,\n): ParserServices[\"program\"] {\n return Object.assign(Object.create(program), {\n getTypeChecker() {\n return checker;\n },\n });\n}\n\nfunction createEslintTypeChecker(\n checker: CorsaTypeCheckerShape,\n esTreeNodeToTSNodeMap: ParserServices[\"esTreeNodeToTSNodeMap\"],\n): CorsaTypeCheckerShape {\n const source = checker as unknown as Record<string, unknown>;\n return {\n ...checker,\n getTypeAtLocation(node) {\n return callChecker(source, \"getTypeAtLocation\", tsNodeFor(node, esTreeNodeToTSNodeMap));\n },\n getContextualType(node) {\n return (\n callChecker(source, \"getContextualType\", tsNodeFor(node, esTreeNodeToTSNodeMap)) ??\n this.getTypeAtLocation(node)\n );\n },\n getSymbolAtLocation(node) {\n return callChecker(source, \"getSymbolAtLocation\", tsNodeFor(node, esTreeNodeToTSNodeMap));\n },\n getSymbol(symbol) {\n return typeof symbol === \"object\" ? symbol : undefined;\n },\n getSymbolById(id) {\n return typeof id === \"object\" ? id : undefined;\n },\n getSymbolOfType(type) {\n return (\n callChecker(source, \"getSymbolOfType\", type) ??\n ((type as { readonly symbol?: unknown }).symbol as never)\n );\n },\n getNode(node) {\n return typeof node === \"object\" ? node : undefined;\n },\n getNodeById(id) {\n return typeof id === \"object\" ? id : undefined;\n },\n getTypeOfSymbol(symbol) {\n return callChecker(source, \"getTypeOfSymbol\", symbol);\n },\n getDeclaredTypeOfSymbol(symbol) {\n return callChecker(source, \"getDeclaredTypeOfSymbol\", symbol);\n },\n getTypeOfSymbolAtLocation(symbol, node) {\n return (\n callChecker(\n source,\n \"getTypeOfSymbolAtLocation\",\n symbol,\n tsNodeFor(node, esTreeNodeToTSNodeMap),\n ) ??\n this.getTypeOfSymbol(symbol) ??\n this.getDeclaredTypeOfSymbol(symbol)\n );\n },\n typeToString(type, enclosingDeclaration, flags) {\n return (\n callChecker(\n source,\n \"typeToString\",\n type,\n enclosingDeclaration ? tsNodeFor(enclosingDeclaration, esTreeNodeToTSNodeMap) : undefined,\n flags,\n ) ?? fallbackTypeText(type)\n );\n },\n getBaseTypeOfLiteralType(type) {\n return callChecker(source, \"getBaseTypeOfLiteralType\", type) ?? type;\n },\n getPropertiesOfType(type) {\n return asReadonlyArray(callChecker(source, \"getPropertiesOfType\", type));\n },\n getSignaturesOfType(type, kind) {\n return asReadonlyArray(callChecker(source, \"getSignaturesOfType\", type, kind));\n },\n getReturnTypeOfSignature(signature) {\n return callChecker(source, \"getReturnTypeOfSignature\", signature);\n },\n getTypePredicateOfSignature(signature) {\n return callChecker(source, \"getTypePredicateOfSignature\", signature);\n },\n getBaseTypes(type) {\n const baseTypes = asReadonlyArray(callChecker(source, \"getBaseTypes\", type));\n return baseTypes.length > 0 ? baseTypes : heritageTypes(type, source, \"extends\");\n },\n getImplementedTypes(node) {\n return heritageTypesFromDeclaration(\n tsNodeFor(node, esTreeNodeToTSNodeMap),\n source,\n \"implements\",\n );\n },\n getImplementedTypesOfType(type) {\n return implementedTypesIncludingBases(type, source);\n },\n getTypeArguments(type) {\n return asReadonlyArray(callChecker(source, \"getTypeArguments\", type));\n },\n getTypesOfType(type) {\n return asReadonlyArray((type as { readonly types?: unknown }).types);\n },\n getTargetOfType(type) {\n return (type as { readonly target?: unknown }).target as never;\n },\n getTypeParametersOfType(type) {\n return asReadonlyArray((type as { readonly typeParameters?: unknown }).typeParameters);\n },\n getOuterTypeParametersOfType(type) {\n return asReadonlyArray(\n (type as { readonly outerTypeParameters?: unknown }).outerTypeParameters,\n );\n },\n getLocalTypeParametersOfType(type) {\n return asReadonlyArray(\n (type as { readonly localTypeParameters?: unknown }).localTypeParameters,\n );\n },\n getObjectTypeOfType(type) {\n return (type as { readonly objectType?: unknown }).objectType as never;\n },\n getIndexTypeOfType(type) {\n return (type as { readonly indexType?: unknown }).indexType as never;\n },\n getCheckTypeOfType(type) {\n return (type as { readonly checkType?: unknown }).checkType as never;\n },\n getExtendsTypeOfType(type) {\n return (type as { readonly extendsType?: unknown }).extendsType as never;\n },\n getBaseTypeOfType(type) {\n return (type as { readonly baseType?: unknown }).baseType as never;\n },\n getConstraintOfType(type) {\n return callChecker(source, \"getBaseConstraintOfType\", type);\n },\n isUnionType(type) {\n const value = type as { readonly isUnion?: unknown };\n return typeof value.isUnion === \"function\" ? Boolean(value.isUnion()) : false;\n },\n isIntersectionType(type) {\n const value = type as { readonly isIntersection?: unknown };\n return typeof value.isIntersection === \"function\" ? Boolean(value.isIntersection()) : false;\n },\n } as CorsaTypeCheckerShape;\n}\n\nfunction callChecker(\n checker: Record<string, unknown>,\n method: string,\n ...args: readonly unknown[]\n): never | undefined {\n const candidate = checker[method];\n return typeof candidate === \"function\" ? candidate.apply(checker, args) : undefined;\n}\n\nfunction asReadonlyArray<T>(value: unknown): readonly T[] {\n return Array.isArray(value) ? value : [];\n}\n\nfunction tsNodeFor(\n node: unknown,\n esTreeNodeToTSNodeMap: ParserServices[\"esTreeNodeToTSNodeMap\"],\n): unknown {\n return hasNode(esTreeNodeToTSNodeMap, node) ? esTreeNodeToTSNodeMap.get(node as never) : node;\n}\n\nfunction hasNode(\n esTreeNodeToTSNodeMap: ParserServices[\"esTreeNodeToTSNodeMap\"],\n node: unknown,\n): boolean {\n return typeof node === \"object\" && node !== null && esTreeNodeToTSNodeMap.has(node as never);\n}\n\nfunction fallbackTypeText(type: unknown): string {\n const name = (type as { readonly name?: unknown }).name;\n return typeof name === \"string\" || typeof name === \"number\" || typeof name === \"boolean\"\n ? String(name)\n : \"\";\n}\n\nfunction heritageTypes(\n type: unknown,\n checker: Record<string, unknown>,\n keyword: \"extends\" | \"implements\",\n): readonly never[] {\n const declarations = asReadonlyArray(\n (type as { readonly symbol?: { readonly declarations?: unknown } }).symbol?.declarations,\n );\n return declarations.flatMap((declaration) =>\n heritageTypesFromDeclaration(declaration, checker, keyword),\n );\n}\n\n/**\n * Mirrors the tsgo-backed `getImplementedTypesOfType` behaviour by walking the\n * base-type chain so a class that implements an interface only through a base\n * class still reports that interface. Without this, a rule shared between\n * oxlint (tsgo) and ESLint (this `@typescript-eslint` fallback checker) would\n * see different implemented types for the same source (GH#207).\n *\n * The traversal is a DFS so we can use `pop()` (O(1)) instead of a queue with\n * `shift()` (O(n)) — visit order doesn't matter because we dedupe implemented\n * types by identity. We also `continue` on already-visited bases before\n * touching `Set.add`, so a deep diamond hierarchy never quadruples work.\n */\nfunction implementedTypesIncludingBases(\n type: unknown,\n checker: Record<string, unknown>,\n): readonly never[] {\n if (type === undefined || type === null) {\n return [];\n }\n const visited = new Set<unknown>();\n const seenImplemented = new Set<unknown>();\n const implemented: never[] = [];\n const stack: unknown[] = [type];\n while (stack.length > 0) {\n const current = stack.pop();\n if (current === undefined || current === null || visited.has(current)) {\n continue;\n }\n visited.add(current);\n const ownImplemented = heritageTypes(current, checker, \"implements\");\n for (let index = 0; index < ownImplemented.length; index += 1) {\n const ownType = ownImplemented[index];\n if (seenImplemented.has(ownType)) {\n continue;\n }\n seenImplemented.add(ownType);\n implemented.push(ownType);\n }\n const directBases = asReadonlyArray(callChecker(checker, \"getBaseTypes\", current));\n const bases = directBases.length > 0 ? directBases : heritageTypes(current, checker, \"extends\");\n for (let index = bases.length - 1; index >= 0; index -= 1) {\n const baseType = bases[index];\n if (baseType === undefined || baseType === null || visited.has(baseType)) {\n continue;\n }\n stack.push(baseType);\n }\n }\n return implemented;\n}\n\nfunction heritageTypesFromDeclaration(\n declaration: unknown,\n checker: Record<string, unknown>,\n keyword: \"extends\" | \"implements\",\n): readonly never[] {\n const clauses = asReadonlyArray(\n (declaration as { readonly heritageClauses?: unknown }).heritageClauses,\n );\n return clauses\n .filter((clause) => heritageClauseText(clause).trimStart().startsWith(keyword))\n .flatMap((clause) => asReadonlyArray((clause as { readonly types?: unknown }).types))\n .map((node) => {\n const expression = (node as { readonly expression?: unknown }).expression ?? node;\n return callChecker(checker, \"getTypeAtLocation\", expression);\n })\n .filter((type): type is never => type !== undefined);\n}\n\nfunction heritageClauseText(clause: unknown): string {\n const getText = (clause as { readonly getText?: unknown }).getText;\n return typeof getText === \"function\" ? String(getText.call(clause)) : \"\";\n}\n\nfunction resolveEslintParserServices(\n context: ContextWithParserOptions,\n): ParserServices | undefined {\n const candidates = [context.parserServices, context.sourceCode.parserServices] as const;\n for (const candidate of candidates) {\n if (hasEslintParserServices(candidate)) {\n return candidate;\n }\n }\n return undefined;\n}\n\nfunction hasEslintParserServices(value: unknown): value is ParserServices {\n return Boolean(\n value &&\n typeof value === \"object\" &&\n \"program\" in value &&\n \"esTreeNodeToTSNodeMap\" in value &&\n \"tsNodeToESTreeNodeMap\" in value,\n );\n}\n"],"mappings":";;;;AAUA,MAAM,iCAAiB,IAAI,SAAiC;;;;;;;;;;AAW5D,SAAgB,kBACd,SACA,kCAAkC,OAClB;CAChB,MAAM,UAAU,eAAe,IAAI,QAAQ;CAC3C,IAAI,SACF,OAAO;CAET,MAAM,gBAAgB,8BAA8B,QAAQ;CAC5D,MAAM,uBAAuB,4BAA4B,QAAQ;CACjE,IAAI,CAAC,cAAc,SAAS,sBAAsB;EAChD,MAAM,WAAW,2BAA2B,qBAAqB;EACjE,eAAe,IAAI,SAAS,SAAS;EACrC,OAAO;;CAET,IAAI;EACF,MAAM,OAAO,eAAe,QAAQ;EAEpC,MAAM,WAA8C;GAClD,SAFc,cAAc,QAErB;GACP,GAAG;GACH,wBAAwB;GACxB,kBAAkB,MAAM;IACtB,OAAO,kBAAkB,QAAQ,CAAC,kBAAkB,KAAK;;GAE3D,oBAAoB,MAAM;IACxB,OAAO,kBAAkB,QAAQ,CAAC,oBAAoB,KAAK;;GAE9D;EACD,eAAe,IAAI,SAAS,SAAS;EACrC,OAAO;UACA,OAAO;EACd,IAAI,CAAC,iCACH,MAAM;EAER,MAAM,WAA2B;GAC/B,SAAS,cAAc,QAAQ;GAC/B,GAAG,eAAe,QAAQ;GAC1B,wBAAwB;GACxB,oBAAoB;GAGpB,sBAAsB;GAGvB;EACD,eAAe,IAAI,SAAS,SAAS;EACrC,OAAO;;;AAIX,SAAS,2BACP,gBACmC;CACnC,MAAM,UAAU,w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qBADR,KAA2C,cAAc,KACjB;GAC5D,CACD,QAAQ,SAAwB,SAAS,KAAA,EAAU;;AAGxD,SAAS,mBAAmB,QAAyB;CACnD,MAAM,UAAW,OAA0C;CAC3D,OAAO,OAAO,YAAY,aAAa,OAAO,QAAQ,KAAK,OAAO,CAAC,GAAG;;AAGxE,SAAS,4BACP,SAC4B;CAC5B,MAAM,aAAa,CAAC,QAAQ,gBAAgB,QAAQ,WAAW,eAAe;CAC9E,KAAK,MAAM,aAAa,YACtB,IAAI,wBAAwB,UAAU,EACpC,OAAO;;AAMb,SAAS,wBAAwB,OAAyC;CACxE,OAAO,QACL,SACA,OAAO,UAAU,YACjB,aAAa,SACb,2BAA2B,SAC3B,2BAA2B,MAC5B"}
package/dist/session.d.ts CHANGED
@@ -13,6 +13,7 @@ declare class CorsaProjectSession {
13
13
  getTypeAtSourceRange(fileName: string, start: number, end: number, sourceText: string | undefined, kind: string | undefined): CorsaType | undefined;
14
14
  getSymbolAtPosition(fileName: string, position: number, sourceText?: string): CorsaSymbol | undefined;
15
15
  getSymbol(symbol: string | CorsaSymbol): CorsaSymbol | undefined;
16
+ getSymbolOfType(type: CorsaType): CorsaSymbol | undefined;
16
17
  getNode(node: string | CorsaNode): CorsaNode | undefined;
17
18
  getSourceTextForPath(path: string): string | undefined;
18
19
  getTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined;
@@ -44,6 +45,7 @@ declare class CorsaProjectSession {
44
45
  private rememberType;
45
46
  private rememberTypes;
46
47
  private rememberTypeSource;
48
+ private rememberTypeSourceRange;
47
49
  private cacheTypeText;
48
50
  private typeTexts;
49
51
  private rememberSymbol;
package/dist/session.js CHANGED
@@ -31,6 +31,7 @@ var CorsaProjectSession = class {
31
31
  #typeSourceById = /* @__PURE__ */ new Map();
32
32
  #typeTextById = /* @__PURE__ */ new Map();
33
33
  #lastRefreshMs = 0;
34
+ #snapshotHasIssuedHandles = false;
34
35
  #supportsOverlayChanges;
35
36
  constructor(project, runtime) {
36
37
  this.project = project;
@@ -71,11 +72,14 @@ var CorsaProjectSession = class {
71
72
  const key = `${start}:${end}:${kind ?? ""}`;
72
73
  if (!state.typeBySourceRange.has(key)) state.typeBySourceRange.set(key, this.client().getTypeAtSourceRange(this.#snapshot, state.projectId, fileName, start, end, sourceText, kind));
73
74
  const type = this.rememberType(state.typeBySourceRange.get(key));
74
- if (type) this.#typeLookupById.set(type.id, {
75
- fileName,
76
- position: start,
77
- sourceText
78
- });
75
+ if (type) {
76
+ this.#typeLookupById.set(type.id, {
77
+ fileName,
78
+ position: start,
79
+ sourceText
80
+ });
81
+ if (kind !== "Identifier") this.rememberTypeSourceRange(type, fileName, start, end, sourceText);
82
+ }
79
83
  return type;
80
84
  }
81
85
  getSymbolAtPosition(fileName, position, sourceText) {
@@ -91,12 +95,17 @@ var CorsaProjectSession = class {
91
95
  if (cached) return cached;
92
96
  const typeId = this.#symbolTypeById.get(symbol);
93
97
  if (!typeId || !this.#snapshot) return;
94
- const resolved = this.client().callJson("getSymbolOfType", {
95
- snapshot: this.#snapshot,
96
- type: typeId
97
- });
98
+ const resolved = this.client().getSymbolOfType(this.#snapshot, typeId);
98
99
  return resolved?.id === symbol ? this.rememberSymbol(resolved) : void 0;
99
100
  }
101
+ getSymbolOfType(type) {
102
+ if (type.symbol) {
103
+ const symbol = this.getSymbol(type.symbol);
104
+ if (symbol) return symbol;
105
+ }
106
+ if (!this.#snapshot) return;
107
+ return this.rememberSymbol(this.client().getSymbolOfType(this.#snapshot, type.id));
108
+ }
100
109
  getNode(node) {
101
110
  if (typeof node !== "string") return node;
102
111
  return this.#nodesById.get(node) ?? this.rememberNode(node);
@@ -263,6 +272,7 @@ var CorsaProjectSession = class {
263
272
  return this.#typeSourceById.get(type.id);
264
273
  }
265
274
  rememberType(type) {
275
+ if (type) this.#snapshotHasIssuedHandles = true;
266
276
  if (type?.symbol) this.#symbolTypeById.set(type.symbol, type.id);
267
277
  if (type?.texts?.[0]) this.#typeTextById.set(type.id, type.texts[0]);
268
278
  return type;
@@ -276,6 +286,19 @@ var CorsaProjectSession = class {
276
286
  const source = this.sourceSliceForHandle(handle);
277
287
  if (source) this.#typeSourceById.set(type.id, source);
278
288
  }
289
+ rememberTypeSourceRange(type, fileName, start, end, sourceText) {
290
+ if (this.#typeSourceById.has(type.id) || !sourceText || start < 0 || end > sourceText.length || start >= end) return;
291
+ const node = {
292
+ fileName,
293
+ pos: start,
294
+ end,
295
+ range: [start, end]
296
+ };
297
+ this.#typeSourceById.set(type.id, {
298
+ node,
299
+ text: sourceText.slice(start, end)
300
+ });
301
+ }
279
302
  cacheTypeText(type) {
280
303
  if (!type || this.#typeTextById.has(type.id)) return;
281
304
  try {
@@ -289,6 +312,7 @@ var CorsaProjectSession = class {
289
312
  }
290
313
  rememberSymbol(symbol) {
291
314
  if (!symbol) return symbol;
315
+ this.#snapshotHasIssuedHandles = true;
292
316
  const synthetic = this.#syntheticSymbolsById.get(symbol.id);
293
317
  if (synthetic) return synthetic;
294
318
  this.#symbolsById.set(symbol.id, symbol);
@@ -344,6 +368,7 @@ var CorsaProjectSession = class {
344
368
  this.#nodesById.clear();
345
369
  this.#typeLookupById.clear();
346
370
  this.#typeSourceById.clear();
371
+ this.#snapshotHasIssuedHandles = false;
347
372
  }
348
373
  parameterInfosForDeclaration(handle, expectedCount) {
349
374
  const source = this.sourceSliceForHandle(handle);
@@ -422,7 +447,7 @@ var CorsaProjectSession = class {
422
447
  lintSourceText: sourceText,
423
448
  sourceText: overlayText
424
449
  };
425
- if (!(!this.#snapshot || mtimeChanged || textChanged || expired)) return prepared;
450
+ if (!(!this.#snapshot || mtimeChanged || textChanged || expired && !this.#snapshotHasIssuedHandles)) return prepared;
426
451
  const previous = this.#snapshot;
427
452
  const overlayChanges = this.overlayChanges(fileName, overlayText, cached);
428
453
  const response = this.client().updateSnapshot({
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","names":["#snapshot","#client","#supportsOverlayChanges","#files","#typeTextById","#typeLookupById","#syntheticSymbolsById","#symbolsById","#symbolTypeById","#nodesById","#typeSourceById","#config","#lastRefreshMs","#projects"],"sources":["../ts/session.ts"],"sourcesContent":["import { readFileSync, statSync } from \"node:fs\";\n\nimport { type ProjectResponse, CorsaApiClient } from \"@corsa-bind/napi\";\n\nimport type {\n CorsaNode,\n CorsaSignature,\n CorsaSymbol,\n CorsaType,\n CorsaTypePredicate,\n} from \"./types\";\nimport type { ResolvedProjectConfig, ResolvedRuntimeOptions } from \"./types\";\n\ntype FileCache = {\n mtimeMs: number;\n lintSourceText?: string;\n sourceText?: string;\n projectId: string;\n typeByPosition: Map<number, CorsaType | undefined>;\n typeBySourceRange: Map<string, CorsaType | undefined>;\n symbolByPosition: Map<number, CorsaSymbol | undefined>;\n};\n\ntype PreparedFileState = {\n mtimeMs: number;\n lintSourceText?: string;\n sourceText?: string;\n};\n\ntype SourceSlice = {\n node: CorsaNode;\n text: string;\n};\n\ntype TypeLookup = {\n fileName: string;\n position: number;\n sourceText?: string;\n};\n\ntype ParameterInfo = {\n name: string;\n node: CorsaNode;\n};\n\nconst typeFlags = {\n object: 1 << 20,\n index: 1 << 21,\n templateLiteral: 1 << 22,\n stringMapping: 1 << 23,\n substitution: 1 << 24,\n indexedAccess: 1 << 25,\n conditional: 1 << 26,\n union: 1 << 27,\n intersection: 1 << 28,\n} as const;\n\nconst objectFlags = {\n classOrInterface: (1 << 0) | (1 << 1),\n reference: 1 << 2,\n mapped: 1 << 5,\n} as const;\n\nexport class CorsaProjectSession {\n #client?: CorsaApiClient;\n #config?: { options: unknown; fileNames: string[] };\n #snapshot?: string;\n #projects: ProjectResponse[] = [];\n #files = new Map<string, FileCache>();\n #symbolsById = new Map<string, CorsaSymbol>();\n #syntheticSymbolsById = new Map<string, CorsaSymbol>();\n #symbolTypeById = new Map<string, string>();\n #nodesById = new Map<string, CorsaNode>();\n #typeLookupById = new Map<string, TypeLookup>();\n #typeSourceById = new Map<string, SourceSlice>();\n #typeTextById = new Map<string, string>();\n #lastRefreshMs = 0;\n #supportsOverlayChanges?: boolean;\n\n constructor(\n readonly project: ResolvedProjectConfig,\n readonly runtime: ResolvedRuntimeOptions,\n ) {}\n\n close(): void {\n if (this.#snapshot) {\n this.#client?.releaseHandle(this.#snapshot);\n this.#snapshot = undefined;\n }\n this.#client?.close();\n this.#client = undefined;\n this.#supportsOverlayChanges = undefined;\n this.#files.clear();\n this.clearHandleCaches();\n this.#typeTextById.clear();\n }\n\n getCompilerOptions(): unknown {\n return this.config().options;\n }\n\n getRootFileNames(): readonly string[] {\n return this.config().fileNames;\n }\n\n getTypeAtPosition(\n fileName: string,\n position: number,\n sourceText?: string,\n ): CorsaType | undefined {\n const state = this.fileState(fileName, sourceText);\n if (!state.typeByPosition.has(position)) {\n state.typeByPosition.set(\n position,\n this.client().getTypeAtPosition(this.#snapshot!, state.projectId, fileName, position) as\n | CorsaType\n | undefined,\n );\n }\n const type = this.rememberType(state.typeByPosition.get(position));\n if (type) {\n this.#typeLookupById.set(type.id, { fileName, position, sourceText });\n }\n return type;\n }\n\n getTypeAtSourceRange(\n fileName: string,\n start: number,\n end: number,\n sourceText: string | undefined,\n kind: string | undefined,\n ): CorsaType | undefined {\n if (!sourceText || end <= start) {\n return this.getTypeAtPosition(fileName, start, sourceText);\n }\n const state = this.fileState(fileName, sourceText);\n const key = `${start}:${end}:${kind ?? \"\"}`;\n if (!state.typeBySourceRange.has(key)) {\n state.typeBySourceRange.set(\n key,\n this.client().getTypeAtSourceRange(\n this.#snapshot!,\n state.projectId,\n fileName,\n start,\n end,\n sourceText,\n kind,\n ) as CorsaType | undefined,\n );\n }\n const type = this.rememberType(state.typeBySourceRange.get(key));\n if (type) {\n this.#typeLookupById.set(type.id, { fileName, position: start, sourceText });\n }\n return type;\n }\n\n getSymbolAtPosition(\n fileName: string,\n position: number,\n sourceText?: string,\n ): CorsaSymbol | undefined {\n const state = this.fileState(fileName, sourceText);\n if (!state.symbolByPosition.has(position)) {\n state.symbolByPosition.set(\n position,\n this.client().getSymbolAtPosition(this.#snapshot!, state.projectId, fileName, position) as\n | CorsaSymbol\n | undefined,\n );\n }\n return this.rememberSymbol(state.symbolByPosition.get(position));\n }\n\n getSymbol(symbol: string | CorsaSymbol): CorsaSymbol | undefined {\n if (typeof symbol !== \"string\") {\n return this.rememberSymbol(symbol);\n }\n const synthetic = this.#syntheticSymbolsById.get(symbol);\n if (synthetic) {\n return synthetic;\n }\n const cached = this.#symbolsById.get(symbol);\n if (cached) {\n return cached;\n }\n const typeId = this.#symbolTypeById.get(symbol);\n if (!typeId || !this.#snapshot) {\n return undefined;\n }\n const resolved = this.client().callJson<CorsaSymbol | null>(\"getSymbolOfType\", {\n snapshot: this.#snapshot,\n type: typeId,\n });\n return resolved?.id === symbol ? this.rememberSymbol(resolved) : undefined;\n }\n\n getNode(node: string | CorsaNode): CorsaNode | undefined {\n if (typeof node !== \"string\") {\n return node;\n }\n return this.#nodesById.get(node) ?? this.rememberNode(node);\n }\n\n getSourceTextForPath(path: string): string | undefined {\n return this.sourceTextForPath(path);\n }\n\n getTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined {\n const type = this.rememberType(this.tryGetSymbolType(symbol, \"getTypeOfSymbol\"));\n this.rememberTypeSource(type, symbol.valueDeclaration);\n return type;\n }\n\n getDeclaredTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined {\n const type = this.rememberType(this.tryGetSymbolType(symbol, \"getDeclaredTypeOfSymbol\"));\n this.rememberTypeSource(type, symbol.valueDeclaration);\n return type;\n }\n\n typeToString(type: CorsaType, flags?: number): string {\n try {\n const text = this.client().typeToString(\n this.#snapshot!,\n this.projectId(),\n type.id,\n undefined,\n flags,\n );\n if (flags === undefined) {\n this.#typeTextById.set(type.id, text);\n }\n return text;\n } catch (error) {\n const cached = flags === undefined ? this.#typeTextById.get(type.id) : undefined;\n if (cached !== undefined) {\n return cached;\n }\n throw error;\n }\n }\n\n // Seeds the type-text cache from a name the caller already knows (for\n // example the identifier in an `implements` clause). Implemented-interface\n // handles come back with empty `texts`, and upstream Corsa sometimes evicts\n // them from its snapshot registry before `typeToString` runs, so warming the\n // cache here lets `typeToString` fall back to the source name instead of\n // throwing (GH#211). Never overwrites a value the server already provided.\n rememberTypeText(typeId: string, text: string): void {\n if (!this.#typeTextById.has(typeId)) {\n this.#typeTextById.set(typeId, text);\n }\n }\n\n getBaseTypeOfLiteralType(type: CorsaType): CorsaType | undefined {\n return this.rememberType(\n this.client().callJson(\"getBaseTypeOfLiteralType\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n }),\n );\n }\n\n getPropertiesOfType(type: CorsaType): readonly CorsaSymbol[] {\n return this.rememberSymbols(\n this.client().callJson(\"getPropertiesOfType\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n }) ?? [],\n );\n }\n\n getSignaturesOfType(type: CorsaType, kind: number): readonly CorsaSignature[] {\n return this.rememberSignatures(\n this.client().callJson(\"getSignaturesOfType\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n kind,\n }) ?? [],\n );\n }\n\n getReturnTypeOfSignature(signature: CorsaSignature): CorsaType | undefined {\n return this.rememberType(\n this.client().callJson(\"getReturnTypeOfSignature\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n signature: signature.id,\n }),\n );\n }\n\n getTypePredicateOfSignature(signature: CorsaSignature): CorsaTypePredicate | undefined {\n const predicate = this.client().callJson<CorsaTypePredicate | undefined>(\n \"getTypePredicateOfSignature\",\n {\n snapshot: this.#snapshot,\n project: this.projectId(),\n signature: signature.id,\n },\n );\n if (predicate?.type) {\n this.rememberType(predicate.type);\n }\n return predicate;\n }\n\n getBaseTypes(type: CorsaType): readonly CorsaType[] {\n if (isArrayOrTupleLikeType(this, type)) {\n return [];\n }\n try {\n return this.rememberTypes(\n this.client().callJson(\"getBaseTypes\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n texts: this.typeTexts(type),\n }) ?? [],\n );\n } catch (error) {\n // Upstream Corsa occasionally drops a type handle from its snapshot\n // registry after the first base-types query on a class that has no\n // explicit `extends` clause. Treating that as \"no base types\" lets a\n // follow-up `getImplementedTypesOfType` on the same handle still report\n // the type's own `implements` clause instead of throwing (GH#206).\n if (isProtocolPanicError(error) || isStaleHandleError(error)) {\n return [];\n }\n throw error;\n }\n }\n\n getTypeArguments(type: CorsaType): readonly CorsaType[] {\n const source = this.sourceSliceForType(type);\n return this.rememberTypes(\n source\n ? (this.client().getTypeArgumentsAtSourceRange(\n this.#snapshot!,\n this.projectId(),\n type.id,\n type.objectFlags,\n source.node.fileName,\n source.node.pos,\n source.node.end,\n this.sourceTextForPath(source.node.fileName) ?? \"\",\n ) as unknown as readonly CorsaType[])\n : (this.client().getTypeArguments(\n this.#snapshot!,\n this.projectId(),\n type.id,\n type.objectFlags,\n ) as unknown as readonly CorsaType[]),\n );\n }\n\n getTypesOfType(type: CorsaType): readonly CorsaType[] {\n if (\n (type.flags & (typeFlags.union | typeFlags.intersection | typeFlags.templateLiteral)) ===\n 0\n ) {\n return [];\n }\n return this.callTypeArray(\"getTypesOfType\", type);\n }\n\n getTargetOfType(type: CorsaType): CorsaType | undefined {\n if (\n (type.flags & (typeFlags.index | typeFlags.stringMapping)) === 0 &&\n ((type.objectFlags ?? 0) & (objectFlags.reference | objectFlags.mapped)) === 0\n ) {\n return undefined;\n }\n const target = this.callType(\"getTargetOfType\", type);\n this.cacheTypeText(target);\n return target;\n }\n\n getTypeParametersOfType(type: CorsaType): readonly CorsaType[] {\n const flags = type.objectFlags ?? 0;\n if ((type.flags & typeFlags.object) === 0 || (flags & objectFlags.classOrInterface) === 0) {\n return [];\n }\n return this.callTypeArray(\"getTypeParametersOfType\", type);\n }\n\n getOuterTypeParametersOfType(type: CorsaType): readonly CorsaType[] {\n const flags = type.objectFlags ?? 0;\n if ((type.flags & typeFlags.object) === 0 || (flags & objectFlags.classOrInterface) === 0) {\n return [];\n }\n return this.callTypeArray(\"getOuterTypeParametersOfType\", type);\n }\n\n getLocalTypeParametersOfType(type: CorsaType): readonly CorsaType[] {\n const flags = type.objectFlags ?? 0;\n if ((type.flags & typeFlags.object) === 0 || (flags & objectFlags.classOrInterface) === 0) {\n return [];\n }\n return this.callTypeArray(\"getLocalTypeParametersOfType\", type);\n }\n\n getObjectTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.indexedAccess) !== 0\n ? this.callType(\"getObjectTypeOfType\", type)\n : undefined;\n }\n\n getIndexTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.indexedAccess) !== 0\n ? this.callType(\"getIndexTypeOfType\", type)\n : undefined;\n }\n\n getCheckTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.conditional) !== 0\n ? this.callType(\"getCheckTypeOfType\", type)\n : undefined;\n }\n\n getExtendsTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.conditional) !== 0\n ? this.callType(\"getExtendsTypeOfType\", type)\n : undefined;\n }\n\n getBaseTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.substitution) !== 0\n ? this.callType(\"getBaseTypeOfType\", type)\n : undefined;\n }\n\n getConstraintOfType(type: CorsaType): CorsaType | undefined {\n return this.rememberType(\n this.client().getConstraintOfType(this.#snapshot!, this.projectId(), type.id) as\n | CorsaType\n | undefined,\n );\n }\n\n private callType(method: string, type: CorsaType): CorsaType | undefined {\n return this.rememberType(\n this.client().callJson<CorsaType | null>(method, {\n snapshot: this.#snapshot,\n type: type.id,\n }) ?? undefined,\n );\n }\n\n private callTypeArray(method: string, type: CorsaType): readonly CorsaType[] {\n return this.rememberTypes(\n this.client().callJson<readonly CorsaType[] | null>(method, {\n snapshot: this.#snapshot,\n type: type.id,\n }) ?? [],\n );\n }\n\n private tryGetSymbolType(\n symbol: CorsaSymbol,\n method: \"getTypeOfSymbol\" | \"getDeclaredTypeOfSymbol\",\n ): CorsaType | undefined {\n try {\n return this.client()[method](this.#snapshot!, this.projectId(), symbol.id) as\n | CorsaType\n | undefined;\n } catch {\n return undefined;\n }\n }\n\n private sourceSliceForType(type: CorsaType): SourceSlice | undefined {\n const cached = this.#typeSourceById.get(type.id);\n if (cached) {\n return cached;\n }\n const lookup = this.#typeLookupById.get(type.id);\n if (lookup) {\n const symbol = this.getSymbolAtPosition(lookup.fileName, lookup.position, lookup.sourceText);\n this.rememberTypeSource(type, symbol?.valueDeclaration);\n const fromLookup = this.#typeSourceById.get(type.id);\n if (fromLookup) {\n return fromLookup;\n }\n }\n if (type.symbol) {\n const symbol = this.getSymbol(type.symbol);\n this.rememberTypeSource(type, symbol?.valueDeclaration);\n }\n return this.#typeSourceById.get(type.id);\n }\n\n private rememberType<T extends CorsaType | undefined>(type: T): T {\n if (type?.symbol) {\n this.#symbolTypeById.set(type.symbol, type.id);\n }\n if (type?.texts?.[0]) {\n this.#typeTextById.set(type.id, type.texts[0]);\n }\n return type;\n }\n\n private rememberTypes<T extends readonly CorsaType[]>(types: T): T {\n for (const type of types) {\n this.rememberType(type);\n }\n return types;\n }\n\n private rememberTypeSource(type: CorsaType | undefined, handle: string | undefined): void {\n if (!type || !handle || this.#typeSourceById.has(type.id)) {\n return;\n }\n const source = this.sourceSliceForHandle(handle);\n if (source) {\n this.#typeSourceById.set(type.id, source);\n }\n }\n\n private cacheTypeText(type: CorsaType | undefined): void {\n if (!type || this.#typeTextById.has(type.id)) {\n return;\n }\n try {\n this.#typeTextById.set(\n type.id,\n this.client().typeToString(this.#snapshot!, this.projectId(), type.id),\n );\n } catch {\n // Some upstream handles are only renderable before a later relation query.\n }\n }\n\n private typeTexts(type: CorsaType): readonly string[] {\n if (Array.isArray(type.texts) && type.texts.length > 0) {\n return type.texts;\n }\n const cached = this.#typeTextById.get(type.id);\n return cached === undefined ? [] : [cached];\n }\n\n private rememberSymbol<T extends CorsaSymbol | undefined>(symbol: T): T {\n if (!symbol) {\n return symbol;\n }\n const synthetic = this.#syntheticSymbolsById.get(symbol.id);\n if (synthetic) {\n return synthetic as T;\n }\n this.#symbolsById.set(symbol.id, symbol);\n for (const declaration of symbol.declarations ?? []) {\n this.rememberNode(declaration);\n }\n if (symbol.valueDeclaration) {\n this.rememberNode(symbol.valueDeclaration);\n }\n return symbol;\n }\n\n private rememberSymbols<T extends readonly CorsaSymbol[]>(symbols: T): T {\n for (const symbol of symbols) {\n this.rememberSymbol(symbol);\n }\n return symbols;\n }\n\n private rememberSignatures<T extends readonly CorsaSignature[]>(signatures: T): T {\n for (const signature of signatures) {\n this.rememberSignature(signature);\n }\n return signatures;\n }\n\n private rememberSignature(signature: CorsaSignature): CorsaSignature {\n if (signature.declaration) {\n this.rememberNode(signature.declaration);\n }\n const parameterIds = Array.isArray(signature.parameters) ? signature.parameters : [];\n const parameters = signature.declaration\n ? this.parameterInfosForDeclaration(signature.declaration, parameterIds.length)\n : [];\n parameterIds.forEach((id, index) => {\n this.rememberSyntheticSymbol(id, parameters[index]);\n });\n if (signature.thisParameter) {\n this.rememberSyntheticSymbol(signature.thisParameter, undefined, \"this\");\n }\n return signature;\n }\n\n private rememberSyntheticSymbol(\n id: string,\n parameter?: ParameterInfo,\n fallbackName = \"\",\n ): CorsaSymbol {\n const cached = this.#syntheticSymbolsById.get(id);\n if (cached && (cached.name || !parameter?.name)) {\n return cached;\n }\n const declaration = parameter?.node.id;\n const symbol: CorsaSymbol = {\n id,\n name: parameter?.name ?? fallbackName,\n flags: cached?.flags ?? 0,\n checkFlags: cached?.checkFlags ?? 0,\n declarations: declaration ? [declaration] : (cached?.declarations ?? []),\n valueDeclaration: declaration ?? cached?.valueDeclaration,\n };\n this.#syntheticSymbolsById.set(id, symbol);\n this.#symbolsById.set(id, symbol);\n if (declaration) {\n this.#nodesById.set(declaration, parameter.node);\n }\n return symbol;\n }\n\n private rememberNode(handle: string): CorsaNode | undefined {\n const parsed = parseNodeHandle(handle);\n if (!parsed) {\n return undefined;\n }\n this.#nodesById.set(handle, parsed);\n return parsed;\n }\n\n private clearHandleCaches(): void {\n this.#symbolsById.clear();\n this.#syntheticSymbolsById.clear();\n this.#symbolTypeById.clear();\n this.#nodesById.clear();\n this.#typeLookupById.clear();\n this.#typeSourceById.clear();\n }\n\n private parameterInfosForDeclaration(\n handle: string,\n expectedCount: number,\n ): readonly ParameterInfo[] {\n const source = this.sourceSliceForHandle(handle);\n if (!source) {\n return this.parameterInfosForUtf8ByteDeclaration(handle);\n }\n const parameters = parameterInfosForSource(source);\n if (parameters.length >= expectedCount || expectedCount === 0) {\n return parameters;\n }\n const utf8Parameters = this.parameterInfosForUtf8ByteDeclaration(handle);\n return utf8Parameters.length > parameters.length ? utf8Parameters : parameters;\n }\n\n private parameterInfosForUtf8ByteDeclaration(handle: string): readonly ParameterInfo[] {\n const source = this.sourceSliceForHandle(handle, \"utf8-byte\");\n return source ? parameterInfosForSource(source) : [];\n }\n\n private sourceSliceForHandle(\n handle: string,\n offsetUnit: \"utf16\" | \"utf8-byte\" = \"utf16\",\n ): SourceSlice | undefined {\n const node = this.getNode(handle);\n if (!node) {\n return undefined;\n }\n const sourceText = this.sourceTextForPath(node.fileName);\n const normalizedNode =\n offsetUnit === \"utf8-byte\" ? nodeFromUtf8ByteOffsets(node, sourceText) : node;\n if (\n !sourceText ||\n !normalizedNode ||\n normalizedNode.pos < 0 ||\n normalizedNode.end > sourceText.length ||\n normalizedNode.pos >= normalizedNode.end\n ) {\n return undefined;\n }\n return {\n node: normalizedNode,\n text: sourceText.slice(normalizedNode.pos, normalizedNode.end),\n };\n }\n\n private sourceTextForPath(path: string): string | undefined {\n for (const [fileName, cached] of this.#files) {\n if (fileName === path || fileName.endsWith(path)) {\n return cached.lintSourceText ?? cached.sourceText ?? readFileOrUndefined(fileName);\n }\n }\n return readFileOrUndefined(path) ?? readFileOrUndefined(`${this.runtime.cwd}/${path}`);\n }\n\n private client(): CorsaApiClient {\n if (!this.#client) {\n this.#client = CorsaApiClient.spawn({\n executable: this.runtime.executable,\n cwd: this.runtime.cwd,\n mode: this.runtime.mode,\n });\n this.#client.initialize();\n }\n return this.#client;\n }\n\n private config(): { options: unknown; fileNames: string[] } {\n if (!this.#config) {\n this.#config = this.client().parseConfigFile(this.project.configPath);\n }\n const config = this.#config;\n if (!config) {\n throw new Error(`corsa oxlint could not parse a Corsa config for ${this.project.configPath}`);\n }\n return config;\n }\n\n private fileState(fileName: string, sourceText?: string): FileCache {\n const prepared = this.refreshIfNeeded(fileName, sourceText);\n const current = this.#files.get(fileName);\n if (current) {\n return current;\n }\n const project = this.client().callJson<ProjectResponse | null>(\"getDefaultProjectForFile\", {\n snapshot: this.#snapshot,\n file: fileName,\n });\n const state: FileCache = {\n mtimeMs: prepared.mtimeMs,\n lintSourceText: prepared.lintSourceText,\n sourceText: prepared.sourceText,\n projectId: project?.id ?? this.projectId(),\n typeByPosition: new Map(),\n typeBySourceRange: new Map(),\n symbolByPosition: new Map(),\n };\n this.#files.set(fileName, state);\n return state;\n }\n\n private refreshIfNeeded(fileName: string, sourceText?: string): PreparedFileState {\n const now = Date.now();\n const expired = now - this.#lastRefreshMs > this.runtime.cacheLifetimeMs;\n const cached = this.#files.get(fileName);\n const mtimeMs = statMtimeMs(fileName);\n const overlayText = this.supportedOverlayText(fileName, sourceText, mtimeMs, cached);\n const mtimeChanged = cached !== undefined && mtimeMs !== cached.mtimeMs;\n const textChanged = overlayText !== cached?.sourceText;\n const prepared = {\n mtimeMs,\n lintSourceText: sourceText,\n sourceText: overlayText,\n };\n const stale = !this.#snapshot || mtimeChanged || textChanged || expired;\n if (!stale) {\n return prepared;\n }\n const previous = this.#snapshot;\n const overlayChanges = this.overlayChanges(fileName, overlayText, cached);\n const response = this.client().updateSnapshot({\n ...(previous\n ? { fileChanges: { changed: [fileName] } }\n : { openProject: this.project.configPath }),\n ...(overlayChanges === undefined ? {} : { overlayChanges }),\n });\n this.#snapshot = response.snapshot;\n this.#projects = response.projects;\n this.#lastRefreshMs = now;\n this.#files.clear();\n this.clearHandleCaches();\n if (previous && previous !== this.#snapshot) {\n this.client().releaseHandle(previous);\n }\n return prepared;\n }\n\n private projectId(): string {\n const id = this.#projects[0]?.id;\n if (!id) {\n throw new Error(\n `corsa oxlint could not resolve a Corsa project for ${this.project.filename}`,\n );\n }\n return id;\n }\n\n private supportedOverlayText(\n fileName: string,\n sourceText: string | undefined,\n mtimeMs: number,\n cached?: FileCache,\n ): string | undefined {\n if (sourceText === undefined || !this.supportsOverlayChanges()) {\n return undefined;\n }\n if (cached?.lintSourceText === sourceText && cached.mtimeMs === mtimeMs) {\n return cached.sourceText;\n }\n return overlayTextFor(fileName, sourceText);\n }\n\n private overlayChanges(\n fileName: string,\n overlayText: string | undefined,\n cached?: FileCache,\n ):\n | {\n upsert?: { document: string; text: string; languageId: string }[];\n delete?: string[];\n }\n | undefined {\n if (!this.supportsOverlayChanges()) {\n return undefined;\n }\n if (overlayText !== undefined) {\n return {\n upsert: [\n {\n document: fileName,\n text: overlayText,\n languageId: languageIdFor(fileName),\n },\n ],\n };\n }\n if (cached?.sourceText !== undefined) {\n return { delete: [fileName] };\n }\n return undefined;\n }\n\n private supportsOverlayChanges(): boolean {\n if (this.#supportsOverlayChanges !== undefined) {\n return this.#supportsOverlayChanges;\n }\n try {\n const capabilities = this.client().callJson<{\n overlay?: { updateSnapshotOverlayChanges?: boolean };\n }>(\"describeCapabilities\");\n this.#supportsOverlayChanges = capabilities?.overlay?.updateSnapshotOverlayChanges === true;\n } catch {\n this.#supportsOverlayChanges = false;\n }\n return this.#supportsOverlayChanges;\n }\n}\n\nfunction parameterInfosForSource(source: SourceSlice): readonly ParameterInfo[] {\n const open = findConstructorParameterOpen(source.text);\n if (open < 0) {\n return [];\n }\n const close = matchingCloseParen(source.text, open);\n if (close < 0) {\n return [];\n }\n const parametersText = source.text.slice(open + 1, close);\n return splitTopLevelRanges(parametersText, \",\")\n .map((range) => parameterInfoForText(source.node, parametersText, range, open + 1))\n .filter((parameter): parameter is ParameterInfo => parameter !== undefined);\n}\n\nfunction isArrayOrTupleLikeType(session: CorsaProjectSession, type: CorsaType): boolean {\n const texts =\n Array.isArray(type.texts) && type.texts.length > 0 ? type.texts : [session.typeToString(type)];\n return texts.some((text) => {\n const normalized = text.trimStart();\n return (\n normalized.startsWith(\"readonly [\") || normalized.startsWith(\"[\") || normalized.endsWith(\"[]\")\n );\n });\n}\n\nfunction findConstructorParameterOpen(text: string): number {\n const constructorPattern = /\\bconstructor\\s*\\(/g;\n let match: RegExpExecArray | null;\n let open = -1;\n while ((match = constructorPattern.exec(text)) !== null) {\n open = match.index + match[0].lastIndexOf(\"(\");\n }\n if (open >= 0) {\n return open;\n }\n return text.indexOf(\"(\");\n}\n\nfunction overlayTextFor(fileName: string, sourceText?: string): string | undefined {\n if (sourceText === undefined) {\n return undefined;\n }\n try {\n return readFileSync(fileName, \"utf8\") === sourceText ? undefined : sourceText;\n } catch {\n return sourceText;\n }\n}\n\nfunction isProtocolPanicError(error: unknown): boolean {\n const message = error instanceof Error ? error.message : String(error);\n return message.includes(\"protocol error: panic:\") || message.includes(\"panic: runtime error\");\n}\n\nfunction isStaleHandleError(error: unknown): boolean {\n const message = error instanceof Error ? error.message : String(error);\n return /handle \"[^\"]*\" not found in snapshot registry/.test(message);\n}\n\nfunction statMtimeMs(fileName: string): number {\n try {\n return statSync(fileName).mtimeMs;\n } catch {\n return 0;\n }\n}\n\nfunction languageIdFor(fileName: string): string {\n if (fileName.endsWith(\".tsx\")) {\n return \"typescriptreact\";\n }\n if (fileName.endsWith(\".jsx\")) {\n return \"javascriptreact\";\n }\n if (fileName.endsWith(\".js\")) {\n return \"javascript\";\n }\n return \"typescript\";\n}\n\nfunction parseNodeHandle(value: string): CorsaNode | undefined {\n const [posText, endText, _kindText, ...pathParts] = value.split(\".\");\n const pos = Number(posText);\n const end = Number(endText);\n const fileName = pathParts.join(\".\");\n if (!Number.isFinite(pos) || !Number.isFinite(end) || !fileName) {\n return undefined;\n }\n return { id: value, fileName, pos, end, range: [pos, end] };\n}\n\nfunction nodeFromUtf8ByteOffsets(\n node: CorsaNode,\n sourceText: string | undefined,\n): CorsaNode | undefined {\n if (sourceText === undefined) {\n return undefined;\n }\n const pos = utf16IndexFromUtf8ByteOffset(sourceText, node.pos);\n const end = utf16IndexFromUtf8ByteOffset(sourceText, node.end);\n if (pos === undefined || end === undefined || end < pos) {\n return undefined;\n }\n return {\n ...node,\n pos,\n end,\n range: [pos, end],\n };\n}\n\nfunction utf16IndexFromUtf8ByteOffset(text: string, byteOffset: number): number | undefined {\n if (!Number.isInteger(byteOffset) || byteOffset < 0) {\n return undefined;\n }\n let bytes = 0;\n for (let index = 0; index < text.length; ) {\n if (bytes === byteOffset) {\n return index;\n }\n const codePoint = text.codePointAt(index);\n if (codePoint === undefined) {\n break;\n }\n const nextBytes = bytes + utf8ByteLengthOfCodePoint(codePoint);\n if (nextBytes > byteOffset) {\n return undefined;\n }\n bytes = nextBytes;\n index += codePoint > 0xffff ? 2 : 1;\n }\n return bytes === byteOffset ? text.length : undefined;\n}\n\nfunction utf8ByteLengthOfCodePoint(codePoint: number): number {\n if (codePoint <= 0x7f) {\n return 1;\n }\n if (codePoint <= 0x7ff) {\n return 2;\n }\n if (codePoint <= 0xffff) {\n return 3;\n }\n return 4;\n}\n\nfunction parameterInfoForText(\n declarationNode: CorsaNode,\n parametersText: string,\n range: { readonly start: number; readonly end: number },\n parametersStart: number,\n): ParameterInfo | undefined {\n const raw = parametersText.slice(range.start, range.end);\n const leading = raw.search(/\\S/);\n if (leading < 0) {\n return undefined;\n }\n const trailing = raw.match(/\\s*$/)?.[0].length ?? 0;\n const text = raw.slice(leading, raw.length - trailing);\n const name = parameterNameForText(text);\n if (!name) {\n return undefined;\n }\n const pos = declarationNode.pos + parametersStart + range.start + leading;\n const end = declarationNode.pos + parametersStart + range.end - trailing;\n const id = `${pos}.${end}.0.${declarationNode.fileName}`;\n return {\n name,\n node: {\n id,\n fileName: declarationNode.fileName,\n pos,\n end,\n range: [pos, end],\n },\n };\n}\n\nfunction parameterNameForText(text: string): string | undefined {\n let candidate = text.trim().replace(/^\\.\\.\\.\\s*/, \"\");\n let changed = true;\n while (changed) {\n const previous = candidate;\n candidate = candidate.replace(\n /^(?:public|private|protected|readonly|override|static|abstract|declare)\\s+/,\n \"\",\n );\n changed = candidate !== previous;\n }\n const separator = firstTopLevelIndexOfAny(candidate, [\":\", \"=\"]);\n let left = (separator >= 0 ? candidate.slice(0, separator) : candidate).trim();\n if (left.endsWith(\"?\")) {\n left = left.slice(0, -1).trim();\n }\n if (left.startsWith(\"{\") || left.startsWith(\"[\")) {\n return left;\n }\n return left.split(/\\s+/).at(-1);\n}\n\nfunction matchingCloseParen(text: string, open: number): number {\n let depth = 0;\n const scanner = createScanner();\n for (let index = open; index < text.length; index += 1) {\n const char = text[index];\n if (scanner.inQuote(char)) {\n continue;\n }\n if (char === \"(\") {\n depth += 1;\n } else if (char === \")\") {\n depth -= 1;\n if (depth === 0) {\n return index;\n }\n }\n }\n return -1;\n}\n\nfunction splitTopLevelRanges(\n text: string,\n delimiter: string,\n): readonly { readonly start: number; readonly end: number }[] {\n const ranges: { start: number; end: number }[] = [];\n const scanner = createScanner();\n let start = 0;\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n if (scanner.inQuote(char)) {\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n char === delimiter &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n ranges.push({ start, end: index });\n start = index + 1;\n }\n }\n ranges.push({ start, end: text.length });\n return ranges;\n}\n\nfunction firstTopLevelIndexOfAny(text: string, needles: readonly string[]): number {\n const scanner = createScanner();\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n if (scanner.inQuote(char)) {\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n needles.includes(char) &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n return index;\n }\n }\n return -1;\n}\n\nfunction createScanner(): {\n inQuote(char: string): boolean;\n} {\n let quote: string | undefined;\n let escaped = false;\n return {\n inQuote(char) {\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = undefined;\n }\n return true;\n }\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n return true;\n }\n return false;\n },\n };\n}\n\nfunction readFileOrUndefined(path: string): string | undefined {\n try {\n return readFileSync(path, \"utf8\");\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;AA6CA,MAAM,YAAY;CAChB,QAAQ,KAAK;CACb,OAAO,KAAK;CACZ,iBAAiB,KAAK;CACtB,eAAe,KAAK;CACpB,cAAc,KAAK;CACnB,eAAe,KAAK;CACpB,aAAa,KAAK;CAClB,OAAO,KAAK;CACZ,cAAc,KAAK;CACpB;AAED,MAAM,cAAc;CAClB,kBAAkB;CAClB,WAAW;CACX,QAAQ;CACT;AAED,IAAa,sBAAb,MAAiC;CAC/B;CACA;CACA;CACA,YAA+B,EAAE;CACjC,yBAAS,IAAI,KAAwB;CACrC,+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EAAQ,CAAC;CACxC,OAAO;;AAGT,SAAS,wBAAwB,MAAc,SAAoC;CACjF,MAAM,UAAU,eAAe;CAC/B,IAAI,aAAa;CACjB,IAAI,aAAa;CACjB,IAAI,eAAe;CACnB,IAAI,aAAa;CACjB,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;EACnD,MAAM,OAAO,KAAK;EAClB,IAAI,QAAQ,QAAQ,KAAK,EACvB;EAEF,IAAI,SAAS,KAAK,cAAc;OAC3B,IAAI,SAAS,KAAK,aAAa,KAAK,IAAI,GAAG,aAAa,EAAE;OAC1D,IAAI,SAAS,KAAK,cAAc;OAChC,IAAI,SAAS,KAAK,aAAa,KAAK,IAAI,GAAG,aAAa,EAAE;OAC1D,IAAI,SAAS,KAAK,gBAAgB;OAClC,IAAI,SAAS,KAAK,eAAe,KAAK,IAAI,GAAG,eAAe,EAAE;OAC9D,IAAI,SAAS,KAAK,cAAc;OAChC,IAAI,SAAS,KAAK,aAAa,KAAK,IAAI,GAAG,aAAa,EAAE;OAC1D,IACH,QAAQ,SAAS,KAAK,IACtB,eAAe,KACf,eAAe,KACf,iBAAiB,KACjB,eAAe,GAEf,OAAO;;CAGX,OAAO;;AAGT,SAAS,gBAEP;CACA,IAAI;CACJ,IAAI,UAAU;CACd,OAAO,EACL,QAAQ,MAAM;EACZ,IAAI,OAAO;GACT,IAAI,SACF,UAAU;QACL,IAAI,SAAS,MAClB,UAAU;QACL,IAAI,SAAS,OAClB,QAAQ,KAAA;GAEV,OAAO;;EAET,IAAI,SAAS,QAAO,SAAS,OAAO,SAAS,KAAK;GAChD,QAAQ;GACR,OAAO;;EAET,OAAO;IAEV;;AAGH,SAAS,oBAAoB,MAAkC;CAC7D,IAAI;EACF,OAAO,aAAa,MAAM,OAAO;SAC3B;EACN"}
1
+ {"version":3,"file":"session.js","names":["#snapshot","#client","#supportsOverlayChanges","#files","#typeTextById","#typeLookupById","#syntheticSymbolsById","#symbolsById","#symbolTypeById","#nodesById","#typeSourceById","#snapshotHasIssuedHandles","#config","#lastRefreshMs","#projects"],"sources":["../ts/session.ts"],"sourcesContent":["import { readFileSync, statSync } from \"node:fs\";\n\nimport { type ProjectResponse, CorsaApiClient } from \"@corsa-bind/napi\";\n\nimport type {\n CorsaNode,\n CorsaSignature,\n CorsaSymbol,\n CorsaType,\n CorsaTypePredicate,\n} from \"./types\";\nimport type { ResolvedProjectConfig, ResolvedRuntimeOptions } from \"./types\";\n\ntype FileCache = {\n mtimeMs: number;\n lintSourceText?: string;\n sourceText?: string;\n projectId: string;\n typeByPosition: Map<number, CorsaType | undefined>;\n typeBySourceRange: Map<string, CorsaType | undefined>;\n symbolByPosition: Map<number, CorsaSymbol | undefined>;\n};\n\ntype PreparedFileState = {\n mtimeMs: number;\n lintSourceText?: string;\n sourceText?: string;\n};\n\ntype SourceSlice = {\n node: CorsaNode;\n text: string;\n};\n\ntype TypeLookup = {\n fileName: string;\n position: number;\n sourceText?: string;\n};\n\ntype ParameterInfo = {\n name: string;\n node: CorsaNode;\n};\n\nconst typeFlags = {\n object: 1 << 20,\n index: 1 << 21,\n templateLiteral: 1 << 22,\n stringMapping: 1 << 23,\n substitution: 1 << 24,\n indexedAccess: 1 << 25,\n conditional: 1 << 26,\n union: 1 << 27,\n intersection: 1 << 28,\n} as const;\n\nconst objectFlags = {\n classOrInterface: (1 << 0) | (1 << 1),\n reference: 1 << 2,\n mapped: 1 << 5,\n} as const;\n\nexport class CorsaProjectSession {\n #client?: CorsaApiClient;\n #config?: { options: unknown; fileNames: string[] };\n #snapshot?: string;\n #projects: ProjectResponse[] = [];\n #files = new Map<string, FileCache>();\n #symbolsById = new Map<string, CorsaSymbol>();\n #syntheticSymbolsById = new Map<string, CorsaSymbol>();\n #symbolTypeById = new Map<string, string>();\n #nodesById = new Map<string, CorsaNode>();\n #typeLookupById = new Map<string, TypeLookup>();\n #typeSourceById = new Map<string, SourceSlice>();\n #typeTextById = new Map<string, string>();\n #lastRefreshMs = 0;\n #snapshotHasIssuedHandles = false;\n #supportsOverlayChanges?: boolean;\n\n constructor(\n readonly project: ResolvedProjectConfig,\n readonly runtime: ResolvedRuntimeOptions,\n ) {}\n\n close(): void {\n if (this.#snapshot) {\n this.#client?.releaseHandle(this.#snapshot);\n this.#snapshot = undefined;\n }\n this.#client?.close();\n this.#client = undefined;\n this.#supportsOverlayChanges = undefined;\n this.#files.clear();\n this.clearHandleCaches();\n this.#typeTextById.clear();\n }\n\n getCompilerOptions(): unknown {\n return this.config().options;\n }\n\n getRootFileNames(): readonly string[] {\n return this.config().fileNames;\n }\n\n getTypeAtPosition(\n fileName: string,\n position: number,\n sourceText?: string,\n ): CorsaType | undefined {\n const state = this.fileState(fileName, sourceText);\n if (!state.typeByPosition.has(position)) {\n state.typeByPosition.set(\n position,\n this.client().getTypeAtPosition(this.#snapshot!, state.projectId, fileName, position) as\n | CorsaType\n | undefined,\n );\n }\n const type = this.rememberType(state.typeByPosition.get(position));\n if (type) {\n this.#typeLookupById.set(type.id, { fileName, position, sourceText });\n }\n return type;\n }\n\n getTypeAtSourceRange(\n fileName: string,\n start: number,\n end: number,\n sourceText: string | undefined,\n kind: string | undefined,\n ): CorsaType | undefined {\n if (!sourceText || end <= start) {\n return this.getTypeAtPosition(fileName, start, sourceText);\n }\n const state = this.fileState(fileName, sourceText);\n const key = `${start}:${end}:${kind ?? \"\"}`;\n if (!state.typeBySourceRange.has(key)) {\n state.typeBySourceRange.set(\n key,\n this.client().getTypeAtSourceRange(\n this.#snapshot!,\n state.projectId,\n fileName,\n start,\n end,\n sourceText,\n kind,\n ) as CorsaType | undefined,\n );\n }\n const type = this.rememberType(state.typeBySourceRange.get(key));\n if (type) {\n this.#typeLookupById.set(type.id, { fileName, position: start, sourceText });\n if (kind !== \"Identifier\") {\n this.rememberTypeSourceRange(type, fileName, start, end, sourceText);\n }\n }\n return type;\n }\n\n getSymbolAtPosition(\n fileName: string,\n position: number,\n sourceText?: string,\n ): CorsaSymbol | undefined {\n const state = this.fileState(fileName, sourceText);\n if (!state.symbolByPosition.has(position)) {\n state.symbolByPosition.set(\n position,\n this.client().getSymbolAtPosition(this.#snapshot!, state.projectId, fileName, position) as\n | CorsaSymbol\n | undefined,\n );\n }\n return this.rememberSymbol(state.symbolByPosition.get(position));\n }\n\n getSymbol(symbol: string | CorsaSymbol): CorsaSymbol | undefined {\n if (typeof symbol !== \"string\") {\n return this.rememberSymbol(symbol);\n }\n const synthetic = this.#syntheticSymbolsById.get(symbol);\n if (synthetic) {\n return synthetic;\n }\n const cached = this.#symbolsById.get(symbol);\n if (cached) {\n return cached;\n }\n const typeId = this.#symbolTypeById.get(symbol);\n if (!typeId || !this.#snapshot) {\n return undefined;\n }\n const resolved = this.client().getSymbolOfType(this.#snapshot, typeId) as CorsaSymbol | null;\n return resolved?.id === symbol ? this.rememberSymbol(resolved) : undefined;\n }\n\n getSymbolOfType(type: CorsaType): CorsaSymbol | undefined {\n if (type.symbol) {\n const symbol = this.getSymbol(type.symbol);\n if (symbol) {\n return symbol;\n }\n }\n if (!this.#snapshot) {\n return undefined;\n }\n return this.rememberSymbol(\n this.client().getSymbolOfType(this.#snapshot, type.id) as CorsaSymbol | undefined,\n );\n }\n\n getNode(node: string | CorsaNode): CorsaNode | undefined {\n if (typeof node !== \"string\") {\n return node;\n }\n return this.#nodesById.get(node) ?? this.rememberNode(node);\n }\n\n getSourceTextForPath(path: string): string | undefined {\n return this.sourceTextForPath(path);\n }\n\n getTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined {\n const type = this.rememberType(this.tryGetSymbolType(symbol, \"getTypeOfSymbol\"));\n this.rememberTypeSource(type, symbol.valueDeclaration);\n return type;\n }\n\n getDeclaredTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined {\n const type = this.rememberType(this.tryGetSymbolType(symbol, \"getDeclaredTypeOfSymbol\"));\n this.rememberTypeSource(type, symbol.valueDeclaration);\n return type;\n }\n\n typeToString(type: CorsaType, flags?: number): string {\n try {\n const text = this.client().typeToString(\n this.#snapshot!,\n this.projectId(),\n type.id,\n undefined,\n flags,\n );\n if (flags === undefined) {\n this.#typeTextById.set(type.id, text);\n }\n return text;\n } catch (error) {\n const cached = flags === undefined ? this.#typeTextById.get(type.id) : undefined;\n if (cached !== undefined) {\n return cached;\n }\n throw error;\n }\n }\n\n // Seeds the type-text cache from a name the caller already knows (for\n // example the identifier in an `implements` clause). Implemented-interface\n // handles come back with empty `texts`, and upstream Corsa sometimes evicts\n // them from its snapshot registry before `typeToString` runs, so warming the\n // cache here lets `typeToString` fall back to the source name instead of\n // throwing (GH#211). Never overwrites a value the server already provided.\n rememberTypeText(typeId: string, text: string): void {\n if (!this.#typeTextById.has(typeId)) {\n this.#typeTextById.set(typeId, text);\n }\n }\n\n getBaseTypeOfLiteralType(type: CorsaType): CorsaType | undefined {\n return this.rememberType(\n this.client().callJson(\"getBaseTypeOfLiteralType\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n }),\n );\n }\n\n getPropertiesOfType(type: CorsaType): readonly CorsaSymbol[] {\n return this.rememberSymbols(\n this.client().callJson(\"getPropertiesOfType\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n }) ?? [],\n );\n }\n\n getSignaturesOfType(type: CorsaType, kind: number): readonly CorsaSignature[] {\n return this.rememberSignatures(\n this.client().callJson(\"getSignaturesOfType\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n kind,\n }) ?? [],\n );\n }\n\n getReturnTypeOfSignature(signature: CorsaSignature): CorsaType | undefined {\n return this.rememberType(\n this.client().callJson(\"getReturnTypeOfSignature\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n signature: signature.id,\n }),\n );\n }\n\n getTypePredicateOfSignature(signature: CorsaSignature): CorsaTypePredicate | undefined {\n const predicate = this.client().callJson<CorsaTypePredicate | undefined>(\n \"getTypePredicateOfSignature\",\n {\n snapshot: this.#snapshot,\n project: this.projectId(),\n signature: signature.id,\n },\n );\n if (predicate?.type) {\n this.rememberType(predicate.type);\n }\n return predicate;\n }\n\n getBaseTypes(type: CorsaType): readonly CorsaType[] {\n if (isArrayOrTupleLikeType(this, type)) {\n return [];\n }\n try {\n return this.rememberTypes(\n this.client().callJson(\"getBaseTypes\", {\n snapshot: this.#snapshot,\n project: this.projectId(),\n type: type.id,\n texts: this.typeTexts(type),\n }) ?? [],\n );\n } catch (error) {\n // Upstream Corsa occasionally drops a type handle from its snapshot\n // registry after the first base-types query on a class that has no\n // explicit `extends` clause. Treating that as \"no base types\" lets a\n // follow-up `getImplementedTypesOfType` on the same handle still report\n // the type's own `implements` clause instead of throwing (GH#206).\n if (isProtocolPanicError(error) || isStaleHandleError(error)) {\n return [];\n }\n throw error;\n }\n }\n\n getTypeArguments(type: CorsaType): readonly CorsaType[] {\n const source = this.sourceSliceForType(type);\n return this.rememberTypes(\n source\n ? (this.client().getTypeArgumentsAtSourceRange(\n this.#snapshot!,\n this.projectId(),\n type.id,\n type.objectFlags,\n source.node.fileName,\n source.node.pos,\n source.node.end,\n this.sourceTextForPath(source.node.fileName) ?? \"\",\n ) as unknown as readonly CorsaType[])\n : (this.client().getTypeArguments(\n this.#snapshot!,\n this.projectId(),\n type.id,\n type.objectFlags,\n ) as unknown as readonly CorsaType[]),\n );\n }\n\n getTypesOfType(type: CorsaType): readonly CorsaType[] {\n if (\n (type.flags & (typeFlags.union | typeFlags.intersection | typeFlags.templateLiteral)) ===\n 0\n ) {\n return [];\n }\n return this.callTypeArray(\"getTypesOfType\", type);\n }\n\n getTargetOfType(type: CorsaType): CorsaType | undefined {\n if (\n (type.flags & (typeFlags.index | typeFlags.stringMapping)) === 0 &&\n ((type.objectFlags ?? 0) & (objectFlags.reference | objectFlags.mapped)) === 0\n ) {\n return undefined;\n }\n const target = this.callType(\"getTargetOfType\", type);\n this.cacheTypeText(target);\n return target;\n }\n\n getTypeParametersOfType(type: CorsaType): readonly CorsaType[] {\n const flags = type.objectFlags ?? 0;\n if ((type.flags & typeFlags.object) === 0 || (flags & objectFlags.classOrInterface) === 0) {\n return [];\n }\n return this.callTypeArray(\"getTypeParametersOfType\", type);\n }\n\n getOuterTypeParametersOfType(type: CorsaType): readonly CorsaType[] {\n const flags = type.objectFlags ?? 0;\n if ((type.flags & typeFlags.object) === 0 || (flags & objectFlags.classOrInterface) === 0) {\n return [];\n }\n return this.callTypeArray(\"getOuterTypeParametersOfType\", type);\n }\n\n getLocalTypeParametersOfType(type: CorsaType): readonly CorsaType[] {\n const flags = type.objectFlags ?? 0;\n if ((type.flags & typeFlags.object) === 0 || (flags & objectFlags.classOrInterface) === 0) {\n return [];\n }\n return this.callTypeArray(\"getLocalTypeParametersOfType\", type);\n }\n\n getObjectTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.indexedAccess) !== 0\n ? this.callType(\"getObjectTypeOfType\", type)\n : undefined;\n }\n\n getIndexTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.indexedAccess) !== 0\n ? this.callType(\"getIndexTypeOfType\", type)\n : undefined;\n }\n\n getCheckTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.conditional) !== 0\n ? this.callType(\"getCheckTypeOfType\", type)\n : undefined;\n }\n\n getExtendsTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.conditional) !== 0\n ? this.callType(\"getExtendsTypeOfType\", type)\n : undefined;\n }\n\n getBaseTypeOfType(type: CorsaType): CorsaType | undefined {\n return (type.flags & typeFlags.substitution) !== 0\n ? this.callType(\"getBaseTypeOfType\", type)\n : undefined;\n }\n\n getConstraintOfType(type: CorsaType): CorsaType | undefined {\n return this.rememberType(\n this.client().getConstraintOfType(this.#snapshot!, this.projectId(), type.id) as\n | CorsaType\n | undefined,\n );\n }\n\n private callType(method: string, type: CorsaType): CorsaType | undefined {\n return this.rememberType(\n this.client().callJson<CorsaType | null>(method, {\n snapshot: this.#snapshot,\n type: type.id,\n }) ?? undefined,\n );\n }\n\n private callTypeArray(method: string, type: CorsaType): readonly CorsaType[] {\n return this.rememberTypes(\n this.client().callJson<readonly CorsaType[] | null>(method, {\n snapshot: this.#snapshot,\n type: type.id,\n }) ?? [],\n );\n }\n\n private tryGetSymbolType(\n symbol: CorsaSymbol,\n method: \"getTypeOfSymbol\" | \"getDeclaredTypeOfSymbol\",\n ): CorsaType | undefined {\n try {\n return this.client()[method](this.#snapshot!, this.projectId(), symbol.id) as\n | CorsaType\n | undefined;\n } catch {\n return undefined;\n }\n }\n\n private sourceSliceForType(type: CorsaType): SourceSlice | undefined {\n const cached = this.#typeSourceById.get(type.id);\n if (cached) {\n return cached;\n }\n const lookup = this.#typeLookupById.get(type.id);\n if (lookup) {\n const symbol = this.getSymbolAtPosition(lookup.fileName, lookup.position, lookup.sourceText);\n this.rememberTypeSource(type, symbol?.valueDeclaration);\n const fromLookup = this.#typeSourceById.get(type.id);\n if (fromLookup) {\n return fromLookup;\n }\n }\n if (type.symbol) {\n const symbol = this.getSymbol(type.symbol);\n this.rememberTypeSource(type, symbol?.valueDeclaration);\n }\n return this.#typeSourceById.get(type.id);\n }\n\n private rememberType<T extends CorsaType | undefined>(type: T): T {\n if (type) {\n this.#snapshotHasIssuedHandles = true;\n }\n if (type?.symbol) {\n this.#symbolTypeById.set(type.symbol, type.id);\n }\n if (type?.texts?.[0]) {\n this.#typeTextById.set(type.id, type.texts[0]);\n }\n return type;\n }\n\n private rememberTypes<T extends readonly CorsaType[]>(types: T): T {\n for (const type of types) {\n this.rememberType(type);\n }\n return types;\n }\n\n private rememberTypeSource(type: CorsaType | undefined, handle: string | undefined): void {\n if (!type || !handle || this.#typeSourceById.has(type.id)) {\n return;\n }\n const source = this.sourceSliceForHandle(handle);\n if (source) {\n this.#typeSourceById.set(type.id, source);\n }\n }\n\n private rememberTypeSourceRange(\n type: CorsaType,\n fileName: string,\n start: number,\n end: number,\n sourceText: string | undefined,\n ): void {\n if (\n this.#typeSourceById.has(type.id) ||\n !sourceText ||\n start < 0 ||\n end > sourceText.length ||\n start >= end\n ) {\n return;\n }\n const node = {\n fileName,\n pos: start,\n end,\n range: [start, end] as const,\n };\n this.#typeSourceById.set(type.id, {\n node,\n text: sourceText.slice(start, end),\n });\n }\n\n private cacheTypeText(type: CorsaType | undefined): void {\n if (!type || this.#typeTextById.has(type.id)) {\n return;\n }\n try {\n this.#typeTextById.set(\n type.id,\n this.client().typeToString(this.#snapshot!, this.projectId(), type.id),\n );\n } catch {\n // Some upstream handles are only renderable before a later relation query.\n }\n }\n\n private typeTexts(type: CorsaType): readonly string[] {\n if (Array.isArray(type.texts) && type.texts.length > 0) {\n return type.texts;\n }\n const cached = this.#typeTextById.get(type.id);\n return cached === undefined ? [] : [cached];\n }\n\n private rememberSymbol<T extends CorsaSymbol | undefined>(symbol: T): T {\n if (!symbol) {\n return symbol;\n }\n this.#snapshotHasIssuedHandles = true;\n const synthetic = this.#syntheticSymbolsById.get(symbol.id);\n if (synthetic) {\n return synthetic as T;\n }\n this.#symbolsById.set(symbol.id, symbol);\n for (const declaration of symbol.declarations ?? []) {\n this.rememberNode(declaration);\n }\n if (symbol.valueDeclaration) {\n this.rememberNode(symbol.valueDeclaration);\n }\n return symbol;\n }\n\n private rememberSymbols<T extends readonly CorsaSymbol[]>(symbols: T): T {\n for (const symbol of symbols) {\n this.rememberSymbol(symbol);\n }\n return symbols;\n }\n\n private rememberSignatures<T extends readonly CorsaSignature[]>(signatures: T): T {\n for (const signature of signatures) {\n this.rememberSignature(signature);\n }\n return signatures;\n }\n\n private rememberSignature(signature: CorsaSignature): CorsaSignature {\n if (signature.declaration) {\n this.rememberNode(signature.declaration);\n }\n const parameterIds = Array.isArray(signature.parameters) ? signature.parameters : [];\n const parameters = signature.declaration\n ? this.parameterInfosForDeclaration(signature.declaration, parameterIds.length)\n : [];\n parameterIds.forEach((id, index) => {\n this.rememberSyntheticSymbol(id, parameters[index]);\n });\n if (signature.thisParameter) {\n this.rememberSyntheticSymbol(signature.thisParameter, undefined, \"this\");\n }\n return signature;\n }\n\n private rememberSyntheticSymbol(\n id: string,\n parameter?: ParameterInfo,\n fallbackName = \"\",\n ): CorsaSymbol {\n const cached = this.#syntheticSymbolsById.get(id);\n if (cached && (cached.name || !parameter?.name)) {\n return cached;\n }\n const declaration = parameter?.node.id;\n const symbol: CorsaSymbol = {\n id,\n name: parameter?.name ?? fallbackName,\n flags: cached?.flags ?? 0,\n checkFlags: cached?.checkFlags ?? 0,\n declarations: declaration ? [declaration] : (cached?.declarations ?? []),\n valueDeclaration: declaration ?? cached?.valueDeclaration,\n };\n this.#syntheticSymbolsById.set(id, symbol);\n this.#symbolsById.set(id, symbol);\n if (declaration) {\n this.#nodesById.set(declaration, parameter.node);\n }\n return symbol;\n }\n\n private rememberNode(handle: string): CorsaNode | undefined {\n const parsed = parseNodeHandle(handle);\n if (!parsed) {\n return undefined;\n }\n this.#nodesById.set(handle, parsed);\n return parsed;\n }\n\n private clearHandleCaches(): void {\n this.#symbolsById.clear();\n this.#syntheticSymbolsById.clear();\n this.#symbolTypeById.clear();\n this.#nodesById.clear();\n this.#typeLookupById.clear();\n this.#typeSourceById.clear();\n this.#snapshotHasIssuedHandles = false;\n }\n\n private parameterInfosForDeclaration(\n handle: string,\n expectedCount: number,\n ): readonly ParameterInfo[] {\n const source = this.sourceSliceForHandle(handle);\n if (!source) {\n return this.parameterInfosForUtf8ByteDeclaration(handle);\n }\n const parameters = parameterInfosForSource(source);\n if (parameters.length >= expectedCount || expectedCount === 0) {\n return parameters;\n }\n const utf8Parameters = this.parameterInfosForUtf8ByteDeclaration(handle);\n return utf8Parameters.length > parameters.length ? utf8Parameters : parameters;\n }\n\n private parameterInfosForUtf8ByteDeclaration(handle: string): readonly ParameterInfo[] {\n const source = this.sourceSliceForHandle(handle, \"utf8-byte\");\n return source ? parameterInfosForSource(source) : [];\n }\n\n private sourceSliceForHandle(\n handle: string,\n offsetUnit: \"utf16\" | \"utf8-byte\" = \"utf16\",\n ): SourceSlice | undefined {\n const node = this.getNode(handle);\n if (!node) {\n return undefined;\n }\n const sourceText = this.sourceTextForPath(node.fileName);\n const normalizedNode =\n offsetUnit === \"utf8-byte\" ? nodeFromUtf8ByteOffsets(node, sourceText) : node;\n if (\n !sourceText ||\n !normalizedNode ||\n normalizedNode.pos < 0 ||\n normalizedNode.end > sourceText.length ||\n normalizedNode.pos >= normalizedNode.end\n ) {\n return undefined;\n }\n return {\n node: normalizedNode,\n text: sourceText.slice(normalizedNode.pos, normalizedNode.end),\n };\n }\n\n private sourceTextForPath(path: string): string | undefined {\n for (const [fileName, cached] of this.#files) {\n if (fileName === path || fileName.endsWith(path)) {\n return cached.lintSourceText ?? cached.sourceText ?? readFileOrUndefined(fileName);\n }\n }\n return readFileOrUndefined(path) ?? readFileOrUndefined(`${this.runtime.cwd}/${path}`);\n }\n\n private client(): CorsaApiClient {\n if (!this.#client) {\n this.#client = CorsaApiClient.spawn({\n executable: this.runtime.executable,\n cwd: this.runtime.cwd,\n mode: this.runtime.mode,\n });\n this.#client.initialize();\n }\n return this.#client;\n }\n\n private config(): { options: unknown; fileNames: string[] } {\n if (!this.#config) {\n this.#config = this.client().parseConfigFile(this.project.configPath);\n }\n const config = this.#config;\n if (!config) {\n throw new Error(`corsa oxlint could not parse a Corsa config for ${this.project.configPath}`);\n }\n return config;\n }\n\n private fileState(fileName: string, sourceText?: string): FileCache {\n const prepared = this.refreshIfNeeded(fileName, sourceText);\n const current = this.#files.get(fileName);\n if (current) {\n return current;\n }\n const project = this.client().callJson<ProjectResponse | null>(\"getDefaultProjectForFile\", {\n snapshot: this.#snapshot,\n file: fileName,\n });\n const state: FileCache = {\n mtimeMs: prepared.mtimeMs,\n lintSourceText: prepared.lintSourceText,\n sourceText: prepared.sourceText,\n projectId: project?.id ?? this.projectId(),\n typeByPosition: new Map(),\n typeBySourceRange: new Map(),\n symbolByPosition: new Map(),\n };\n this.#files.set(fileName, state);\n return state;\n }\n\n private refreshIfNeeded(fileName: string, sourceText?: string): PreparedFileState {\n const now = Date.now();\n const expired = now - this.#lastRefreshMs > this.runtime.cacheLifetimeMs;\n const cached = this.#files.get(fileName);\n const mtimeMs = statMtimeMs(fileName);\n const overlayText = this.supportedOverlayText(fileName, sourceText, mtimeMs, cached);\n const mtimeChanged = cached !== undefined && mtimeMs !== cached.mtimeMs;\n const textChanged = overlayText !== cached?.sourceText;\n const prepared = {\n mtimeMs,\n lintSourceText: sourceText,\n sourceText: overlayText,\n };\n const stale =\n !this.#snapshot ||\n mtimeChanged ||\n textChanged ||\n (expired && !this.#snapshotHasIssuedHandles);\n if (!stale) {\n return prepared;\n }\n const previous = this.#snapshot;\n const overlayChanges = this.overlayChanges(fileName, overlayText, cached);\n const response = this.client().updateSnapshot({\n ...(previous\n ? { fileChanges: { changed: [fileName] } }\n : { openProject: this.project.configPath }),\n ...(overlayChanges === undefined ? {} : { overlayChanges }),\n });\n this.#snapshot = response.snapshot;\n this.#projects = response.projects;\n this.#lastRefreshMs = now;\n this.#files.clear();\n this.clearHandleCaches();\n if (previous && previous !== this.#snapshot) {\n this.client().releaseHandle(previous);\n }\n return prepared;\n }\n\n private projectId(): string {\n const id = this.#projects[0]?.id;\n if (!id) {\n throw new Error(\n `corsa oxlint could not resolve a Corsa project for ${this.project.filename}`,\n );\n }\n return id;\n }\n\n private supportedOverlayText(\n fileName: string,\n sourceText: string | undefined,\n mtimeMs: number,\n cached?: FileCache,\n ): string | undefined {\n if (sourceText === undefined || !this.supportsOverlayChanges()) {\n return undefined;\n }\n if (cached?.lintSourceText === sourceText && cached.mtimeMs === mtimeMs) {\n return cached.sourceText;\n }\n return overlayTextFor(fileName, sourceText);\n }\n\n private overlayChanges(\n fileName: string,\n overlayText: string | undefined,\n cached?: FileCache,\n ):\n | {\n upsert?: { document: string; text: string; languageId: string }[];\n delete?: string[];\n }\n | undefined {\n if (!this.supportsOverlayChanges()) {\n return undefined;\n }\n if (overlayText !== undefined) {\n return {\n upsert: [\n {\n document: fileName,\n text: overlayText,\n languageId: languageIdFor(fileName),\n },\n ],\n };\n }\n if (cached?.sourceText !== undefined) {\n return { delete: [fileName] };\n }\n return undefined;\n }\n\n private supportsOverlayChanges(): boolean {\n if (this.#supportsOverlayChanges !== undefined) {\n return this.#supportsOverlayChanges;\n }\n try {\n const capabilities = this.client().callJson<{\n overlay?: { updateSnapshotOverlayChanges?: boolean };\n }>(\"describeCapabilities\");\n this.#supportsOverlayChanges = capabilities?.overlay?.updateSnapshotOverlayChanges === true;\n } catch {\n this.#supportsOverlayChanges = false;\n }\n return this.#supportsOverlayChanges;\n }\n}\n\nfunction parameterInfosForSource(source: SourceSlice): readonly ParameterInfo[] {\n const open = findConstructorParameterOpen(source.text);\n if (open < 0) {\n return [];\n }\n const close = matchingCloseParen(source.text, open);\n if (close < 0) {\n return [];\n }\n const parametersText = source.text.slice(open + 1, close);\n return splitTopLevelRanges(parametersText, \",\")\n .map((range) => parameterInfoForText(source.node, parametersText, range, open + 1))\n .filter((parameter): parameter is ParameterInfo => parameter !== undefined);\n}\n\nfunction isArrayOrTupleLikeType(session: CorsaProjectSession, type: CorsaType): boolean {\n const texts =\n Array.isArray(type.texts) && type.texts.length > 0 ? type.texts : [session.typeToString(type)];\n return texts.some((text) => {\n const normalized = text.trimStart();\n return (\n normalized.startsWith(\"readonly [\") || normalized.startsWith(\"[\") || normalized.endsWith(\"[]\")\n );\n });\n}\n\nfunction findConstructorParameterOpen(text: string): number {\n const constructorPattern = /\\bconstructor\\s*\\(/g;\n let match: RegExpExecArray | null;\n let open = -1;\n while ((match = constructorPattern.exec(text)) !== null) {\n open = match.index + match[0].lastIndexOf(\"(\");\n }\n if (open >= 0) {\n return open;\n }\n return text.indexOf(\"(\");\n}\n\nfunction overlayTextFor(fileName: string, sourceText?: string): string | undefined {\n if (sourceText === undefined) {\n return undefined;\n }\n try {\n return readFileSync(fileName, \"utf8\") === sourceText ? undefined : sourceText;\n } catch {\n return sourceText;\n }\n}\n\nfunction isProtocolPanicError(error: unknown): boolean {\n const message = error instanceof Error ? error.message : String(error);\n return message.includes(\"protocol error: panic:\") || message.includes(\"panic: runtime error\");\n}\n\nfunction isStaleHandleError(error: unknown): boolean {\n const message = error instanceof Error ? error.message : String(error);\n return /handle \"[^\"]*\" not found in snapshot registry/.test(message);\n}\n\nfunction statMtimeMs(fileName: string): number {\n try {\n return statSync(fileName).mtimeMs;\n } catch {\n return 0;\n }\n}\n\nfunction languageIdFor(fileName: string): string {\n if (fileName.endsWith(\".tsx\")) {\n return \"typescriptreact\";\n }\n if (fileName.endsWith(\".jsx\")) {\n return \"javascriptreact\";\n }\n if (fileName.endsWith(\".js\")) {\n return \"javascript\";\n }\n return \"typescript\";\n}\n\nfunction parseNodeHandle(value: string): CorsaNode | undefined {\n const [posText, endText, _kindText, ...pathParts] = value.split(\".\");\n const pos = Number(posText);\n const end = Number(endText);\n const fileName = pathParts.join(\".\");\n if (!Number.isFinite(pos) || !Number.isFinite(end) || !fileName) {\n return undefined;\n }\n return { id: value, fileName, pos, end, range: [pos, end] };\n}\n\nfunction nodeFromUtf8ByteOffsets(\n node: CorsaNode,\n sourceText: string | undefined,\n): CorsaNode | undefined {\n if (sourceText === undefined) {\n return undefined;\n }\n const pos = utf16IndexFromUtf8ByteOffset(sourceText, node.pos);\n const end = utf16IndexFromUtf8ByteOffset(sourceText, node.end);\n if (pos === undefined || end === undefined || end < pos) {\n return undefined;\n }\n return {\n ...node,\n pos,\n end,\n range: [pos, end],\n };\n}\n\nfunction utf16IndexFromUtf8ByteOffset(text: string, byteOffset: number): number | undefined {\n if (!Number.isInteger(byteOffset) || byteOffset < 0) {\n return undefined;\n }\n let bytes = 0;\n for (let index = 0; index < text.length; ) {\n if (bytes === byteOffset) {\n return index;\n }\n const codePoint = text.codePointAt(index);\n if (codePoint === undefined) {\n break;\n }\n const nextBytes = bytes + utf8ByteLengthOfCodePoint(codePoint);\n if (nextBytes > byteOffset) {\n return undefined;\n }\n bytes = nextBytes;\n index += codePoint > 0xffff ? 2 : 1;\n }\n return bytes === byteOffset ? text.length : undefined;\n}\n\nfunction utf8ByteLengthOfCodePoint(codePoint: number): number {\n if (codePoint <= 0x7f) {\n return 1;\n }\n if (codePoint <= 0x7ff) {\n return 2;\n }\n if (codePoint <= 0xffff) {\n return 3;\n }\n return 4;\n}\n\nfunction parameterInfoForText(\n declarationNode: CorsaNode,\n parametersText: string,\n range: { readonly start: number; readonly end: number },\n parametersStart: number,\n): ParameterInfo | undefined {\n const raw = parametersText.slice(range.start, range.end);\n const leading = raw.search(/\\S/);\n if (leading < 0) {\n return undefined;\n }\n const trailing = raw.match(/\\s*$/)?.[0].length ?? 0;\n const text = raw.slice(leading, raw.length - trailing);\n const name = parameterNameForText(text);\n if (!name) {\n return undefined;\n }\n const pos = declarationNode.pos + parametersStart + range.start + leading;\n const end = declarationNode.pos + parametersStart + range.end - trailing;\n const id = `${pos}.${end}.0.${declarationNode.fileName}`;\n return {\n name,\n node: {\n id,\n fileName: declarationNode.fileName,\n pos,\n end,\n range: [pos, end],\n },\n };\n}\n\nfunction parameterNameForText(text: string): string | undefined {\n let candidate = text.trim().replace(/^\\.\\.\\.\\s*/, \"\");\n let changed = true;\n while (changed) {\n const previous = candidate;\n candidate = candidate.replace(\n /^(?:public|private|protected|readonly|override|static|abstract|declare)\\s+/,\n \"\",\n );\n changed = candidate !== previous;\n }\n const separator = firstTopLevelIndexOfAny(candidate, [\":\", \"=\"]);\n let left = (separator >= 0 ? candidate.slice(0, separator) : candidate).trim();\n if (left.endsWith(\"?\")) {\n left = left.slice(0, -1).trim();\n }\n if (left.startsWith(\"{\") || left.startsWith(\"[\")) {\n return left;\n }\n return left.split(/\\s+/).at(-1);\n}\n\nfunction matchingCloseParen(text: string, open: number): number {\n let depth = 0;\n const scanner = createScanner();\n for (let index = open; index < text.length; index += 1) {\n const char = text[index];\n if (scanner.inQuote(char)) {\n continue;\n }\n if (char === \"(\") {\n depth += 1;\n } else if (char === \")\") {\n depth -= 1;\n if (depth === 0) {\n return index;\n }\n }\n }\n return -1;\n}\n\nfunction splitTopLevelRanges(\n text: string,\n delimiter: string,\n): readonly { readonly start: number; readonly end: number }[] {\n const ranges: { start: number; end: number }[] = [];\n const scanner = createScanner();\n let start = 0;\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n if (scanner.inQuote(char)) {\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n char === delimiter &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n ranges.push({ start, end: index });\n start = index + 1;\n }\n }\n ranges.push({ start, end: text.length });\n return ranges;\n}\n\nfunction firstTopLevelIndexOfAny(text: string, needles: readonly string[]): number {\n const scanner = createScanner();\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n if (scanner.inQuote(char)) {\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n needles.includes(char) &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n return index;\n }\n }\n return -1;\n}\n\nfunction createScanner(): {\n inQuote(char: string): boolean;\n} {\n let quote: string | undefined;\n let escaped = false;\n return {\n inQuote(char) {\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = undefined;\n }\n return true;\n }\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n return true;\n }\n return false;\n },\n };\n}\n\nfunction readFileOrUndefined(path: string): string | undefined {\n try {\n return readFileSync(path, \"utf8\");\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;AA6CA,MAAM,YAAY;CAChB,QAAQ,KAAK;CACb,OAAO,KAAK;CACZ,iBAAiB,KAAK;CACtB,eAAe,KAAK;CACpB,cAAc,KAAK;CACnB,eAAe,KAAK;CACpB,aAAa,KAAK;CAClB,OAAO,KAAK;CACZ,cAAc,KAAK;CACpB;AAED,MAAM,cAAc;CAClB,kBAAkB;CAClB,WAAW;CACX,QAAQ;CACT;AAED,IAAa,sBAAb,MAAiC;CAC/B;CACA;CACA;CACA,YAA+B,EAAE;CACjC,yBAAS,IAAI,KAAwB;CACrC,+BAAe,IAAI,KAA0B;CAC7C,wCAAwB,IAAI,KAA0B;CACtD,kCAAkB,IAAI,KAAqB;CAC3C,6BAAa,IAAI,KAAwB;CACzC,kCAAkB,IAAI,KAAyB;CAC/C,kCAAkB,IAAI,KAA0B;CAChD,gCAAgB,IAAI,KAAqB;CACzC,iBAAiB;CACjB,4BAA4B;CAC5B;CAEA,YACE,SACA,SACA;EAFS,KAAA,UAAA;EACA,KAAA,UAAA;;CAGX,QAAc;EACZ,IAAI,KAAKA,WAAW;GAClB,KAAKC,SAAS,cAAc,KAAKD,UAAU;GAC3C,KAAKA,YAAY,KAAA;;EAEnB,KAAKC,SAAS,OAAO;EACrB,KAAKA,UAAU,KAAA;EACf,KAAKC,0BAA0B,KAAA;EAC/B,KAAKC,OAAO,OAAO;EACnB,KAAK,mBAAmB;EACxB,KAAKC,cAAc,OAAO;;CAG5B,qBAA8B;EAC5B,OAAO,KAAK,QAAQ,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EACN"}
package/dist/types.d.ts CHANGED
@@ -64,6 +64,10 @@ interface CorsaSignature {
64
64
  readonly thisParameter?: string;
65
65
  readonly target?: string;
66
66
  }
67
+ declare enum SignatureKind {
68
+ Call = 0,
69
+ Construct = 1
70
+ }
67
71
  interface CorsaTypePredicate {
68
72
  readonly kind: number;
69
73
  readonly parameterIndex: number;
@@ -89,6 +93,7 @@ interface CorsaTypeCheckerShape {
89
93
  getSymbolAtLocation(node: Node | CorsaNode): CorsaSymbol | undefined;
90
94
  getSymbol(symbol: string | CorsaSymbol): CorsaSymbol | undefined;
91
95
  getSymbolById(id: string): CorsaSymbol | undefined;
96
+ getSymbolOfType(type: CorsaType): CorsaSymbol | undefined;
92
97
  getNode(node: string | CorsaNode): CorsaNode | undefined;
93
98
  getNodeById(id: string): CorsaNode | undefined;
94
99
  getTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined;
@@ -97,7 +102,7 @@ interface CorsaTypeCheckerShape {
97
102
  typeToString(type: CorsaType, enclosingDeclaration?: Node | CorsaNode, flags?: number): string;
98
103
  getBaseTypeOfLiteralType(type: CorsaType): CorsaType | undefined;
99
104
  getPropertiesOfType(type: CorsaType): readonly CorsaSymbol[];
100
- getSignaturesOfType(type: CorsaType, kind: number): readonly CorsaSignature[];
105
+ getSignaturesOfType(type: CorsaType, kind: SignatureKind): readonly CorsaSignature[];
101
106
  getReturnTypeOfSignature(signature: CorsaSignature): CorsaType | undefined;
102
107
  getTypePredicateOfSignature(signature: CorsaSignature): CorsaTypePredicate | undefined;
103
108
  getBaseTypes(type: CorsaType): readonly CorsaType[];
@@ -156,5 +161,5 @@ interface SessionProjectState {
156
161
  readonly snapshot: string;
157
162
  }
158
163
  //#endregion
159
- export { ContextWithParserOptions, CorsaNode, CorsaOxlintSettings, CorsaProgramShape, CorsaRuntimeOptions, CorsaSignature, CorsaStylisticSettings, CorsaSymbol, CorsaType, CorsaTypeCheckerShape, CorsaTypePredicate, ParserServices, ParserServicesWithTypeInformation, type ProjectResponse, ProjectServiceOptions, ResolvedProjectConfig, ResolvedRuntimeOptions, SessionProjectState, TypeAwareParserOptions };
164
+ export { ContextWithParserOptions, CorsaNode, CorsaOxlintSettings, CorsaProgramShape, CorsaRuntimeOptions, CorsaSignature, CorsaStylisticSettings, CorsaSymbol, CorsaType, CorsaTypeCheckerShape, CorsaTypePredicate, ParserServices, ParserServicesWithTypeInformation, type ProjectResponse, ProjectServiceOptions, ResolvedProjectConfig, ResolvedRuntimeOptions, SessionProjectState, SignatureKind, TypeAwareParserOptions };
160
165
  //# sourceMappingURL=types.d.ts.map
package/dist/types.js CHANGED
@@ -1 +1,10 @@
1
- export {};
1
+ //#region src/bindings/nodejs/corsa_oxlint/ts/types.ts
2
+ let SignatureKind = /* @__PURE__ */ function(SignatureKind) {
3
+ SignatureKind[SignatureKind["Call"] = 0] = "Call";
4
+ SignatureKind[SignatureKind["Construct"] = 1] = "Construct";
5
+ return SignatureKind;
6
+ }({});
7
+ //#endregion
8
+ export { SignatureKind };
9
+
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../ts/types.ts"],"sourcesContent":["import type { Context, Node, SourceCode } from \"@oxlint/plugins\";\nimport type { ApiMode, ConfigResponse, ProjectResponse, TypeResponse } from \"@corsa-bind/napi\";\n\nexport interface CorsaRuntimeOptions {\n executable?: string;\n cwd?: string;\n mode?: ApiMode;\n requestTimeoutMs?: number;\n shutdownTimeoutMs?: number;\n outboundCapacity?: number;\n allowUnstableUpstreamCalls?: boolean;\n cacheLifetimeMs?: number;\n}\n\nexport interface ProjectServiceOptions {\n allowDefaultProject?: string[];\n defaultProject?: string;\n}\n\nexport interface TypeAwareParserOptions {\n project?: string | string[];\n projectService?: boolean | ProjectServiceOptions;\n tsconfigRootDir?: string;\n corsa?: CorsaRuntimeOptions;\n}\n\nexport interface CorsaOxlintSettings extends TypeAwareParserOptions {\n parserOptions?: TypeAwareParserOptions;\n}\n\nexport interface CorsaStylisticSettings {\n rules?: Record<string, readonly unknown[]>;\n}\n\nexport interface ResolvedRuntimeOptions {\n executable: string;\n cwd: string;\n mode: ApiMode;\n cacheLifetimeMs: number;\n}\n\nexport interface ResolvedProjectConfig {\n filename: string;\n rootDir: string;\n configPath: string;\n runtime: ResolvedRuntimeOptions;\n}\n\nexport interface CorsaNode {\n readonly id?: string;\n readonly fileName: string;\n readonly pos: number;\n readonly end: number;\n readonly range: readonly [number, number];\n}\n\nexport interface CorsaSymbol {\n readonly id: string;\n readonly name: string;\n readonly flags: number;\n readonly checkFlags: number;\n readonly declarations: readonly string[];\n readonly valueDeclaration?: string;\n}\n\nexport interface CorsaSignature {\n readonly id: string;\n readonly flags: number;\n readonly declaration?: string;\n readonly typeParameters: readonly string[];\n readonly parameters: readonly string[];\n readonly thisParameter?: string;\n readonly target?: string;\n}\n\nexport enum SignatureKind {\n Call = 0,\n Construct = 1,\n}\n\nexport interface CorsaTypePredicate {\n readonly kind: number;\n readonly parameterIndex: number;\n readonly parameterName?: string;\n readonly type?: CorsaType;\n}\n\nexport interface CorsaType extends TypeResponse {\n readonly __corsaOxlintKind: \"type\";\n}\n\nexport interface CorsaProgramShape {\n getCompilerOptions(): unknown;\n getCurrentDirectory(): string;\n getRootFileNames(): readonly string[];\n getSourceFile(fileName?: string): {\n readonly fileName: string;\n readonly text: string;\n };\n getTypeChecker(): CorsaTypeCheckerShape;\n}\n\nexport interface CorsaTypeCheckerShape {\n getTypeAtLocation(node: Node | CorsaNode): CorsaType | undefined;\n getContextualType(node: Node | CorsaNode): CorsaType | undefined;\n getSymbolAtLocation(node: Node | CorsaNode): CorsaSymbol | undefined;\n getSymbol(symbol: string | CorsaSymbol): CorsaSymbol | undefined;\n getSymbolById(id: string): CorsaSymbol | undefined;\n getSymbolOfType(type: CorsaType): CorsaSymbol | undefined;\n getNode(node: string | CorsaNode): CorsaNode | undefined;\n getNodeById(id: string): CorsaNode | undefined;\n getTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined;\n getDeclaredTypeOfSymbol(symbol: CorsaSymbol): CorsaType | undefined;\n getTypeOfSymbolAtLocation(symbol: CorsaSymbol, node: Node | CorsaNode): CorsaType | undefined;\n typeToString(type: CorsaType, enclosingDeclaration?: Node | CorsaNode, flags?: number): string;\n getBaseTypeOfLiteralType(type: CorsaType): CorsaType | undefined;\n getPropertiesOfType(type: CorsaType): readonly CorsaSymbol[];\n getSignaturesOfType(type: CorsaType, kind: SignatureKind): readonly CorsaSignature[];\n getReturnTypeOfSignature(signature: CorsaSignature): CorsaType | undefined;\n getTypePredicateOfSignature(signature: CorsaSignature): CorsaTypePredicate | undefined;\n getBaseTypes(type: CorsaType): readonly CorsaType[];\n getImplementedTypes(node: Node | CorsaNode): readonly CorsaType[];\n getImplementedTypesOfType(type: CorsaType): readonly CorsaType[];\n getTypeArguments(type: CorsaType): readonly CorsaType[];\n getTypesOfType(type: CorsaType): readonly CorsaType[];\n getTargetOfType(type: CorsaType): CorsaType | undefined;\n getTypeParametersOfType(type: CorsaType): readonly CorsaType[];\n getOuterTypeParametersOfType(type: CorsaType): readonly CorsaType[];\n getLocalTypeParametersOfType(type: CorsaType): readonly CorsaType[];\n getObjectTypeOfType(type: CorsaType): CorsaType | undefined;\n getIndexTypeOfType(type: CorsaType): CorsaType | undefined;\n getCheckTypeOfType(type: CorsaType): CorsaType | undefined;\n getExtendsTypeOfType(type: CorsaType): CorsaType | undefined;\n getBaseTypeOfType(type: CorsaType): CorsaType | undefined;\n getConstraintOfType(type: CorsaType): CorsaType | undefined;\n isUnionType(type: CorsaType): boolean;\n isIntersectionType(type: CorsaType): boolean;\n}\n\nexport interface ParserServices {\n readonly program: CorsaProgramShape;\n readonly esTreeNodeToTSNodeMap: {\n get(node: Node): CorsaNode;\n has(node: Node): boolean;\n };\n readonly tsNodeToESTreeNodeMap: {\n get(node: CorsaNode): Node;\n has(node: CorsaNode): boolean;\n };\n readonly hasFullTypeInformation: boolean;\n getTypeAtLocation(node: Node): CorsaType | undefined;\n getSymbolAtLocation(node: Node): CorsaSymbol | undefined;\n}\n\nexport type ParserServicesWithTypeInformation = ParserServices & {\n readonly hasFullTypeInformation: true;\n};\n\nexport type ContextWithParserOptions = Context & {\n readonly filename: string;\n readonly cwd: string;\n readonly sourceCode: SourceCode;\n readonly parserOptions?: TypeAwareParserOptions;\n readonly languageOptions?: {\n readonly parserOptions?: TypeAwareParserOptions;\n };\n readonly settings?: {\n readonly corsaOxlint?: CorsaOxlintSettings;\n readonly corsaStylistic?: CorsaStylisticSettings;\n readonly [key: string]: unknown;\n };\n readonly parserServices?: ParserServices;\n};\n\nexport interface SessionProjectState {\n readonly config: ConfigResponse;\n readonly project: ProjectResponse;\n readonly snapshot: string;\n}\n\nexport type { ProjectResponse };\n"],"mappings":";AA2EA,IAAY,gBAAL,yBAAA,eAAA;CACL,cAAA,cAAA,UAAA,KAAA;CACA,cAAA,cAAA,eAAA,KAAA;;KACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corsa-oxlint",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Type-aware Oxlint helpers powered by Corsa",
5
5
  "homepage": "https://github.com/ubugeeei-prod/corsa-bind/tree/main/src/bindings/nodejs/corsa_oxlint",
6
6
  "bugs": {
@@ -103,7 +103,7 @@
103
103
  "dependencies": {
104
104
  "@oxlint/plugins": "1.66.0",
105
105
  "oxlint": "1.66.0",
106
- "@corsa-bind/napi": "0.35.0"
106
+ "@corsa-bind/napi": "0.36.0"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@typescript-eslint/utils": "8.59.3"