@teambit/typescript 1.0.1080 → 1.0.1081
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/cmds/check-types.cmd.d.ts +1 -1
- package/dist/{preview-1785267101230.js → preview-1785278532531.js} +2 -2
- package/dist/schema-extractor-context.d.ts +6 -0
- package/dist/schema-extractor-context.js +31 -2
- package/dist/schema-extractor-context.js.map +1 -1
- package/dist/transformers/export-assignment.js +8 -3
- package/dist/transformers/export-assignment.js.map +1 -1
- package/dist/transformers/index-signature.d.ts +1 -1
- package/package.json +23 -23
- package/transformers/export-assignment.ts +8 -4
|
@@ -31,7 +31,7 @@ export declare class CheckTypesCmd implements Command {
|
|
|
31
31
|
strict: boolean;
|
|
32
32
|
}): Promise<{
|
|
33
33
|
code: number;
|
|
34
|
-
data: import("@teambit/ts-server/dist/ts-server-client
|
|
34
|
+
data: import("@teambit/ts-server/dist/ts-server-client").DiagnosticData[];
|
|
35
35
|
}>;
|
|
36
36
|
private runDiagnosticOnTsServer;
|
|
37
37
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.1081/dist/typescript.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.1081/dist/typescript.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -149,6 +149,12 @@ export declare class SchemaExtractorContext {
|
|
|
149
149
|
*/
|
|
150
150
|
private createPromiseSchema;
|
|
151
151
|
private isDefInSameLocation;
|
|
152
|
+
/**
|
|
153
|
+
* whether the definition span falls inside the node's own source span — i.e. the "definition"
|
|
154
|
+
* tsserver found for the node is (part of) the node itself, so following it for type resolution
|
|
155
|
+
* would only produce a self-reference (e.g. a function's name resolving to the function).
|
|
156
|
+
*/
|
|
157
|
+
private isDefWithinNode;
|
|
152
158
|
/**
|
|
153
159
|
* resolve a type by a node and its identifier.
|
|
154
160
|
*/
|
|
@@ -94,6 +94,8 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
94
94
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
95
95
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // @ts-ignore david we should figure fix this.
|
|
96
96
|
// eslint-disable-next-line import/no-unresolved
|
|
97
|
+
/** TS keyword/intrinsic types — an inferred type string that IS one of these has no definition to hunt for. */
|
|
98
|
+
const KEYWORD_TYPE_STRINGS = new Set(['any', 'unknown', 'never', 'void', 'undefined', 'null', 'boolean', 'string', 'number', 'bigint', 'symbol', 'object', 'this']);
|
|
97
99
|
class SchemaExtractorContext {
|
|
98
100
|
get mainFile() {
|
|
99
101
|
return (0, _legacy().pathNormalizeToLinux)(this.getPathRelativeToComponent(this.component.mainFile.path));
|
|
@@ -589,6 +591,22 @@ class SchemaExtractorContext {
|
|
|
589
591
|
return loc.line === definition.start.line && loc.character === definition.start.offset;
|
|
590
592
|
}
|
|
591
593
|
|
|
594
|
+
/**
|
|
595
|
+
* whether the definition span falls inside the node's own source span — i.e. the "definition"
|
|
596
|
+
* tsserver found for the node is (part of) the node itself, so following it for type resolution
|
|
597
|
+
* would only produce a self-reference (e.g. a function's name resolving to the function).
|
|
598
|
+
*/
|
|
599
|
+
isDefWithinNode(node, definition) {
|
|
600
|
+
if (definition.file !== node.getSourceFile().fileName) return false;
|
|
601
|
+
const sourceFile = node.getSourceFile();
|
|
602
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
603
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
604
|
+
// protocol locations are 1-based; getLineAndCharacterOfPosition is 0-based.
|
|
605
|
+
const afterStart = definition.start.line > start.line + 1 || definition.start.line === start.line + 1 && definition.start.offset >= start.character + 1;
|
|
606
|
+
const beforeEnd = definition.end.line < end.line + 1 || definition.end.line === end.line + 1 && definition.end.offset <= end.character + 1;
|
|
607
|
+
return afterStart && beforeEnd;
|
|
608
|
+
}
|
|
609
|
+
|
|
592
610
|
/**
|
|
593
611
|
* resolve a type by a node and its identifier.
|
|
594
612
|
*/
|
|
@@ -604,11 +622,23 @@ class SchemaExtractorContext {
|
|
|
604
622
|
if (node.type && _typescript().default.isTypeNode(node.type)) {
|
|
605
623
|
return this.computeSchema(node.type);
|
|
606
624
|
}
|
|
625
|
+
|
|
626
|
+
// a keyword inferred type can never be a named definition — skip the definition hunt below,
|
|
627
|
+
// which would resolve the DECLARATION's own name and mint a self-referential TypeRef. seen in
|
|
628
|
+
// the wild when inference degrades (unresolved React types): a component fn `Checkbox` whose
|
|
629
|
+
// quickinfo said `: any` got a returnType of `TypeRefSchema('Checkbox')` — i.e. "returns itself".
|
|
630
|
+
if (KEYWORD_TYPE_STRINGS.has(typeStr)) {
|
|
631
|
+
return this.unknownExactType(node, location, typeStr);
|
|
632
|
+
}
|
|
607
633
|
const definition = await this.getDefinition(node);
|
|
608
634
|
if (!definition) {
|
|
609
635
|
return this.unknownExactType(node, location, typeStr);
|
|
610
636
|
}
|
|
611
|
-
|
|
637
|
+
|
|
638
|
+
// same-location check catches the exact self-reference; the containment check catches the
|
|
639
|
+
// common miss where the definition span starts at the declaration's NAME while getLocation()
|
|
640
|
+
// points at the declaration start (e.g. after `export function `) — still a self-reference.
|
|
641
|
+
if (this.isDefInSameLocation(node, definition) || this.isDefWithinNode(node, definition)) {
|
|
612
642
|
return this.unknownExactType(node, location, typeStr);
|
|
613
643
|
}
|
|
614
644
|
const definitionNode = await this.definition(definition);
|
|
@@ -688,7 +718,6 @@ class SchemaExtractorContext {
|
|
|
688
718
|
throw new Error(`cannot find file in component \n source file path ${sourceFilePath}\n
|
|
689
719
|
identifier file path ${identifier.filePath}\nrelative dir ${relativeDir}\n
|
|
690
720
|
absFilePath ${absFilePath}`);
|
|
691
|
-
return new (_semanticsEntities().TypeRefSchema)(location, identifier.id);
|
|
692
721
|
}
|
|
693
722
|
const idKey = this.getIdentifierKey(compFilePath?.path);
|
|
694
723
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_tsutils","data","require","_typescript","_interopRequireWildcard","_lodash","_legacy","_path","_semanticsEntities","_pMapSeries","_interopRequireDefault","_identifierList","_parseTypeFromQuickInfo","_jsdocToDocSchema","_identifier","_exportIdentifier","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","SchemaExtractorContext","mainFile","pathNormalizeToLinux","getPathRelativeToComponent","component","path","identifiers","_identifiers","internalIdentifiers","_internalIdentifiers","computed","_computed","mainFileIdentifierKey","getIdentifierKey","mainModuleIdentifiers","constructor","tsserver","extractor","componentDeps","componentRootPath","hostRootPath","formatter","Map","getComputedNodeKey","filePath","line","character","schema","getIdentifierKeyForNode","node","getSourceFile","fileName","setComputed","location","__schema","key","setIdentifiers","setInternalIdentifiers","existing","uniqueIdentifiers","uniqBy","concat","k","aliasId","id","IdentifierList","findComputedSchemaByName","name","Array","from","values","filter","computeSchema","getLocation","SyntaxKind","kind","existingComputedSchema","computedSchema","transformSchemaNode","transformAPI","targetSourceFile","absolutePath","sourceFile","position","getLineAndCharacterOfPosition","getStart","getLocationAsString","basePath","filesystem","files","base","relative","getSignature","getSignatureHelp","getPath","getPosition","offset","getPositionOfLineAndCharacter","startsWith","join","getQuickInfo","err","message","Error","getQuickInfoDisplayString","quickInfo","body","displayString","typeDefinition","getTypeDefinition","visitTypeDefinition","getPathWithoutExtension","knownExtensions","fileExtension","extname","substring","filePathWithoutExtension","includes","replace","RegExp","isAbsolute","isIndexFile","currentFilePath","indexFilePath","findFileInComponent","normalizedFilePath","pathToCompareWithoutExtension","matchingFile","find","file","currentFilePathWithoutExtension","isSameFilePath","matches","parsePackageNameFromPath","parts","split","length","lastPart","sep","pkgParts","pkgName","getSourceFileInsideComponent","parseSourceFile","getSourceFileFromNode","getFilePathByNode","undefined","def","getDefinition","firstDef","head","definitionInfo","definition","startPosition","start","pos","nodeAtPos","getTokenAtPosition","visitDefinition","getTypeRefForExternalNode","visit","parent","Identifier","SourceFile","references","isExported","isFromComponent","getFileIdentifiers","exportDec","specifierPathStr","ExportDeclaration","moduleSpecifier","getText","specifierPath","absPath","resolve","getIdentifiers","getFileExports","identifier","ExportIdentifier","isExportIdentifier","getFileInternals","computeIdentifiers","headTypeDefinition","headDefinition","unknownExactType","typeStr","isArrayType","baseType","getArrayBaseType","baseTypeRef","getTypeRef","TypeArraySchema","InferenceTypeSchema","typeRef","info","returnType","extractMethodReturnType","createMethodReturnSchema","createFunctionSchema","createObjectSchema","innerType","extractGenericType","createPromiseSchema","endsWith","slice","match","exec","returnTypeMatch","trim","type","wrapper","signature","FunctionLikeSchema","paramsStr","returnTypeStr","params","createFunctionParameters","paramSchemas","param","nameWithOptional","map","s","isOptional","push","ParameterSchema","objMatch","objContent","properties","prop","Boolean","ArrayLiteralExpressionSchema","isDefInSameLocation","loc","resolveType","internalRef","ts","isTypeNode","definitionNode","definitionNodeName","definitionInternalRef","transformer","getTransformer","getTypeRefForExternalPath","schemaNode","apiTransformer","getAPITransformer","transformedApi","transform","IgnoredSchema","getCompIdByPkgName","dep","packageName","componentId","nodeIdentifierKey","nodeIdentifierList","mainIdentifierList","nodeIdentifier","mainIdentifier","parsedNodeIdentifier","parsedMainIdentifier","isExportedFromMain","src","sourceFilePath","isLocalOrRelative","isRelativeImport","normalizedPath","resolveTypeRef","TypeRefSchema","compIdByPkg","compIdByPath","getComponentIDByPath","relativeDir","lastIndexOf","absFilePath","compFilePath","idKey","exportedIdentifier","parseTypeFromQuickInfo","buildTopLevelNameIndex","sf","statements","isIdentifier","text","isVariableStatement","declarationList","declarations","collectSameFileInternalTypeRefs","root","result","Set","stack","pop","isTypeRefSchema","internalFilePath","add","isArray","v","jsDocToDocSchema","canHaveJsDoc","jsDocs","getJsDoc","jsDoc","linkComments","comment","c","JSDocLink","linkTags","linkComment","tagName","tagText","tagLocation","TagSchema","commentsWithoutLink","getTextOfJSDocComment","tags","pMapSeries","tag","tagParser","DocSchema","exports"],"sources":["schema-extractor-context.ts"],"sourcesContent":["import type { TsserverClient } from '@teambit/ts-server';\nimport { getTokenAtPosition, canHaveJsDoc, getJsDoc } from 'tsutils';\nimport type { ExportAssignment, ExportDeclaration, Node, TypeNode } from 'typescript';\nimport ts, { getTextOfJSDocComment, SyntaxKind } from 'typescript';\nimport { head, uniqBy } from 'lodash';\n// @ts-ignore david we should figure fix this.\n// eslint-disable-next-line import/no-unresolved\nimport type protocol from 'typescript/lib/protocol';\nimport { pathNormalizeToLinux, isRelativeImport } from '@teambit/legacy.utils';\nimport { resolve, sep, relative, join, isAbsolute, extname } from 'path';\nimport type { Component, ComponentID } from '@teambit/component';\nimport type { SchemaNode, Location } from '@teambit/semantics.entities.semantic-schema';\nimport {\n TypeRefSchema,\n InferenceTypeSchema,\n DocSchema,\n IgnoredSchema,\n TagSchema,\n TypeArraySchema,\n ArrayLiteralExpressionSchema,\n ParameterSchema,\n FunctionLikeSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport type { ComponentDependency } from '@teambit/dependency-resolver';\nimport type { Formatter } from '@teambit/formatter';\nimport pMapSeries from 'p-map-series';\nimport type { TypeScriptExtractor } from './typescript.extractor';\nimport { IdentifierList } from './identifier-list';\nimport { parseTypeFromQuickInfo } from './transformers/utils/parse-type-from-quick-info';\nimport { tagParser } from './transformers/utils/jsdoc-to-doc-schema';\nimport { Identifier } from './identifier';\nimport { ExportIdentifier } from './export-identifier';\n\nexport class SchemaExtractorContext {\n /**\n * list of all declared identifiers (exported and internal) by filename\n */\n private _identifiers = new Map<string, IdentifierList>();\n private _internalIdentifiers = new Map<string, IdentifierList>();\n\n /**\n * computed nodes by filename and (position (line:character))\n */\n private _computed = new Map<string, SchemaNode>();\n\n get mainFile() {\n return pathNormalizeToLinux(this.getPathRelativeToComponent(this.component.mainFile.path));\n }\n\n get identifiers() {\n return this._identifiers;\n }\n\n get internalIdentifiers() {\n return this._internalIdentifiers;\n }\n\n get computed() {\n return this._computed;\n }\n\n get mainFileIdentifierKey() {\n const mainFile = this.component.mainFile;\n return this.getIdentifierKey(mainFile.path);\n }\n\n get mainModuleIdentifiers() {\n return this.identifiers.get(this.mainFileIdentifierKey);\n }\n\n constructor(\n readonly tsserver: TsserverClient,\n readonly component: Component,\n readonly extractor: TypeScriptExtractor,\n readonly componentDeps: ComponentDependency[],\n readonly componentRootPath: string,\n readonly hostRootPath: string,\n readonly formatter?: Formatter\n ) {\n this.componentRootPath = pathNormalizeToLinux(componentRootPath);\n this.hostRootPath = pathNormalizeToLinux(hostRootPath);\n }\n\n getComputedNodeKey({ filePath, line, character }: Location, schema: string) {\n return `${filePath}:${line}:${character}__${schema}`;\n }\n\n getIdentifierKeyForNode(node: Node) {\n const filePath = node.getSourceFile().fileName;\n return this.getIdentifierKey(filePath);\n }\n\n getIdentifierKey(filePath: string) {\n return pathNormalizeToLinux(filePath);\n }\n\n setComputed(node: SchemaNode) {\n const { location, __schema } = node;\n const key = this.getComputedNodeKey(location, __schema);\n this.computed.set(key, node);\n }\n\n setIdentifiers(filePath: string, identifiers: IdentifierList) {\n this._identifiers.set(this.getIdentifierKey(filePath), identifiers);\n }\n\n setInternalIdentifiers(filePath: string, identifiers: IdentifierList) {\n const existing = this._internalIdentifiers.get(filePath);\n if (!existing) {\n this._internalIdentifiers.set(filePath, identifiers);\n } else {\n const uniqueIdentifiers = uniqBy(existing.identifiers.concat(identifiers.identifiers), (k) => k.aliasId || k.id);\n this._internalIdentifiers.set(filePath, new IdentifierList(uniqueIdentifiers));\n }\n }\n\n findComputedSchemaByName(name: string) {\n const computed = Array.from(this.computed.values());\n return computed.filter((schema) => schema.name === name);\n }\n\n async computeSchema(node: Node): Promise<SchemaNode> {\n const location = this.getLocation(node);\n const key = this.getComputedNodeKey(location, SyntaxKind[node.kind]);\n const existingComputedSchema = this.computed.get(key);\n if (existingComputedSchema) {\n return existingComputedSchema;\n }\n const computedSchema = await this.extractor.computeSchema(node, this);\n this.setComputed(computedSchema);\n return computedSchema;\n }\n\n async transformSchemaNode(schema: SchemaNode) {\n return this.extractor.transformAPI(schema, this);\n }\n\n /**\n * returns the location of a node in a source file.\n */\n getLocation(node: Node, targetSourceFile?: ts.SourceFile, absolutePath = false): Location {\n const sourceFile = targetSourceFile || node.getSourceFile();\n const filePath = absolutePath ? sourceFile.fileName : this.getPathRelativeToComponent(sourceFile.fileName);\n const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const line = position.line + 1;\n const character = position.character + 1;\n\n return {\n filePath: pathNormalizeToLinux(filePath),\n line,\n character,\n };\n }\n\n getLocationAsString(node: Node): string {\n const location = this.getLocation(node);\n return `${node.getSourceFile().fileName}, line: ${location.line}, character: ${location.character}`;\n }\n\n getPathRelativeToComponent(filePath: string): string {\n const basePath = this.component.filesystem.files[0].base;\n return relative(basePath, filePath);\n }\n\n /**\n * returns a signature for a node.\n */\n async getSignature(node: Node) {\n return this.tsserver.getSignatureHelp(this.getPath(node), this.getLocation(node));\n }\n\n /**\n * get the position for the tsserver.\n */\n getPosition(sourceFile: ts.SourceFile, line: number, offset: number): number {\n return sourceFile.getPositionOfLineAndCharacter(line - 1, offset - 1);\n }\n\n /**\n * get the path for a source file.\n */\n getPath(node: Node) {\n const sourceFile = node.getSourceFile();\n\n const fileName = sourceFile.fileName;\n\n if (!fileName.startsWith(this.componentRootPath) && !fileName.startsWith(this.hostRootPath)) {\n return join(this.componentRootPath, fileName);\n }\n\n return sourceFile.fileName;\n }\n\n async getQuickInfo(node: Node) {\n const location = this.getLocation(node);\n try {\n return await this.tsserver.getQuickInfo(this.getPath(node), location);\n } catch (err: any) {\n if (err.message === 'No content available.') {\n throw new Error(\n `unable to get quickinfo data from tsserver at ${this.getPath(node)}, Ln ${location.line}, Col ${\n location.character\n }`\n );\n }\n throw err;\n }\n }\n\n async getQuickInfoDisplayString(node: Node): Promise<string> {\n const quickInfo = await this.getQuickInfo(node);\n return quickInfo?.body?.displayString || '';\n }\n\n /**\n * returns the type definition for a type.\n */\n typeDefinition(node: Node) {\n return this.tsserver.getTypeDefinition(this.getPath(node), this.getLocation(node));\n }\n\n visitTypeDefinition() {}\n\n private getPathWithoutExtension(filePath: string) {\n const knownExtensions = ['ts', 'js', 'jsx', 'tsx'];\n const fileExtension = extname(filePath).substring(1);\n\n const filePathWithoutExtension = () => {\n if (knownExtensions.includes(fileExtension)) {\n return filePath.replace(new RegExp(`\\\\.${fileExtension}$`), '');\n }\n return filePath;\n };\n\n if (!isAbsolute(filePath)) {\n return filePathWithoutExtension();\n }\n\n if (filePath.startsWith(this.componentRootPath)) {\n return relative(this.componentRootPath, filePathWithoutExtension());\n }\n if (filePath.startsWith(this.hostRootPath)) {\n return relative(this.hostRootPath, filePathWithoutExtension());\n }\n return filePathWithoutExtension();\n }\n\n private isIndexFile(filePath: string, currentFilePath: string) {\n const indexFilePath = join(filePath, 'index');\n return pathNormalizeToLinux(indexFilePath) === currentFilePath;\n }\n\n findFileInComponent(filePath: string) {\n const normalizedFilePath = pathNormalizeToLinux(filePath);\n const pathToCompareWithoutExtension = this.getPathWithoutExtension(normalizedFilePath);\n\n const matchingFile = this.component.filesystem.files.find((file) => {\n const currentFilePath = pathNormalizeToLinux(file.path);\n const currentFilePathWithoutExtension = this.getPathWithoutExtension(currentFilePath);\n\n const isSameFilePath = pathToCompareWithoutExtension === currentFilePathWithoutExtension;\n\n const matches =\n isSameFilePath || this.isIndexFile(pathToCompareWithoutExtension, currentFilePathWithoutExtension);\n\n return matches;\n });\n return matchingFile;\n }\n\n private parsePackageNameFromPath(path: string) {\n const parts = path.split('node_modules');\n\n if (parts.length === 1) {\n return path;\n }\n\n const lastPart = parts[parts.length - 1].replace(sep, '');\n const pkgParts = lastPart.split('/');\n if (lastPart.startsWith('@')) {\n // scoped package\n return `${pkgParts[0]}/${pkgParts[1]}`;\n }\n const pkgName = pkgParts[0];\n if (pkgName === 'typescript') {\n // it's a built-in type, such as \"string\".\n return '';\n }\n return pkgName;\n }\n\n /**\n * return the file if part of the component.\n * otherwise, a reference to the target package and the type name.\n */\n getSourceFileInsideComponent(filePath: string) {\n const file = this.findFileInComponent(filePath);\n return file && this.extractor.parseSourceFile(file);\n }\n\n async getSourceFileFromNode(node: Node) {\n const filePath = await this.getFilePathByNode(node);\n if (!filePath) {\n return undefined;\n }\n return this.getSourceFileInsideComponent(filePath);\n }\n\n async getFilePathByNode(node: Node) {\n const def = await this.tsserver.getDefinition(this.getPath(node), this.getLocation(node));\n const firstDef = head(def?.body);\n return firstDef?.file;\n }\n\n async definitionInfo(node: Node): Promise<protocol.DefinitionInfo | undefined> {\n const location = this.getLocation(node);\n const filePath = this.getPath(node);\n\n const def = await this.tsserver.getDefinition(filePath, location);\n\n const firstDef = head(def?.body);\n\n return firstDef;\n }\n\n /**\n * get a definition for a given node.\n */\n async definition(definition: protocol.DefinitionInfo): Promise<Node | undefined> {\n const startPosition = definition.start;\n const sourceFile = this.getSourceFileInsideComponent(definition.file);\n if (!sourceFile) {\n // it might be an external reference, cant get the node\n return undefined;\n }\n const pos = this.getPosition(sourceFile, startPosition.line, startPosition.offset);\n const nodeAtPos = getTokenAtPosition(sourceFile, pos);\n return nodeAtPos;\n }\n\n /**\n * visit a definition for node - e.g. return it's schema.\n */\n async visitDefinition(node: Node): Promise<SchemaNode | undefined> {\n const definitionInfo = await this.definitionInfo(node);\n if (!definitionInfo) {\n return undefined;\n }\n\n const definition = await this.definition(definitionInfo);\n if (!definition) {\n return this.getTypeRefForExternalNode(node);\n }\n\n return this.visit(definition.parent);\n }\n\n async visit(node: Node): Promise<SchemaNode> {\n if (node.kind === SyntaxKind.Identifier && node.parent.parent.kind !== SyntaxKind.SourceFile) {\n return this.visit(node.parent);\n }\n return this.extractor.computeSchema(node, this);\n }\n\n references() {}\n\n isExported() {}\n\n isFromComponent() {}\n\n async getFileIdentifiers(exportDec: ExportDeclaration | ExportAssignment) {\n const file = exportDec.getSourceFile().fileName;\n const specifierPathStr =\n (exportDec.kind === SyntaxKind.ExportDeclaration && exportDec.moduleSpecifier?.getText()) || '';\n const specifierPath = specifierPathStr.substring(1, specifierPathStr.length - 1);\n const absPath = resolve(file, '..', specifierPath);\n const sourceFile = this.getSourceFileInsideComponent(absPath);\n if (!sourceFile) return [];\n return this.getIdentifiers(sourceFile);\n }\n\n async getFileExports(exportDec: ExportDeclaration | ExportAssignment) {\n const identifiers = await this.getFileIdentifiers(exportDec);\n return identifiers.filter((identifier) => ExportIdentifier.isExportIdentifier(identifier));\n }\n\n async getFileInternals(exportDec: ExportDeclaration | ExportAssignment) {\n const identifiers = await this.getFileIdentifiers(exportDec);\n return identifiers.filter((identifier) => !ExportIdentifier.isExportIdentifier(identifier));\n }\n\n getIdentifiers(node: Node) {\n return this.extractor.computeIdentifiers(node, this);\n }\n\n /**\n * tsserver has two different calls: \"definition\" and \"typeDefinition\".\n * normally, we need the \"typeDefinition\" to get the type data of a node.\n * sometimes, it has no data, for example when the node is of type TypeReference, and then using \"definition\" is\n * helpful. (couldn't find a rule when to use each one. e.g. \"VariableDeclaration\" sometimes has data only in\n * \"definition\" but it's not clear when/why).\n */\n async getDefinition(node: Node) {\n const typeDefinition = await this.typeDefinition(node);\n const headTypeDefinition = head(typeDefinition?.body);\n if (headTypeDefinition) {\n return headTypeDefinition;\n }\n\n const definition = await this.tsserver.getDefinition(node.getSourceFile().fileName, this.getLocation(node));\n const headDefinition = head(definition?.body);\n\n return headDefinition;\n }\n\n /**\n * Handles type resolution for unknown or external types.\n * Attempts to:\n * 1. Get type references when possible\n * 2. Fall back to inference when references can't be found\n */\n private async unknownExactType(node: Node, location: Location, typeStr = 'any') {\n try {\n if (this.isArrayType(typeStr)) {\n const baseType = this.getArrayBaseType(typeStr);\n const currentFilePath = node.getSourceFile().fileName;\n const baseTypeRef = await this.getTypeRef(baseType, this.getIdentifierKey(currentFilePath), location);\n\n if (baseTypeRef) {\n return new TypeArraySchema(location, baseTypeRef);\n }\n\n return new TypeArraySchema(location, new InferenceTypeSchema(location, baseType));\n }\n\n const currentFilePath = node.getSourceFile().fileName;\n const typeRef = await this.getTypeRef(typeStr, this.getIdentifierKey(currentFilePath), location);\n if (typeRef) {\n return typeRef;\n }\n\n const info = await this.getQuickInfo(node);\n if (!info?.body?.displayString) {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n\n const { displayString, kind } = info.body;\n\n if (kind === 'method') {\n const returnType = this.extractMethodReturnType(displayString);\n return await this.createMethodReturnSchema(node, location, returnType);\n }\n\n if (kind === 'function' || displayString.includes('=>')) {\n return await this.createFunctionSchema(node, location, displayString);\n }\n\n if (displayString.includes('{') && displayString.includes('}')) {\n return this.createObjectSchema(node, location, displayString);\n }\n\n if (displayString.includes('Promise<')) {\n const innerType = this.extractGenericType(displayString, 'Promise');\n return await this.createPromiseSchema(node, location, innerType);\n }\n\n return new InferenceTypeSchema(location, typeStr || 'any');\n } catch {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n }\n\n /**\n * Check if type is an array type (either T[] or Array<T>)\n */\n private isArrayType(typeStr: string): boolean {\n return typeStr.endsWith('[]') || typeStr.startsWith('Array<');\n }\n\n /**\n * Extract base type from array type\n */\n private getArrayBaseType(typeStr: string): string {\n if (typeStr.endsWith('[]')) {\n return typeStr.slice(0, -2);\n }\n if (typeStr.startsWith('Array<')) {\n const match = /Array<(.+)>/.exec(typeStr);\n return match?.[1] || 'any';\n }\n return typeStr;\n }\n\n /**\n * Extract return type from method signature\n */\n private extractMethodReturnType(displayString: string): string {\n const returnTypeMatch = displayString.match(/\\):\\s*(.+)$/);\n return returnTypeMatch ? returnTypeMatch[1].trim() : 'any';\n }\n\n /**\n * Extract content from generic type\n */\n private extractGenericType(type: string, wrapper: string): string {\n const match = new RegExp(`${wrapper}<(.+)>`).exec(type);\n return match ? match[1].trim() : type;\n }\n\n /**\n * Create schema for method return type, attempting to get type reference\n */\n private async createMethodReturnSchema(node: Node, location: Location, returnType: string): Promise<SchemaNode> {\n if (this.isArrayType(returnType)) {\n const baseType = this.getArrayBaseType(returnType);\n const currentFilePath = node.getSourceFile().fileName;\n const baseTypeRef = await this.getTypeRef(baseType, this.getIdentifierKey(currentFilePath), location);\n\n if (baseTypeRef) {\n return new TypeArraySchema(location, baseTypeRef);\n }\n return new TypeArraySchema(location, new InferenceTypeSchema(location, baseType));\n }\n\n const typeRef = await this.getTypeRef(returnType, this.getIdentifierKeyForNode(node), location);\n return typeRef || new InferenceTypeSchema(location, returnType);\n }\n\n /**\n * Create schema for function type, handling params and return type\n */\n private async createFunctionSchema(node: Node, location: Location, signature: string): Promise<FunctionLikeSchema> {\n const match = signature.match(/^\\s*\\(([^)]*)\\)\\s*(?:=>|:)\\s*(.+)$/);\n if (!match) {\n return new FunctionLikeSchema(location, 'anonymous', [], new InferenceTypeSchema(location, 'any'), signature);\n }\n\n const [, paramsStr, returnTypeStr] = match;\n const params = await this.createFunctionParameters(node, location, paramsStr);\n const returnType = await this.createMethodReturnSchema(node, location, returnTypeStr.trim());\n\n return new FunctionLikeSchema(location, 'anonymous', params, returnType, signature);\n }\n\n /**\n * Create parameters for function schema, attempting to get type references for param types\n */\n private async createFunctionParameters(\n node: Node,\n location: Location,\n paramsStr: string\n ): Promise<ParameterSchema[]> {\n if (!paramsStr.trim()) return [];\n\n const params = paramsStr.split(',');\n const paramSchemas: ParameterSchema[] = [];\n\n for (const param of params) {\n const [nameWithOptional, type] = param.split(':').map((s) => s.trim());\n const isOptional = nameWithOptional.includes('?');\n const name = nameWithOptional.replace('?', '');\n\n if (!type) {\n paramSchemas.push(new ParameterSchema(location, name, new InferenceTypeSchema(location, 'any'), isOptional));\n continue;\n }\n\n const currentFilePath = node.getSourceFile().fileName;\n const typeRef = await this.getTypeRef(type, this.getIdentifierKey(currentFilePath), location);\n paramSchemas.push(\n new ParameterSchema(location, name, typeRef || new InferenceTypeSchema(location, type), isOptional)\n );\n }\n\n return paramSchemas;\n }\n\n /**\n * Create schema for object literal type\n */\n private createObjectSchema(node: Node, location: Location, displayString: string): SchemaNode {\n const objMatch = displayString.match(/{([^}]+)}/);\n if (!objMatch) {\n return new InferenceTypeSchema(location, 'object');\n }\n\n const objContent = objMatch[1];\n const properties = objContent\n .split(';')\n .map((prop) => prop.trim())\n .filter(Boolean)\n .map((prop) => new InferenceTypeSchema(location, prop));\n\n return new ArrayLiteralExpressionSchema(properties, location);\n }\n\n /**\n * Create schema for Promise type, attempting to get type reference for the contained type\n */\n private async createPromiseSchema(node: Node, location: Location, innerType: string): Promise<SchemaNode> {\n const typeRef = await this.getTypeRef(innerType, this.getIdentifierKeyForNode(node), location);\n return typeRef || new InferenceTypeSchema(location, innerType);\n }\n\n // the reason for this check is to avoid infinite loop when calling `this.jump` with the same file+location\n private isDefInSameLocation(node: Node, definition: protocol.FileSpanWithContext) {\n if (definition.file !== node.getSourceFile().fileName) {\n return false;\n }\n const loc = this.getLocation(node);\n\n return loc.line === definition.start.line && loc.character === definition.start.offset;\n }\n\n /**\n * resolve a type by a node and its identifier.\n */\n async resolveType(node: Node & { type?: TypeNode }, typeStr: string): Promise<SchemaNode> {\n const location = this.getLocation(node);\n\n // check if internal ref with typeInfo\n const internalRef = await this.getTypeRef(typeStr, this.getIdentifierKeyForNode(node), location);\n\n if (internalRef) return internalRef;\n\n // if a node has \"type\" prop, it has the type data of the node. this normally happens when the code has the type\n // explicitly, e.g. `const str: string` vs implicitly `const str = 'some-string'`, which the node won't have \"type\"\n if (node.type && ts.isTypeNode(node.type)) {\n return this.computeSchema(node.type);\n }\n\n const definition = await this.getDefinition(node);\n\n if (!definition) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n if (this.isDefInSameLocation(node, definition)) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n const definitionNode = await this.definition(definition);\n\n if (!definitionNode) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n const definitionNodeName = definitionNode?.getText();\n\n // check if internal ref with definition info\n const definitionInternalRef = await this.getTypeRef(\n definitionNodeName,\n this.getIdentifierKeyForNode(definitionNode),\n location\n );\n\n if (definitionInternalRef) return definitionInternalRef;\n\n const transformer = this.extractor.getTransformer(definitionNode, this);\n\n if (transformer === undefined) {\n const file = this.findFileInComponent(definition.file);\n if (!file) return this.getTypeRefForExternalPath(typeStr, definition.file, location);\n return this.unknownExactType(node, location, typeStr);\n }\n\n const schemaNode = await this.visit(definitionNode);\n\n if (!schemaNode) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n const apiTransformer = this.extractor.getAPITransformer(schemaNode);\n let transformedApi = apiTransformer ? await apiTransformer.transform(schemaNode, this) : schemaNode;\n if (!transformedApi) {\n transformedApi = new IgnoredSchema(schemaNode);\n }\n return transformedApi;\n }\n\n private getCompIdByPkgName(pkgName: string): ComponentID | undefined {\n return this.componentDeps.find((dep) => dep.packageName === pkgName)?.componentId;\n }\n\n async getTypeRef(typeStr: string, filePath: string, location: Location): Promise<TypeRefSchema | undefined> {\n const nodeIdentifierKey = this.getIdentifierKey(filePath);\n const mainFileIdentifierKey = this.mainFileIdentifierKey;\n const nodeIdentifierList = this.identifiers.get(nodeIdentifierKey);\n const mainIdentifierList = this.identifiers.get(mainFileIdentifierKey);\n\n const nodeIdentifier = new Identifier(typeStr, nodeIdentifierKey);\n const mainIdentifier = new Identifier(typeStr, mainFileIdentifierKey);\n\n const parsedNodeIdentifier = nodeIdentifierList?.find(nodeIdentifier);\n\n const parsedMainIdentifier = mainIdentifierList?.find(mainIdentifier);\n const isExportedFromMain = parsedMainIdentifier && ExportIdentifier.isExportIdentifier(parsedMainIdentifier);\n\n if (!parsedNodeIdentifier) return undefined;\n\n if (!isExportedFromMain) {\n const src = parsedNodeIdentifier.sourceFilePath;\n const isLocalOrRelative = !src || isRelativeImport(src); // bare specifiers (e.g., 'react') are excluded\n if (isLocalOrRelative) {\n const key = src ? parsedNodeIdentifier.normalizedPath : parsedNodeIdentifier.filePath;\n this.setInternalIdentifiers(this.getIdentifierKey(key), new IdentifierList([parsedNodeIdentifier]));\n }\n }\n return this.resolveTypeRef(parsedNodeIdentifier, location, isExportedFromMain);\n }\n\n async resolveTypeRef(\n identifier: Identifier,\n location: Location,\n isExportedFromMain?: boolean\n ): Promise<TypeRefSchema> {\n const sourceFilePath = identifier.sourceFilePath;\n\n if (!sourceFilePath || (isExportedFromMain && isRelativeImport(sourceFilePath))) {\n return new TypeRefSchema(\n location,\n identifier.id,\n undefined,\n undefined,\n !isExportedFromMain ? this.getPathRelativeToComponent(identifier.filePath) : undefined,\n sourceFilePath\n );\n }\n\n if (!isRelativeImport(sourceFilePath)) {\n const pkgName = this.parsePackageNameFromPath(sourceFilePath);\n const compIdByPkg = this.getCompIdByPkgName(pkgName);\n\n const compIdByPath = await this.extractor.getComponentIDByPath(sourceFilePath);\n\n if (compIdByPath) {\n return new TypeRefSchema(location, identifier.id, compIdByPath);\n }\n\n if (compIdByPkg) {\n return new TypeRefSchema(location, identifier.id, compIdByPkg);\n }\n\n // package without comp id\n return new TypeRefSchema(location, identifier.id, undefined, pkgName);\n }\n\n const relativeDir = identifier.filePath.substring(0, identifier.filePath.lastIndexOf('/'));\n const absFilePath = resolve(this.componentRootPath, relativeDir, sourceFilePath);\n\n const compFilePath = this.findFileInComponent(absFilePath);\n if (!compFilePath) {\n // @todo handle this better\n throw new Error(\n `cannot find file in component \\n source file path ${sourceFilePath}\\n\n identifier file path ${identifier.filePath}\\nrelative dir ${relativeDir}\\n\n absFilePath ${absFilePath}`\n );\n return new TypeRefSchema(location, identifier.id);\n }\n\n const idKey = this.getIdentifierKey(compFilePath?.path);\n\n // if re exported from a file, recurse until definition\n const exportedIdentifier = (this.identifiers.get(idKey)?.identifiers || []).find((i) => i.id === identifier.id);\n\n if (exportedIdentifier) {\n return this.resolveTypeRef(exportedIdentifier, location, isExportedFromMain);\n }\n\n return new TypeRefSchema(location, identifier.id, undefined, undefined, undefined);\n }\n\n async getTypeRefForExternalNode(node: Node): Promise<TypeRefSchema> {\n const info = await this.getQuickInfo(node);\n const typeStr = parseTypeFromQuickInfo(info);\n const location = this.getLocation(node);\n const filePath = this.getPath(node);\n return this.getTypeRefForExternalPath(typeStr, filePath, location);\n }\n\n async getTypeRefForExternalPath(typeStr: string, filePath: string, location: Location): Promise<TypeRefSchema> {\n const compIdByPath = await this.extractor.getComponentIDByPath(filePath);\n if (compIdByPath) {\n return new TypeRefSchema(location, typeStr, compIdByPath);\n }\n const pkgName = this.parsePackageNameFromPath(filePath);\n const compIdByPkg = this.getCompIdByPkgName(pkgName);\n if (compIdByPkg) {\n return new TypeRefSchema(location, typeStr, compIdByPkg);\n }\n return new TypeRefSchema(location, typeStr, undefined, pkgName);\n }\n\n buildTopLevelNameIndex(sf: ts.SourceFile): Map<string, ts.Node> {\n const map = new Map<string, ts.Node>();\n for (const s of sf.statements) {\n const name =\n 'name' in s && s.name && ts.isIdentifier((s as any).name)\n ? ((s as any).name as ts.Identifier).text\n : ts.isVariableStatement(s) &&\n s.declarationList.declarations.length === 1 &&\n ts.isIdentifier(s.declarationList.declarations[0].name)\n ? s.declarationList.declarations[0].name.text\n : undefined;\n\n if (name && !map.has(name)) map.set(name, s);\n }\n return map;\n }\n\n // inside TypeScriptExtractor\n /**\n * Walk a SchemaNode tree and collect all TypeRefSchema names that\n * have an internalFilePath.\n *\n * We intentionally do NOT try to match the identifierKey here –\n * we already scope lookups by `nameIndex` for the current file,\n * so cross-file refs will just fail `nameIndex.get(name)` and be ignored.\n *\n * This lets us correctly close over cases like:\n * type MyFirstCombinedProps = MyFirstProps & MyFirstPropsExtra;\n * where `MyFirstPropsExtra` is internal to the same file.\n */\n collectSameFileInternalTypeRefs(root: SchemaNode): string[] {\n const result = new Set<string>();\n const stack: SchemaNode[] = [root];\n\n while (stack.length) {\n const node = stack.pop();\n if (!node || typeof node !== 'object') continue;\n\n if (TypeRefSchema.isTypeRefSchema(node) && typeof node.name === 'string' && node.internalFilePath) {\n result.add(node.name);\n }\n\n for (const value of Object.values(node)) {\n if (!value) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n if (v && typeof v === 'object') stack.push(v as SchemaNode);\n }\n } else if (typeof value === 'object') {\n stack.push(value as SchemaNode);\n }\n }\n }\n\n return Array.from(result);\n }\n\n async jsDocToDocSchema(node: Node): Promise<DocSchema | undefined> {\n if (!canHaveJsDoc(node)) {\n return undefined;\n }\n const jsDocs = getJsDoc(node);\n\n if (!jsDocs.length) {\n return undefined;\n }\n // not sure how common it is to have multiple JSDocs. never seen it before.\n // regardless, in typescript implementation of methods like `getJSDocDeprecatedTag()`, they use the first one. (`getFirstJSDocTag()`)\n const jsDoc = jsDocs[0];\n\n const location = this.getLocation(jsDoc);\n // Extract link comments and filter them out from the main comment\n const linkComments = (\n typeof jsDoc.comment !== 'string' ? (jsDoc.comment?.filter((c) => c.kind === ts.SyntaxKind.JSDocLink) ?? []) : []\n ) as ts.JSDocLink[];\n const linkTags = linkComments.map((linkComment) => {\n const tagName = 'link';\n const tagText = `${linkComment.name?.getText() ?? ''}${linkComment.text ?? ''}`;\n const tagLocation = this.getLocation(linkComment);\n return new TagSchema(tagLocation, tagName, tagText);\n });\n\n const commentsWithoutLink = (typeof jsDoc.comment !== 'string'\n ? (jsDoc.comment?.filter((c) => c.kind !== ts.SyntaxKind.JSDocLink) ?? '')\n : jsDoc.comment) as unknown as ts.NodeArray<ts.JSDocComment>;\n\n const comment = getTextOfJSDocComment(commentsWithoutLink);\n\n const tags = (jsDoc.tags ? await pMapSeries(jsDoc.tags, (tag) => tagParser(tag, this, this.formatter)) : []).concat(\n linkTags\n );\n\n return new DocSchema(location, jsDoc.getText(), comment, tags);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAO,mBAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,kBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAaA,SAAAQ,YAAA;EAAA,MAAAR,IAAA,GAAAS,sBAAA,CAAAR,OAAA;EAAAO,WAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAU,gBAAA;EAAA,MAAAV,IAAA,GAAAC,OAAA;EAAAS,eAAA,YAAAA,CAAA;IAAA,OAAAV,IAAA;EAAA;EAAA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ACK,OAAA,CAAA3S,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_tsutils","data","require","_typescript","_interopRequireWildcard","_lodash","_legacy","_path","_semanticsEntities","_pMapSeries","_interopRequireDefault","_identifierList","_parseTypeFromQuickInfo","_jsdocToDocSchema","_identifier","_exportIdentifier","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","KEYWORD_TYPE_STRINGS","Set","SchemaExtractorContext","mainFile","pathNormalizeToLinux","getPathRelativeToComponent","component","path","identifiers","_identifiers","internalIdentifiers","_internalIdentifiers","computed","_computed","mainFileIdentifierKey","getIdentifierKey","mainModuleIdentifiers","constructor","tsserver","extractor","componentDeps","componentRootPath","hostRootPath","formatter","Map","getComputedNodeKey","filePath","line","character","schema","getIdentifierKeyForNode","node","getSourceFile","fileName","setComputed","location","__schema","key","setIdentifiers","setInternalIdentifiers","existing","uniqueIdentifiers","uniqBy","concat","k","aliasId","id","IdentifierList","findComputedSchemaByName","name","Array","from","values","filter","computeSchema","getLocation","SyntaxKind","kind","existingComputedSchema","computedSchema","transformSchemaNode","transformAPI","targetSourceFile","absolutePath","sourceFile","position","getLineAndCharacterOfPosition","getStart","getLocationAsString","basePath","filesystem","files","base","relative","getSignature","getSignatureHelp","getPath","getPosition","offset","getPositionOfLineAndCharacter","startsWith","join","getQuickInfo","err","message","Error","getQuickInfoDisplayString","quickInfo","body","displayString","typeDefinition","getTypeDefinition","visitTypeDefinition","getPathWithoutExtension","knownExtensions","fileExtension","extname","substring","filePathWithoutExtension","includes","replace","RegExp","isAbsolute","isIndexFile","currentFilePath","indexFilePath","findFileInComponent","normalizedFilePath","pathToCompareWithoutExtension","matchingFile","find","file","currentFilePathWithoutExtension","isSameFilePath","matches","parsePackageNameFromPath","parts","split","length","lastPart","sep","pkgParts","pkgName","getSourceFileInsideComponent","parseSourceFile","getSourceFileFromNode","getFilePathByNode","undefined","def","getDefinition","firstDef","head","definitionInfo","definition","startPosition","start","pos","nodeAtPos","getTokenAtPosition","visitDefinition","getTypeRefForExternalNode","visit","parent","Identifier","SourceFile","references","isExported","isFromComponent","getFileIdentifiers","exportDec","specifierPathStr","ExportDeclaration","moduleSpecifier","getText","specifierPath","absPath","resolve","getIdentifiers","getFileExports","identifier","ExportIdentifier","isExportIdentifier","getFileInternals","computeIdentifiers","headTypeDefinition","headDefinition","unknownExactType","typeStr","isArrayType","baseType","getArrayBaseType","baseTypeRef","getTypeRef","TypeArraySchema","InferenceTypeSchema","typeRef","info","returnType","extractMethodReturnType","createMethodReturnSchema","createFunctionSchema","createObjectSchema","innerType","extractGenericType","createPromiseSchema","endsWith","slice","match","exec","returnTypeMatch","trim","type","wrapper","signature","FunctionLikeSchema","paramsStr","returnTypeStr","params","createFunctionParameters","paramSchemas","param","nameWithOptional","map","s","isOptional","push","ParameterSchema","objMatch","objContent","properties","prop","Boolean","ArrayLiteralExpressionSchema","isDefInSameLocation","loc","isDefWithinNode","end","getEnd","afterStart","beforeEnd","resolveType","internalRef","ts","isTypeNode","definitionNode","definitionNodeName","definitionInternalRef","transformer","getTransformer","getTypeRefForExternalPath","schemaNode","apiTransformer","getAPITransformer","transformedApi","transform","IgnoredSchema","getCompIdByPkgName","dep","packageName","componentId","nodeIdentifierKey","nodeIdentifierList","mainIdentifierList","nodeIdentifier","mainIdentifier","parsedNodeIdentifier","parsedMainIdentifier","isExportedFromMain","src","sourceFilePath","isLocalOrRelative","isRelativeImport","normalizedPath","resolveTypeRef","TypeRefSchema","compIdByPkg","compIdByPath","getComponentIDByPath","relativeDir","lastIndexOf","absFilePath","compFilePath","idKey","exportedIdentifier","parseTypeFromQuickInfo","buildTopLevelNameIndex","sf","statements","isIdentifier","text","isVariableStatement","declarationList","declarations","collectSameFileInternalTypeRefs","root","result","stack","pop","isTypeRefSchema","internalFilePath","add","isArray","v","jsDocToDocSchema","canHaveJsDoc","jsDocs","getJsDoc","jsDoc","linkComments","comment","c","JSDocLink","linkTags","linkComment","tagName","tagText","tagLocation","TagSchema","commentsWithoutLink","getTextOfJSDocComment","tags","pMapSeries","tag","tagParser","DocSchema","exports"],"sources":["schema-extractor-context.ts"],"sourcesContent":["import type { TsserverClient } from '@teambit/ts-server';\nimport { getTokenAtPosition, canHaveJsDoc, getJsDoc } from 'tsutils';\nimport type { ExportAssignment, ExportDeclaration, Node, TypeNode } from 'typescript';\nimport ts, { getTextOfJSDocComment, SyntaxKind } from 'typescript';\nimport { head, uniqBy } from 'lodash';\n// @ts-ignore david we should figure fix this.\n// eslint-disable-next-line import/no-unresolved\nimport type protocol from 'typescript/lib/protocol';\nimport { pathNormalizeToLinux, isRelativeImport } from '@teambit/legacy.utils';\nimport { resolve, sep, relative, join, isAbsolute, extname } from 'path';\nimport type { Component, ComponentID } from '@teambit/component';\nimport type { SchemaNode, Location } from '@teambit/semantics.entities.semantic-schema';\nimport {\n TypeRefSchema,\n InferenceTypeSchema,\n DocSchema,\n IgnoredSchema,\n TagSchema,\n TypeArraySchema,\n ArrayLiteralExpressionSchema,\n ParameterSchema,\n FunctionLikeSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport type { ComponentDependency } from '@teambit/dependency-resolver';\nimport type { Formatter } from '@teambit/formatter';\nimport pMapSeries from 'p-map-series';\nimport type { TypeScriptExtractor } from './typescript.extractor';\nimport { IdentifierList } from './identifier-list';\nimport { parseTypeFromQuickInfo } from './transformers/utils/parse-type-from-quick-info';\nimport { tagParser } from './transformers/utils/jsdoc-to-doc-schema';\nimport { Identifier } from './identifier';\nimport { ExportIdentifier } from './export-identifier';\n\n/** TS keyword/intrinsic types — an inferred type string that IS one of these has no definition to hunt for. */\nconst KEYWORD_TYPE_STRINGS = new Set([\n 'any',\n 'unknown',\n 'never',\n 'void',\n 'undefined',\n 'null',\n 'boolean',\n 'string',\n 'number',\n 'bigint',\n 'symbol',\n 'object',\n 'this',\n]);\n\nexport class SchemaExtractorContext {\n /**\n * list of all declared identifiers (exported and internal) by filename\n */\n private _identifiers = new Map<string, IdentifierList>();\n private _internalIdentifiers = new Map<string, IdentifierList>();\n\n /**\n * computed nodes by filename and (position (line:character))\n */\n private _computed = new Map<string, SchemaNode>();\n\n get mainFile() {\n return pathNormalizeToLinux(this.getPathRelativeToComponent(this.component.mainFile.path));\n }\n\n get identifiers() {\n return this._identifiers;\n }\n\n get internalIdentifiers() {\n return this._internalIdentifiers;\n }\n\n get computed() {\n return this._computed;\n }\n\n get mainFileIdentifierKey() {\n const mainFile = this.component.mainFile;\n return this.getIdentifierKey(mainFile.path);\n }\n\n get mainModuleIdentifiers() {\n return this.identifiers.get(this.mainFileIdentifierKey);\n }\n\n constructor(\n readonly tsserver: TsserverClient,\n readonly component: Component,\n readonly extractor: TypeScriptExtractor,\n readonly componentDeps: ComponentDependency[],\n readonly componentRootPath: string,\n readonly hostRootPath: string,\n readonly formatter?: Formatter\n ) {\n this.componentRootPath = pathNormalizeToLinux(componentRootPath);\n this.hostRootPath = pathNormalizeToLinux(hostRootPath);\n }\n\n getComputedNodeKey({ filePath, line, character }: Location, schema: string) {\n return `${filePath}:${line}:${character}__${schema}`;\n }\n\n getIdentifierKeyForNode(node: Node) {\n const filePath = node.getSourceFile().fileName;\n return this.getIdentifierKey(filePath);\n }\n\n getIdentifierKey(filePath: string) {\n return pathNormalizeToLinux(filePath);\n }\n\n setComputed(node: SchemaNode) {\n const { location, __schema } = node;\n const key = this.getComputedNodeKey(location, __schema);\n this.computed.set(key, node);\n }\n\n setIdentifiers(filePath: string, identifiers: IdentifierList) {\n this._identifiers.set(this.getIdentifierKey(filePath), identifiers);\n }\n\n setInternalIdentifiers(filePath: string, identifiers: IdentifierList) {\n const existing = this._internalIdentifiers.get(filePath);\n if (!existing) {\n this._internalIdentifiers.set(filePath, identifiers);\n } else {\n const uniqueIdentifiers = uniqBy(existing.identifiers.concat(identifiers.identifiers), (k) => k.aliasId || k.id);\n this._internalIdentifiers.set(filePath, new IdentifierList(uniqueIdentifiers));\n }\n }\n\n findComputedSchemaByName(name: string) {\n const computed = Array.from(this.computed.values());\n return computed.filter((schema) => schema.name === name);\n }\n\n async computeSchema(node: Node): Promise<SchemaNode> {\n const location = this.getLocation(node);\n const key = this.getComputedNodeKey(location, SyntaxKind[node.kind]);\n const existingComputedSchema = this.computed.get(key);\n if (existingComputedSchema) {\n return existingComputedSchema;\n }\n const computedSchema = await this.extractor.computeSchema(node, this);\n this.setComputed(computedSchema);\n return computedSchema;\n }\n\n async transformSchemaNode(schema: SchemaNode) {\n return this.extractor.transformAPI(schema, this);\n }\n\n /**\n * returns the location of a node in a source file.\n */\n getLocation(node: Node, targetSourceFile?: ts.SourceFile, absolutePath = false): Location {\n const sourceFile = targetSourceFile || node.getSourceFile();\n const filePath = absolutePath ? sourceFile.fileName : this.getPathRelativeToComponent(sourceFile.fileName);\n const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const line = position.line + 1;\n const character = position.character + 1;\n\n return {\n filePath: pathNormalizeToLinux(filePath),\n line,\n character,\n };\n }\n\n getLocationAsString(node: Node): string {\n const location = this.getLocation(node);\n return `${node.getSourceFile().fileName}, line: ${location.line}, character: ${location.character}`;\n }\n\n getPathRelativeToComponent(filePath: string): string {\n const basePath = this.component.filesystem.files[0].base;\n return relative(basePath, filePath);\n }\n\n /**\n * returns a signature for a node.\n */\n async getSignature(node: Node) {\n return this.tsserver.getSignatureHelp(this.getPath(node), this.getLocation(node));\n }\n\n /**\n * get the position for the tsserver.\n */\n getPosition(sourceFile: ts.SourceFile, line: number, offset: number): number {\n return sourceFile.getPositionOfLineAndCharacter(line - 1, offset - 1);\n }\n\n /**\n * get the path for a source file.\n */\n getPath(node: Node) {\n const sourceFile = node.getSourceFile();\n\n const fileName = sourceFile.fileName;\n\n if (!fileName.startsWith(this.componentRootPath) && !fileName.startsWith(this.hostRootPath)) {\n return join(this.componentRootPath, fileName);\n }\n\n return sourceFile.fileName;\n }\n\n async getQuickInfo(node: Node) {\n const location = this.getLocation(node);\n try {\n return await this.tsserver.getQuickInfo(this.getPath(node), location);\n } catch (err: any) {\n if (err.message === 'No content available.') {\n throw new Error(\n `unable to get quickinfo data from tsserver at ${this.getPath(node)}, Ln ${location.line}, Col ${\n location.character\n }`\n );\n }\n throw err;\n }\n }\n\n async getQuickInfoDisplayString(node: Node): Promise<string> {\n const quickInfo = await this.getQuickInfo(node);\n return quickInfo?.body?.displayString || '';\n }\n\n /**\n * returns the type definition for a type.\n */\n typeDefinition(node: Node) {\n return this.tsserver.getTypeDefinition(this.getPath(node), this.getLocation(node));\n }\n\n visitTypeDefinition() {}\n\n private getPathWithoutExtension(filePath: string) {\n const knownExtensions = ['ts', 'js', 'jsx', 'tsx'];\n const fileExtension = extname(filePath).substring(1);\n\n const filePathWithoutExtension = () => {\n if (knownExtensions.includes(fileExtension)) {\n return filePath.replace(new RegExp(`\\\\.${fileExtension}$`), '');\n }\n return filePath;\n };\n\n if (!isAbsolute(filePath)) {\n return filePathWithoutExtension();\n }\n\n if (filePath.startsWith(this.componentRootPath)) {\n return relative(this.componentRootPath, filePathWithoutExtension());\n }\n if (filePath.startsWith(this.hostRootPath)) {\n return relative(this.hostRootPath, filePathWithoutExtension());\n }\n return filePathWithoutExtension();\n }\n\n private isIndexFile(filePath: string, currentFilePath: string) {\n const indexFilePath = join(filePath, 'index');\n return pathNormalizeToLinux(indexFilePath) === currentFilePath;\n }\n\n findFileInComponent(filePath: string) {\n const normalizedFilePath = pathNormalizeToLinux(filePath);\n const pathToCompareWithoutExtension = this.getPathWithoutExtension(normalizedFilePath);\n\n const matchingFile = this.component.filesystem.files.find((file) => {\n const currentFilePath = pathNormalizeToLinux(file.path);\n const currentFilePathWithoutExtension = this.getPathWithoutExtension(currentFilePath);\n\n const isSameFilePath = pathToCompareWithoutExtension === currentFilePathWithoutExtension;\n\n const matches =\n isSameFilePath || this.isIndexFile(pathToCompareWithoutExtension, currentFilePathWithoutExtension);\n\n return matches;\n });\n return matchingFile;\n }\n\n private parsePackageNameFromPath(path: string) {\n const parts = path.split('node_modules');\n\n if (parts.length === 1) {\n return path;\n }\n\n const lastPart = parts[parts.length - 1].replace(sep, '');\n const pkgParts = lastPart.split('/');\n if (lastPart.startsWith('@')) {\n // scoped package\n return `${pkgParts[0]}/${pkgParts[1]}`;\n }\n const pkgName = pkgParts[0];\n if (pkgName === 'typescript') {\n // it's a built-in type, such as \"string\".\n return '';\n }\n return pkgName;\n }\n\n /**\n * return the file if part of the component.\n * otherwise, a reference to the target package and the type name.\n */\n getSourceFileInsideComponent(filePath: string) {\n const file = this.findFileInComponent(filePath);\n return file && this.extractor.parseSourceFile(file);\n }\n\n async getSourceFileFromNode(node: Node) {\n const filePath = await this.getFilePathByNode(node);\n if (!filePath) {\n return undefined;\n }\n return this.getSourceFileInsideComponent(filePath);\n }\n\n async getFilePathByNode(node: Node) {\n const def = await this.tsserver.getDefinition(this.getPath(node), this.getLocation(node));\n const firstDef = head(def?.body);\n return firstDef?.file;\n }\n\n async definitionInfo(node: Node): Promise<protocol.DefinitionInfo | undefined> {\n const location = this.getLocation(node);\n const filePath = this.getPath(node);\n\n const def = await this.tsserver.getDefinition(filePath, location);\n\n const firstDef = head(def?.body);\n\n return firstDef;\n }\n\n /**\n * get a definition for a given node.\n */\n async definition(definition: protocol.DefinitionInfo): Promise<Node | undefined> {\n const startPosition = definition.start;\n const sourceFile = this.getSourceFileInsideComponent(definition.file);\n if (!sourceFile) {\n // it might be an external reference, cant get the node\n return undefined;\n }\n const pos = this.getPosition(sourceFile, startPosition.line, startPosition.offset);\n const nodeAtPos = getTokenAtPosition(sourceFile, pos);\n return nodeAtPos;\n }\n\n /**\n * visit a definition for node - e.g. return it's schema.\n */\n async visitDefinition(node: Node): Promise<SchemaNode | undefined> {\n const definitionInfo = await this.definitionInfo(node);\n if (!definitionInfo) {\n return undefined;\n }\n\n const definition = await this.definition(definitionInfo);\n if (!definition) {\n return this.getTypeRefForExternalNode(node);\n }\n\n return this.visit(definition.parent);\n }\n\n async visit(node: Node): Promise<SchemaNode> {\n if (node.kind === SyntaxKind.Identifier && node.parent.parent.kind !== SyntaxKind.SourceFile) {\n return this.visit(node.parent);\n }\n return this.extractor.computeSchema(node, this);\n }\n\n references() {}\n\n isExported() {}\n\n isFromComponent() {}\n\n async getFileIdentifiers(exportDec: ExportDeclaration | ExportAssignment) {\n const file = exportDec.getSourceFile().fileName;\n const specifierPathStr =\n (exportDec.kind === SyntaxKind.ExportDeclaration && exportDec.moduleSpecifier?.getText()) || '';\n const specifierPath = specifierPathStr.substring(1, specifierPathStr.length - 1);\n const absPath = resolve(file, '..', specifierPath);\n const sourceFile = this.getSourceFileInsideComponent(absPath);\n if (!sourceFile) return [];\n return this.getIdentifiers(sourceFile);\n }\n\n async getFileExports(exportDec: ExportDeclaration | ExportAssignment) {\n const identifiers = await this.getFileIdentifiers(exportDec);\n return identifiers.filter((identifier) => ExportIdentifier.isExportIdentifier(identifier));\n }\n\n async getFileInternals(exportDec: ExportDeclaration | ExportAssignment) {\n const identifiers = await this.getFileIdentifiers(exportDec);\n return identifiers.filter((identifier) => !ExportIdentifier.isExportIdentifier(identifier));\n }\n\n getIdentifiers(node: Node) {\n return this.extractor.computeIdentifiers(node, this);\n }\n\n /**\n * tsserver has two different calls: \"definition\" and \"typeDefinition\".\n * normally, we need the \"typeDefinition\" to get the type data of a node.\n * sometimes, it has no data, for example when the node is of type TypeReference, and then using \"definition\" is\n * helpful. (couldn't find a rule when to use each one. e.g. \"VariableDeclaration\" sometimes has data only in\n * \"definition\" but it's not clear when/why).\n */\n async getDefinition(node: Node) {\n const typeDefinition = await this.typeDefinition(node);\n const headTypeDefinition = head(typeDefinition?.body);\n if (headTypeDefinition) {\n return headTypeDefinition;\n }\n\n const definition = await this.tsserver.getDefinition(node.getSourceFile().fileName, this.getLocation(node));\n const headDefinition = head(definition?.body);\n\n return headDefinition;\n }\n\n /**\n * Handles type resolution for unknown or external types.\n * Attempts to:\n * 1. Get type references when possible\n * 2. Fall back to inference when references can't be found\n */\n private async unknownExactType(node: Node, location: Location, typeStr = 'any') {\n try {\n if (this.isArrayType(typeStr)) {\n const baseType = this.getArrayBaseType(typeStr);\n const currentFilePath = node.getSourceFile().fileName;\n const baseTypeRef = await this.getTypeRef(baseType, this.getIdentifierKey(currentFilePath), location);\n\n if (baseTypeRef) {\n return new TypeArraySchema(location, baseTypeRef);\n }\n\n return new TypeArraySchema(location, new InferenceTypeSchema(location, baseType));\n }\n\n const currentFilePath = node.getSourceFile().fileName;\n const typeRef = await this.getTypeRef(typeStr, this.getIdentifierKey(currentFilePath), location);\n if (typeRef) {\n return typeRef;\n }\n\n const info = await this.getQuickInfo(node);\n if (!info?.body?.displayString) {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n\n const { displayString, kind } = info.body;\n\n if (kind === 'method') {\n const returnType = this.extractMethodReturnType(displayString);\n return await this.createMethodReturnSchema(node, location, returnType);\n }\n\n if (kind === 'function' || displayString.includes('=>')) {\n return await this.createFunctionSchema(node, location, displayString);\n }\n\n if (displayString.includes('{') && displayString.includes('}')) {\n return this.createObjectSchema(node, location, displayString);\n }\n\n if (displayString.includes('Promise<')) {\n const innerType = this.extractGenericType(displayString, 'Promise');\n return await this.createPromiseSchema(node, location, innerType);\n }\n\n return new InferenceTypeSchema(location, typeStr || 'any');\n } catch {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n }\n\n /**\n * Check if type is an array type (either T[] or Array<T>)\n */\n private isArrayType(typeStr: string): boolean {\n return typeStr.endsWith('[]') || typeStr.startsWith('Array<');\n }\n\n /**\n * Extract base type from array type\n */\n private getArrayBaseType(typeStr: string): string {\n if (typeStr.endsWith('[]')) {\n return typeStr.slice(0, -2);\n }\n if (typeStr.startsWith('Array<')) {\n const match = /Array<(.+)>/.exec(typeStr);\n return match?.[1] || 'any';\n }\n return typeStr;\n }\n\n /**\n * Extract return type from method signature\n */\n private extractMethodReturnType(displayString: string): string {\n const returnTypeMatch = displayString.match(/\\):\\s*(.+)$/);\n return returnTypeMatch ? returnTypeMatch[1].trim() : 'any';\n }\n\n /**\n * Extract content from generic type\n */\n private extractGenericType(type: string, wrapper: string): string {\n const match = new RegExp(`${wrapper}<(.+)>`).exec(type);\n return match ? match[1].trim() : type;\n }\n\n /**\n * Create schema for method return type, attempting to get type reference\n */\n private async createMethodReturnSchema(node: Node, location: Location, returnType: string): Promise<SchemaNode> {\n if (this.isArrayType(returnType)) {\n const baseType = this.getArrayBaseType(returnType);\n const currentFilePath = node.getSourceFile().fileName;\n const baseTypeRef = await this.getTypeRef(baseType, this.getIdentifierKey(currentFilePath), location);\n\n if (baseTypeRef) {\n return new TypeArraySchema(location, baseTypeRef);\n }\n return new TypeArraySchema(location, new InferenceTypeSchema(location, baseType));\n }\n\n const typeRef = await this.getTypeRef(returnType, this.getIdentifierKeyForNode(node), location);\n return typeRef || new InferenceTypeSchema(location, returnType);\n }\n\n /**\n * Create schema for function type, handling params and return type\n */\n private async createFunctionSchema(node: Node, location: Location, signature: string): Promise<FunctionLikeSchema> {\n const match = signature.match(/^\\s*\\(([^)]*)\\)\\s*(?:=>|:)\\s*(.+)$/);\n if (!match) {\n return new FunctionLikeSchema(location, 'anonymous', [], new InferenceTypeSchema(location, 'any'), signature);\n }\n\n const [, paramsStr, returnTypeStr] = match;\n const params = await this.createFunctionParameters(node, location, paramsStr);\n const returnType = await this.createMethodReturnSchema(node, location, returnTypeStr.trim());\n\n return new FunctionLikeSchema(location, 'anonymous', params, returnType, signature);\n }\n\n /**\n * Create parameters for function schema, attempting to get type references for param types\n */\n private async createFunctionParameters(\n node: Node,\n location: Location,\n paramsStr: string\n ): Promise<ParameterSchema[]> {\n if (!paramsStr.trim()) return [];\n\n const params = paramsStr.split(',');\n const paramSchemas: ParameterSchema[] = [];\n\n for (const param of params) {\n const [nameWithOptional, type] = param.split(':').map((s) => s.trim());\n const isOptional = nameWithOptional.includes('?');\n const name = nameWithOptional.replace('?', '');\n\n if (!type) {\n paramSchemas.push(new ParameterSchema(location, name, new InferenceTypeSchema(location, 'any'), isOptional));\n continue;\n }\n\n const currentFilePath = node.getSourceFile().fileName;\n const typeRef = await this.getTypeRef(type, this.getIdentifierKey(currentFilePath), location);\n paramSchemas.push(\n new ParameterSchema(location, name, typeRef || new InferenceTypeSchema(location, type), isOptional)\n );\n }\n\n return paramSchemas;\n }\n\n /**\n * Create schema for object literal type\n */\n private createObjectSchema(node: Node, location: Location, displayString: string): SchemaNode {\n const objMatch = displayString.match(/{([^}]+)}/);\n if (!objMatch) {\n return new InferenceTypeSchema(location, 'object');\n }\n\n const objContent = objMatch[1];\n const properties = objContent\n .split(';')\n .map((prop) => prop.trim())\n .filter(Boolean)\n .map((prop) => new InferenceTypeSchema(location, prop));\n\n return new ArrayLiteralExpressionSchema(properties, location);\n }\n\n /**\n * Create schema for Promise type, attempting to get type reference for the contained type\n */\n private async createPromiseSchema(node: Node, location: Location, innerType: string): Promise<SchemaNode> {\n const typeRef = await this.getTypeRef(innerType, this.getIdentifierKeyForNode(node), location);\n return typeRef || new InferenceTypeSchema(location, innerType);\n }\n\n // the reason for this check is to avoid infinite loop when calling `this.jump` with the same file+location\n private isDefInSameLocation(node: Node, definition: protocol.FileSpanWithContext) {\n if (definition.file !== node.getSourceFile().fileName) {\n return false;\n }\n const loc = this.getLocation(node);\n\n return loc.line === definition.start.line && loc.character === definition.start.offset;\n }\n\n /**\n * whether the definition span falls inside the node's own source span — i.e. the \"definition\"\n * tsserver found for the node is (part of) the node itself, so following it for type resolution\n * would only produce a self-reference (e.g. a function's name resolving to the function).\n */\n private isDefWithinNode(node: Node, definition: protocol.FileSpanWithContext) {\n if (definition.file !== node.getSourceFile().fileName) return false;\n const sourceFile = node.getSourceFile();\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n // protocol locations are 1-based; getLineAndCharacterOfPosition is 0-based.\n const afterStart =\n definition.start.line > start.line + 1 ||\n (definition.start.line === start.line + 1 && definition.start.offset >= start.character + 1);\n const beforeEnd =\n definition.end.line < end.line + 1 ||\n (definition.end.line === end.line + 1 && definition.end.offset <= end.character + 1);\n return afterStart && beforeEnd;\n }\n\n /**\n * resolve a type by a node and its identifier.\n */\n async resolveType(node: Node & { type?: TypeNode }, typeStr: string): Promise<SchemaNode> {\n const location = this.getLocation(node);\n\n // check if internal ref with typeInfo\n const internalRef = await this.getTypeRef(typeStr, this.getIdentifierKeyForNode(node), location);\n\n if (internalRef) return internalRef;\n\n // if a node has \"type\" prop, it has the type data of the node. this normally happens when the code has the type\n // explicitly, e.g. `const str: string` vs implicitly `const str = 'some-string'`, which the node won't have \"type\"\n if (node.type && ts.isTypeNode(node.type)) {\n return this.computeSchema(node.type);\n }\n\n // a keyword inferred type can never be a named definition — skip the definition hunt below,\n // which would resolve the DECLARATION's own name and mint a self-referential TypeRef. seen in\n // the wild when inference degrades (unresolved React types): a component fn `Checkbox` whose\n // quickinfo said `: any` got a returnType of `TypeRefSchema('Checkbox')` — i.e. \"returns itself\".\n if (KEYWORD_TYPE_STRINGS.has(typeStr)) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n const definition = await this.getDefinition(node);\n\n if (!definition) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n // same-location check catches the exact self-reference; the containment check catches the\n // common miss where the definition span starts at the declaration's NAME while getLocation()\n // points at the declaration start (e.g. after `export function `) — still a self-reference.\n if (this.isDefInSameLocation(node, definition) || this.isDefWithinNode(node, definition)) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n const definitionNode = await this.definition(definition);\n\n if (!definitionNode) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n const definitionNodeName = definitionNode?.getText();\n\n // check if internal ref with definition info\n const definitionInternalRef = await this.getTypeRef(\n definitionNodeName,\n this.getIdentifierKeyForNode(definitionNode),\n location\n );\n\n if (definitionInternalRef) return definitionInternalRef;\n\n const transformer = this.extractor.getTransformer(definitionNode, this);\n\n if (transformer === undefined) {\n const file = this.findFileInComponent(definition.file);\n if (!file) return this.getTypeRefForExternalPath(typeStr, definition.file, location);\n return this.unknownExactType(node, location, typeStr);\n }\n\n const schemaNode = await this.visit(definitionNode);\n\n if (!schemaNode) {\n return this.unknownExactType(node, location, typeStr);\n }\n\n const apiTransformer = this.extractor.getAPITransformer(schemaNode);\n let transformedApi = apiTransformer ? await apiTransformer.transform(schemaNode, this) : schemaNode;\n if (!transformedApi) {\n transformedApi = new IgnoredSchema(schemaNode);\n }\n return transformedApi;\n }\n\n private getCompIdByPkgName(pkgName: string): ComponentID | undefined {\n return this.componentDeps.find((dep) => dep.packageName === pkgName)?.componentId;\n }\n\n async getTypeRef(typeStr: string, filePath: string, location: Location): Promise<TypeRefSchema | undefined> {\n const nodeIdentifierKey = this.getIdentifierKey(filePath);\n const mainFileIdentifierKey = this.mainFileIdentifierKey;\n const nodeIdentifierList = this.identifiers.get(nodeIdentifierKey);\n const mainIdentifierList = this.identifiers.get(mainFileIdentifierKey);\n\n const nodeIdentifier = new Identifier(typeStr, nodeIdentifierKey);\n const mainIdentifier = new Identifier(typeStr, mainFileIdentifierKey);\n\n const parsedNodeIdentifier = nodeIdentifierList?.find(nodeIdentifier);\n\n const parsedMainIdentifier = mainIdentifierList?.find(mainIdentifier);\n const isExportedFromMain = parsedMainIdentifier && ExportIdentifier.isExportIdentifier(parsedMainIdentifier);\n\n if (!parsedNodeIdentifier) return undefined;\n\n if (!isExportedFromMain) {\n const src = parsedNodeIdentifier.sourceFilePath;\n const isLocalOrRelative = !src || isRelativeImport(src); // bare specifiers (e.g., 'react') are excluded\n if (isLocalOrRelative) {\n const key = src ? parsedNodeIdentifier.normalizedPath : parsedNodeIdentifier.filePath;\n this.setInternalIdentifiers(this.getIdentifierKey(key), new IdentifierList([parsedNodeIdentifier]));\n }\n }\n return this.resolveTypeRef(parsedNodeIdentifier, location, isExportedFromMain);\n }\n\n async resolveTypeRef(\n identifier: Identifier,\n location: Location,\n isExportedFromMain?: boolean\n ): Promise<TypeRefSchema> {\n const sourceFilePath = identifier.sourceFilePath;\n\n if (!sourceFilePath || (isExportedFromMain && isRelativeImport(sourceFilePath))) {\n return new TypeRefSchema(\n location,\n identifier.id,\n undefined,\n undefined,\n !isExportedFromMain ? this.getPathRelativeToComponent(identifier.filePath) : undefined,\n sourceFilePath\n );\n }\n\n if (!isRelativeImport(sourceFilePath)) {\n const pkgName = this.parsePackageNameFromPath(sourceFilePath);\n const compIdByPkg = this.getCompIdByPkgName(pkgName);\n\n const compIdByPath = await this.extractor.getComponentIDByPath(sourceFilePath);\n\n if (compIdByPath) {\n return new TypeRefSchema(location, identifier.id, compIdByPath);\n }\n\n if (compIdByPkg) {\n return new TypeRefSchema(location, identifier.id, compIdByPkg);\n }\n\n // package without comp id\n return new TypeRefSchema(location, identifier.id, undefined, pkgName);\n }\n\n const relativeDir = identifier.filePath.substring(0, identifier.filePath.lastIndexOf('/'));\n const absFilePath = resolve(this.componentRootPath, relativeDir, sourceFilePath);\n\n const compFilePath = this.findFileInComponent(absFilePath);\n if (!compFilePath) {\n // @todo handle this better\n throw new Error(\n `cannot find file in component \\n source file path ${sourceFilePath}\\n\n identifier file path ${identifier.filePath}\\nrelative dir ${relativeDir}\\n\n absFilePath ${absFilePath}`\n );\n }\n\n const idKey = this.getIdentifierKey(compFilePath?.path);\n\n // if re exported from a file, recurse until definition\n const exportedIdentifier = (this.identifiers.get(idKey)?.identifiers || []).find((i) => i.id === identifier.id);\n\n if (exportedIdentifier) {\n return this.resolveTypeRef(exportedIdentifier, location, isExportedFromMain);\n }\n\n return new TypeRefSchema(location, identifier.id, undefined, undefined, undefined);\n }\n\n async getTypeRefForExternalNode(node: Node): Promise<TypeRefSchema> {\n const info = await this.getQuickInfo(node);\n const typeStr = parseTypeFromQuickInfo(info);\n const location = this.getLocation(node);\n const filePath = this.getPath(node);\n return this.getTypeRefForExternalPath(typeStr, filePath, location);\n }\n\n async getTypeRefForExternalPath(typeStr: string, filePath: string, location: Location): Promise<TypeRefSchema> {\n const compIdByPath = await this.extractor.getComponentIDByPath(filePath);\n if (compIdByPath) {\n return new TypeRefSchema(location, typeStr, compIdByPath);\n }\n const pkgName = this.parsePackageNameFromPath(filePath);\n const compIdByPkg = this.getCompIdByPkgName(pkgName);\n if (compIdByPkg) {\n return new TypeRefSchema(location, typeStr, compIdByPkg);\n }\n return new TypeRefSchema(location, typeStr, undefined, pkgName);\n }\n\n buildTopLevelNameIndex(sf: ts.SourceFile): Map<string, ts.Node> {\n const map = new Map<string, ts.Node>();\n for (const s of sf.statements) {\n const name =\n 'name' in s && s.name && ts.isIdentifier((s as any).name)\n ? ((s as any).name as ts.Identifier).text\n : ts.isVariableStatement(s) &&\n s.declarationList.declarations.length === 1 &&\n ts.isIdentifier(s.declarationList.declarations[0].name)\n ? s.declarationList.declarations[0].name.text\n : undefined;\n\n if (name && !map.has(name)) map.set(name, s);\n }\n return map;\n }\n\n // inside TypeScriptExtractor\n /**\n * Walk a SchemaNode tree and collect all TypeRefSchema names that\n * have an internalFilePath.\n *\n * We intentionally do NOT try to match the identifierKey here –\n * we already scope lookups by `nameIndex` for the current file,\n * so cross-file refs will just fail `nameIndex.get(name)` and be ignored.\n *\n * This lets us correctly close over cases like:\n * type MyFirstCombinedProps = MyFirstProps & MyFirstPropsExtra;\n * where `MyFirstPropsExtra` is internal to the same file.\n */\n collectSameFileInternalTypeRefs(root: SchemaNode): string[] {\n const result = new Set<string>();\n const stack: SchemaNode[] = [root];\n\n while (stack.length) {\n const node = stack.pop();\n if (!node || typeof node !== 'object') continue;\n\n if (TypeRefSchema.isTypeRefSchema(node) && typeof node.name === 'string' && node.internalFilePath) {\n result.add(node.name);\n }\n\n for (const value of Object.values(node)) {\n if (!value) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n if (v && typeof v === 'object') stack.push(v as SchemaNode);\n }\n } else if (typeof value === 'object') {\n stack.push(value as SchemaNode);\n }\n }\n }\n\n return Array.from(result);\n }\n\n async jsDocToDocSchema(node: Node): Promise<DocSchema | undefined> {\n if (!canHaveJsDoc(node)) {\n return undefined;\n }\n const jsDocs = getJsDoc(node);\n\n if (!jsDocs.length) {\n return undefined;\n }\n // not sure how common it is to have multiple JSDocs. never seen it before.\n // regardless, in typescript implementation of methods like `getJSDocDeprecatedTag()`, they use the first one. (`getFirstJSDocTag()`)\n const jsDoc = jsDocs[0];\n\n const location = this.getLocation(jsDoc);\n // Extract link comments and filter them out from the main comment\n const linkComments = (\n typeof jsDoc.comment !== 'string' ? (jsDoc.comment?.filter((c) => c.kind === ts.SyntaxKind.JSDocLink) ?? []) : []\n ) as ts.JSDocLink[];\n const linkTags = linkComments.map((linkComment) => {\n const tagName = 'link';\n const tagText = `${linkComment.name?.getText() ?? ''}${linkComment.text ?? ''}`;\n const tagLocation = this.getLocation(linkComment);\n return new TagSchema(tagLocation, tagName, tagText);\n });\n\n const commentsWithoutLink = (typeof jsDoc.comment !== 'string'\n ? (jsDoc.comment?.filter((c) => c.kind !== ts.SyntaxKind.JSDocLink) ?? '')\n : jsDoc.comment) as unknown as ts.NodeArray<ts.JSDocComment>;\n\n const comment = getTextOfJSDocComment(commentsWithoutLink);\n\n const tags = (jsDoc.tags ? await pMapSeries(jsDoc.tags, (tag) => tagParser(tag, this, this.formatter)) : []).concat(\n linkTags\n );\n\n return new DocSchema(location, jsDoc.getText(), comment, tags);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;I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AW,CAACxB,IAAI,IAAI,EAAE,EAAE;MAC/E,MAAM2B,WAAW,GAAG,IAAI,CAACjP,WAAW,CAAC8O,WAAW,CAAC;MACjD,OAAO,KAAII,8BAAS,EAACD,WAAW,EAAEF,OAAO,EAAEC,OAAO,CAAC;IACrD,CAAC,CAAC;IAEF,MAAMG,mBAAmB,GAAI,OAAOX,KAAK,CAACE,OAAO,KAAK,QAAQ,GACzDF,KAAK,CAACE,OAAO,EAAE5O,MAAM,CAAE6O,CAAC,IAAKA,CAAC,CAACzO,IAAI,KAAKqK,qBAAE,CAACtK,UAAU,CAAC2O,SAAS,CAAC,IAAI,EAAE,GACvEJ,KAAK,CAACE,OAAoD;IAE9D,MAAMA,OAAO,GAAG,IAAAU,mCAAqB,EAACD,mBAAmB,CAAC;IAE1D,MAAME,IAAI,GAAG,CAACb,KAAK,CAACa,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAACd,KAAK,CAACa,IAAI,EAAGE,GAAG,IAAK,IAAAC,6BAAS,EAACD,GAAG,EAAE,IAAI,EAAE,IAAI,CAACvR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAEoB,MAAM,CACjHyP,QACF,CAAC;IAED,OAAO,KAAIY,8BAAS,EAAC7Q,QAAQ,EAAE4P,KAAK,CAACtI,OAAO,CAAC,CAAC,EAAEwI,OAAO,EAAEW,IAAI,CAAC;EAChE;AACF;AAACK,OAAA,CAAA/S,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -41,12 +41,17 @@ class ExportAssignmentTransformer {
|
|
|
41
41
|
const location = context.getLocation(exportDec);
|
|
42
42
|
const absoluteFilePath = exportDec.getSourceFile().fileName;
|
|
43
43
|
const exportNode = await context.getTypeRef(specifier.getText(), absoluteFilePath, location);
|
|
44
|
+
|
|
45
|
+
// The export is literally named `default` in TS (`export { Foo as default }`). Use that as the
|
|
46
|
+
// schema's stable name/alias — the target symbol is preserved on the wrapped `TypeRefSchema.name`.
|
|
47
|
+
// Baking a `"Foo (default)"` label into the name instead produced an invalid signature
|
|
48
|
+
// (`export { Foo as Foo (default) }`) and an unstable diff key that flip-flopped with the
|
|
49
|
+
// extractor's fallback representation across builds (surfacing as a phantom "added" export).
|
|
44
50
|
if (exportNode) {
|
|
45
|
-
return new (_semanticsEntities().ExportSchema)(location,
|
|
51
|
+
return new (_semanticsEntities().ExportSchema)(location, 'default', new (_semanticsEntities().TypeRefSchema)(exportNode.location, exportNode.name, exportNode.componentId, exportNode.packageName, exportNode.internalFilePath), 'default');
|
|
46
52
|
}
|
|
47
53
|
const schemaNode = await context.computeSchema(specifier);
|
|
48
|
-
|
|
49
|
-
return new (_semanticsEntities().ExportSchema)(location, nodeName, schemaNode, nodeName);
|
|
54
|
+
return new (_semanticsEntities().ExportSchema)(location, 'default', schemaNode, 'default');
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
exports.ExportAssignmentTransformer = ExportAssignmentTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_semanticsEntities","data","require","_typescript","_exportIdentifier","ExportAssignmentTransformer","predicate","node","kind","SyntaxKind","ExportAssignment","getIdentifiers","exportDec","ExportIdentifier","getSourceFile","fileName","transform","context","specifier","expression","location","getLocation","absoluteFilePath","exportNode","getTypeRef","getText","ExportSchema","
|
|
1
|
+
{"version":3,"names":["_semanticsEntities","data","require","_typescript","_exportIdentifier","ExportAssignmentTransformer","predicate","node","kind","SyntaxKind","ExportAssignment","getIdentifiers","exportDec","ExportIdentifier","getSourceFile","fileName","transform","context","specifier","expression","location","getLocation","absoluteFilePath","exportNode","getTypeRef","getText","ExportSchema","TypeRefSchema","name","componentId","packageName","internalFilePath","schemaNode","computeSchema","exports"],"sources":["export-assignment.ts"],"sourcesContent":["import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';\nimport { ExportSchema, TypeRefSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { Node, ExportAssignment as ExportAssignmentNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport { ExportIdentifier } from '../export-identifier';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { SchemaTransformer } from '../schema-transformer';\n\n/**\n * This is either an export = or an export default declaration.\n * Unless isExportEquals is set, this node was parsed as an export default\n */\nexport class ExportAssignmentTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ExportAssignment;\n }\n\n async getIdentifiers(exportDec: ExportAssignmentNode) {\n return [new ExportIdentifier('default', exportDec.getSourceFile().fileName)];\n }\n\n async transform(exportDec: ExportAssignmentNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const specifier = exportDec.expression;\n const location = context.getLocation(exportDec);\n const absoluteFilePath = exportDec.getSourceFile().fileName;\n\n const exportNode = await context.getTypeRef(specifier.getText(), absoluteFilePath, location);\n\n // The export is literally named `default` in TS (`export { Foo as default }`). Use that as the\n // schema's stable name/alias — the target symbol is preserved on the wrapped `TypeRefSchema.name`.\n // Baking a `\"Foo (default)\"` label into the name instead produced an invalid signature\n // (`export { Foo as Foo (default) }`) and an unstable diff key that flip-flopped with the\n // extractor's fallback representation across builds (surfacing as a phantom \"added\" export).\n if (exportNode) {\n return new ExportSchema(\n location,\n 'default',\n new TypeRefSchema(\n exportNode.location,\n exportNode.name,\n exportNode.componentId,\n exportNode.packageName,\n exportNode.internalFilePath\n ),\n 'default'\n );\n }\n\n const schemaNode = await context.computeSchema(specifier);\n return new ExportSchema(location, 'default', schemaNode, 'default');\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,kBAAA;EAAA,MAAAH,IAAA,GAAAC,O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List":[]}
|
|
@@ -6,5 +6,5 @@ import type { Identifier } from '../identifier';
|
|
|
6
6
|
export declare class IndexSignatureTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
9
|
-
transform(node: IndexSignatureDeclaration, context: SchemaExtractorContext): Promise<
|
|
9
|
+
transform(node: IndexSignatureDeclaration, context: SchemaExtractorContext): Promise<IndexSignatureSchema | UnresolvedSchema>;
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/typescript",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1081",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/typescript/typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.typescript",
|
|
8
8
|
"name": "typescript",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1081"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -16,28 +16,28 @@
|
|
|
16
16
|
"get-tsconfig": "4.2.0",
|
|
17
17
|
"minimatch": "3.0.5",
|
|
18
18
|
"fs-extra": "10.0.0",
|
|
19
|
-
"@teambit/legacy.utils": "0.0.45",
|
|
20
|
-
"@teambit/typescript.modules.ts-config-mutator": "0.0.94",
|
|
21
19
|
"@teambit/typescript.typescript-compiler": "5.0.1",
|
|
22
|
-
"@teambit/component.sources": "0.0.192",
|
|
23
|
-
"@teambit/semantics.entities.semantic-schema": "0.0.110",
|
|
24
|
-
"@teambit/ts-server": "0.0.87",
|
|
25
20
|
"@teambit/harmony": "0.4.12",
|
|
26
|
-
"@teambit/
|
|
27
|
-
"@teambit/
|
|
28
|
-
"@teambit/
|
|
29
|
-
"@teambit/
|
|
30
|
-
"@teambit/
|
|
31
|
-
"@teambit/component": "1.0.
|
|
32
|
-
"@teambit/dependency-resolver": "1.0.
|
|
33
|
-
"@teambit/formatter": "1.0.
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/
|
|
36
|
-
"@teambit/
|
|
37
|
-
"@teambit/
|
|
38
|
-
"@teambit/
|
|
39
|
-
"@teambit/
|
|
40
|
-
"@teambit/
|
|
21
|
+
"@teambit/compiler": "1.0.1081",
|
|
22
|
+
"@teambit/legacy.utils": "0.0.46",
|
|
23
|
+
"@teambit/typescript.modules.ts-config-mutator": "0.0.95",
|
|
24
|
+
"@teambit/builder": "1.0.1081",
|
|
25
|
+
"@teambit/component.sources": "0.0.193",
|
|
26
|
+
"@teambit/component": "1.0.1081",
|
|
27
|
+
"@teambit/dependency-resolver": "1.0.1081",
|
|
28
|
+
"@teambit/formatter": "1.0.1081",
|
|
29
|
+
"@teambit/semantics.entities.semantic-schema": "0.0.111",
|
|
30
|
+
"@teambit/ts-server": "0.0.88",
|
|
31
|
+
"@teambit/aspect-loader": "1.0.1081",
|
|
32
|
+
"@teambit/envs": "1.0.1081",
|
|
33
|
+
"@teambit/logger": "0.0.1451",
|
|
34
|
+
"@teambit/schema": "1.0.1081",
|
|
35
|
+
"@teambit/scope": "1.0.1081",
|
|
36
|
+
"@teambit/workspace": "1.0.1081",
|
|
37
|
+
"@teambit/cli": "0.0.1358",
|
|
38
|
+
"@teambit/pkg": "1.0.1081",
|
|
39
|
+
"@teambit/watcher": "1.0.1081",
|
|
40
|
+
"@teambit/legacy.constants": "0.0.38"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/lodash": "4.14.165",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@types/fs-extra": "9.0.7",
|
|
46
46
|
"@types/mocha": "9.1.0",
|
|
47
47
|
"@teambit/typescript.aspect-docs.typescript": "0.0.180",
|
|
48
|
-
"@teambit/harmony.envs.core-aspect-env": "2.0.
|
|
48
|
+
"@teambit/harmony.envs.core-aspect-env": "2.0.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
@@ -26,10 +26,15 @@ export class ExportAssignmentTransformer implements SchemaTransformer {
|
|
|
26
26
|
|
|
27
27
|
const exportNode = await context.getTypeRef(specifier.getText(), absoluteFilePath, location);
|
|
28
28
|
|
|
29
|
+
// The export is literally named `default` in TS (`export { Foo as default }`). Use that as the
|
|
30
|
+
// schema's stable name/alias — the target symbol is preserved on the wrapped `TypeRefSchema.name`.
|
|
31
|
+
// Baking a `"Foo (default)"` label into the name instead produced an invalid signature
|
|
32
|
+
// (`export { Foo as Foo (default) }`) and an unstable diff key that flip-flopped with the
|
|
33
|
+
// extractor's fallback representation across builds (surfacing as a phantom "added" export).
|
|
29
34
|
if (exportNode) {
|
|
30
35
|
return new ExportSchema(
|
|
31
36
|
location,
|
|
32
|
-
|
|
37
|
+
'default',
|
|
33
38
|
new TypeRefSchema(
|
|
34
39
|
exportNode.location,
|
|
35
40
|
exportNode.name,
|
|
@@ -37,12 +42,11 @@ export class ExportAssignmentTransformer implements SchemaTransformer {
|
|
|
37
42
|
exportNode.packageName,
|
|
38
43
|
exportNode.internalFilePath
|
|
39
44
|
),
|
|
40
|
-
|
|
45
|
+
'default'
|
|
41
46
|
);
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
const schemaNode = await context.computeSchema(specifier);
|
|
45
|
-
|
|
46
|
-
return new ExportSchema(location, nodeName, schemaNode, nodeName);
|
|
50
|
+
return new ExportSchema(location, 'default', schemaNode, 'default');
|
|
47
51
|
}
|
|
48
52
|
}
|