@teambit/typescript 0.0.963 → 0.0.965

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.
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.963/dist/typescript.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.963/dist/typescript.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.965/dist/typescript.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.965/dist/typescript.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -178,13 +178,14 @@ class SchemaExtractorContext {
178
178
  visitTypeDefinition() {}
179
179
  findFileInComponent(filePath) {
180
180
  return this.component.filesystem.files.find(file => {
181
+ const currentFilePath = file.path.replaceAll(/\\/g, '/');
181
182
  // TODO: fix this line to support further extensions.
182
- if (file.path.includes(filePath)) {
183
+ if (currentFilePath.includes(filePath)) {
183
184
  const strings = ['ts', 'tsx', 'js', 'jsx'].map(format => {
184
185
  if (filePath.endsWith(format)) return filePath;
185
186
  return `${filePath}.${format}`;
186
187
  });
187
- return strings.find(string => string === file.path);
188
+ return strings.find(string => string === currentFilePath);
188
189
  }
189
190
  return false;
190
191
  });
@@ -1 +1 @@
1
- {"version":3,"names":["SchemaExtractorContext","constructor","tsserver","component","extractor","componentDeps","formatter","undefined","computeSchema","node","getLocation","targetSourceFile","absolutePath","sourceFile","getSourceFile","position","getLineAndCharacterOfPosition","getStart","line","character","filePath","fileName","getPathRelativeToComponent","pathNormalizeToLinux","getLocationAsString","location","basePath","filesystem","files","base","relative","getSignature","getSignatureHelp","getPath","getPosition","offset","getPositionOfLineAndCharacter","getQuickInfo","err","message","Error","getQuickInfoDisplayString","quickInfo","body","displayString","typeDefinition","getTypeDefinition","visitTypeDefinition","findFileInComponent","find","file","path","includes","strings","map","format","endsWith","string","parsePackageNameFromPath","parts","split","length","lastPart","replace","sep","pkgParts","startsWith","pkgName","getSourceFileInsideComponent","parseSourceFile","getSourceFileFromNode","getFilePathByNode","def","getDefinition","firstDef","head","definitionInfo","definition","startPosition","start","pos","nodeAtPos","getTokenAtPosition","visitDefinition","getTypeRefForExternalNode","visit","parent","references","isExported","isFromComponent","getFileExports","exportDec","specifierPathStr","kind","SyntaxKind","ExportDeclaration","moduleSpecifier","getText","specifierPath","substring","absPath","resolve","computeExportedIdentifiers","setExports","exports","_exports","getExportedIdentifiers","jump","TransformerNotFound","resolveType","typeStr","isTypeStrFromQuickInfo","TypeRefSchema","type","ts","isTypeNode","typeNodeToSchema","getDef","headTypeDefinition","unknownExactType","InferenceTypeSchema","info","parseTypeFromQuickInfo","isDefInSameLocation","loc","schemaNode","getTypeRefForExternalPath","getCompIdByPkgName","dep","packageName","componentId","compIdByPath","getComponentIDByPath","compIdByPkg","jsDocToDocSchema","canHaveJsDoc","jsDocs","getJsDoc","jsDoc","comment","getTextOfJSDocComment","tags","pMapSeries","tag","tagParser","DocSchema"],"sources":["schema-extractor-context.ts"],"sourcesContent":["import { TsserverClient } from '@teambit/ts-server';\nimport { getTokenAtPosition, canHaveJsDoc, getJsDoc } from 'tsutils';\nimport ts, { ExportAssignment, getTextOfJSDocComment, ExportDeclaration, Node, SyntaxKind, TypeNode } from 'typescript';\nimport { head } from 'lodash';\n// eslint-disable-next-line import/no-unresolved\nimport protocol from 'typescript/lib/protocol';\n// @ts-ignore david we should figure fix this.\nimport type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { resolve, sep, relative } from 'path';\nimport { Component, ComponentID } from '@teambit/component';\nimport {\n TypeRefSchema,\n SchemaNode,\n InferenceTypeSchema,\n Location,\n DocSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { ComponentDependency } from '@teambit/dependency-resolver';\nimport { Formatter } from '@teambit/formatter';\nimport pMapSeries from 'p-map-series';\nimport { TypeScriptExtractor } from './typescript.extractor';\nimport { ExportList } from './export-list';\nimport { typeNodeToSchema } from './transformers/utils/type-node-to-schema';\nimport { TransformerNotFound } from './exceptions';\nimport { parseTypeFromQuickInfo } from './transformers/utils/parse-type-from-quick-info';\nimport { tagParser } from './transformers/utils/jsdoc-to-doc-schema';\n\nexport class SchemaExtractorContext {\n constructor(\n readonly tsserver: TsserverClient,\n readonly component: Component,\n readonly extractor: TypeScriptExtractor,\n readonly componentDeps: ComponentDependency[],\n readonly formatter?: Formatter\n ) {}\n\n computeSchema(node: Node) {\n return this.extractor.computeSchema(node, 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 position = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const line = position.line + 1;\n const character = position.character + 1;\n const filePath = absolutePath ? sourceFile.fileName : this.getPathRelativeToComponent(sourceFile.fileName);\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 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 findFileInComponent(filePath: string) {\n return this.component.filesystem.files.find((file) => {\n // TODO: fix this line to support further extensions.\n if (file.path.includes(filePath)) {\n const strings = ['ts', 'tsx', 'js', 'jsx'].map((format) => {\n if (filePath.endsWith(format)) return filePath;\n return `${filePath}.${format}`;\n });\n\n return strings.find((string) => string === file.path);\n }\n\n return false;\n });\n }\n\n private parsePackageNameFromPath(path: string) {\n const parts = path.split('node_modules');\n if (parts.length === 1) return '';\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 if (!file) return undefined;\n return 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\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 return this.extractor.computeSchema(node, this);\n }\n\n references() {}\n\n isExported() {}\n\n isFromComponent() {}\n\n async getFileExports(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.extractor.computeExportedIdentifiers(sourceFile, this);\n }\n\n _exports: ExportList | undefined = undefined;\n\n setExports(exports: ExportList) {\n this._exports = exports;\n return this;\n }\n\n getExportedIdentifiers(node: Node) {\n return this.extractor.computeExportedIdentifiers(node, this);\n }\n\n async jump(file: AbstractVinyl, start: any): Promise<SchemaNode | undefined> {\n const sourceFile = this.extractor.parseSourceFile(file);\n const pos = this.getPosition(sourceFile, start.line, start.offset);\n const nodeAtPos = getTokenAtPosition(sourceFile, pos);\n if (!nodeAtPos) return undefined;\n\n // this causes some infinite loops. it's helpful for getting more data from types that are not exported.\n // e.g.\n // ```ts\n // class Bar {}\n // export const getBar = () => new Bar();\n // ```\n // if (nodeAtPos.kind === ts.SyntaxKind.Identifier) {\n // // @todo: make sure with Ran that it's fine. Maybe it's better to do: `this.visit(nodeAtPos.parent);`\n // return this.visitDefinition(nodeAtPos);\n // }\n try {\n return await this.visit(nodeAtPos);\n } catch (err) {\n if (err instanceof TransformerNotFound) {\n return undefined;\n }\n throw err;\n }\n }\n\n /**\n * resolve a type by a node and its identifier.\n */\n async resolveType(\n node: Node & { type?: TypeNode },\n typeStr: string,\n isTypeStrFromQuickInfo = true\n ): Promise<SchemaNode> {\n const location = this.getLocation(node);\n if (this._exports?.includes(typeStr)) {\n return new TypeRefSchema(location, typeStr);\n }\n if (node.type && ts.isTypeNode(node.type)) {\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 return typeNodeToSchema(node.type, this);\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 const getDef = async () => {\n const typeDefinition = await this.typeDefinition(node);\n const headTypeDefinition = head(typeDefinition?.body);\n if (headTypeDefinition) {\n return headTypeDefinition;\n }\n const definition = await this.tsserver.getDefinition(node.getSourceFile().fileName, this.getLocation(node));\n return head(definition?.body);\n };\n const definition = await getDef();\n\n // when we can't figure out the component/package/type of this node, we'll use the typeStr as the type.\n const unknownExactType = async () => {\n if (isTypeStrFromQuickInfo) {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n const info = await this.getQuickInfo(node);\n const type = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(location, type, typeStr);\n };\n if (!definition) {\n return unknownExactType();\n }\n\n // the reason for this check is to avoid infinite loop when calling `this.jump` with the same file+location\n const isDefInSameLocation = () => {\n if (definition.file !== node.getSourceFile().fileName) {\n return false;\n }\n const loc = this.getLocation(node);\n return loc.line === definition.start.line && loc.character === definition.start.offset;\n };\n\n const file = this.findFileInComponent(definition.file);\n if (file) {\n if (isDefInSameLocation()) {\n return unknownExactType();\n }\n const schemaNode = await this.jump(file, definition.start);\n return schemaNode || unknownExactType();\n }\n return this.getTypeRefForExternalPath(typeStr, definition.file, location);\n }\n\n private getCompIdByPkgName(pkgName: string): ComponentID | undefined {\n return this.componentDeps.find((dep) => dep.packageName === pkgName)?.componentId;\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 async jsDocToDocSchema(node: Node): Promise<DocSchema | undefined> {\n if (!canHaveJsDoc(node)) {\n return undefined;\n }\n const jsDocs = getJsDoc(node);\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 const location = this.getLocation(jsDoc);\n const comment = getTextOfJSDocComment(jsDoc.comment);\n const tags = jsDoc.tags ? await pMapSeries(jsDoc.tags, (tag) => tagParser(tag, this, this.formatter)) : undefined;\n return new DocSchema(location, jsDoc.getText(), comment, tags);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AASA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAqE;AAAA;AAE9D,MAAMA,sBAAsB,CAAC;EAClCC,WAAW,CACAC,QAAwB,EACxBC,SAAoB,EACpBC,SAA8B,EAC9BC,aAAoC,EACpCC,SAAqB,EAC9B;IAAA,KALSJ,QAAwB,GAAxBA,QAAwB;IAAA,KACxBC,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,SAA8B,GAA9BA,SAA8B;IAAA,KAC9BC,aAAoC,GAApCA,aAAoC;IAAA,KACpCC,SAAqB,GAArBA,SAAqB;IAAA,kDAgNGC,SAAS;EA/MzC;EAEHC,aAAa,CAACC,IAAU,EAAE;IACxB,OAAO,IAAI,CAACL,SAAS,CAACI,aAAa,CAACC,IAAI,EAAE,IAAI,CAAC;EACjD;;EAEA;AACF;AACA;EAC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E;MACvB,OAAOF,SAAS;IAClB;IACA,MAAMiI,MAAM,GAAG,IAAAC,mBAAQ,EAAChI,IAAI,CAAC;IAC7B,IAAI,CAAC+H,MAAM,CAAC3E,MAAM,EAAE;MAClB,OAAOtD,SAAS;IAClB;IACA;IACA;IACA,MAAMmI,KAAK,GAAGF,MAAM,CAAC,CAAC,CAAC;IACvB,MAAM/G,QAAQ,GAAG,IAAI,CAACf,WAAW,CAACgI,KAAK,CAAC;IACxC,MAAMC,OAAO,GAAG,IAAAC,mCAAqB,EAACF,KAAK,CAACC,OAAO,CAAC;IACpD,MAAME,IAAI,GAAGH,KAAK,CAACG,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAACJ,KAAK,CAACG,IAAI,EAAGE,GAAG,IAAK,IAAAC,6BAAS,EAACD,GAAG,EAAE,IAAI,EAAE,IAAI,CAACzI,SAAS,CAAC,CAAC,GAAGC,SAAS;IACjH,OAAO,KAAI0I,8BAAS,EAACxH,QAAQ,EAAEiH,KAAK,CAACzC,OAAO,EAAE,EAAE0C,OAAO,EAAEE,IAAI,CAAC;EAChE;AACF;AAAC"}
1
+ {"version":3,"names":["SchemaExtractorContext","constructor","tsserver","component","extractor","componentDeps","formatter","undefined","computeSchema","node","getLocation","targetSourceFile","absolutePath","sourceFile","getSourceFile","position","getLineAndCharacterOfPosition","getStart","line","character","filePath","fileName","getPathRelativeToComponent","pathNormalizeToLinux","getLocationAsString","location","basePath","filesystem","files","base","relative","getSignature","getSignatureHelp","getPath","getPosition","offset","getPositionOfLineAndCharacter","getQuickInfo","err","message","Error","getQuickInfoDisplayString","quickInfo","body","displayString","typeDefinition","getTypeDefinition","visitTypeDefinition","findFileInComponent","find","file","currentFilePath","path","replaceAll","includes","strings","map","format","endsWith","string","parsePackageNameFromPath","parts","split","length","lastPart","replace","sep","pkgParts","startsWith","pkgName","getSourceFileInsideComponent","parseSourceFile","getSourceFileFromNode","getFilePathByNode","def","getDefinition","firstDef","head","definitionInfo","definition","startPosition","start","pos","nodeAtPos","getTokenAtPosition","visitDefinition","getTypeRefForExternalNode","visit","parent","references","isExported","isFromComponent","getFileExports","exportDec","specifierPathStr","kind","SyntaxKind","ExportDeclaration","moduleSpecifier","getText","specifierPath","substring","absPath","resolve","computeExportedIdentifiers","setExports","exports","_exports","getExportedIdentifiers","jump","TransformerNotFound","resolveType","typeStr","isTypeStrFromQuickInfo","TypeRefSchema","type","ts","isTypeNode","typeNodeToSchema","getDef","headTypeDefinition","unknownExactType","InferenceTypeSchema","info","parseTypeFromQuickInfo","isDefInSameLocation","loc","schemaNode","getTypeRefForExternalPath","getCompIdByPkgName","dep","packageName","componentId","compIdByPath","getComponentIDByPath","compIdByPkg","jsDocToDocSchema","canHaveJsDoc","jsDocs","getJsDoc","jsDoc","comment","getTextOfJSDocComment","tags","pMapSeries","tag","tagParser","DocSchema"],"sources":["schema-extractor-context.ts"],"sourcesContent":["import { TsserverClient } from '@teambit/ts-server';\nimport { getTokenAtPosition, canHaveJsDoc, getJsDoc } from 'tsutils';\nimport ts, { ExportAssignment, getTextOfJSDocComment, ExportDeclaration, Node, SyntaxKind, TypeNode } from 'typescript';\nimport { head } from 'lodash';\n// eslint-disable-next-line import/no-unresolved\nimport protocol from 'typescript/lib/protocol';\n// @ts-ignore david we should figure fix this.\nimport type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { resolve, sep, relative } from 'path';\nimport { Component, ComponentID } from '@teambit/component';\nimport {\n TypeRefSchema,\n SchemaNode,\n InferenceTypeSchema,\n Location,\n DocSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { ComponentDependency } from '@teambit/dependency-resolver';\nimport { Formatter } from '@teambit/formatter';\nimport pMapSeries from 'p-map-series';\nimport { TypeScriptExtractor } from './typescript.extractor';\nimport { ExportList } from './export-list';\nimport { typeNodeToSchema } from './transformers/utils/type-node-to-schema';\nimport { TransformerNotFound } from './exceptions';\nimport { parseTypeFromQuickInfo } from './transformers/utils/parse-type-from-quick-info';\nimport { tagParser } from './transformers/utils/jsdoc-to-doc-schema';\n\nexport class SchemaExtractorContext {\n constructor(\n readonly tsserver: TsserverClient,\n readonly component: Component,\n readonly extractor: TypeScriptExtractor,\n readonly componentDeps: ComponentDependency[],\n readonly formatter?: Formatter\n ) {}\n\n computeSchema(node: Node) {\n return this.extractor.computeSchema(node, 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 position = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const line = position.line + 1;\n const character = position.character + 1;\n const filePath = absolutePath ? sourceFile.fileName : this.getPathRelativeToComponent(sourceFile.fileName);\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 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 findFileInComponent(filePath: string) {\n return this.component.filesystem.files.find((file) => {\n const currentFilePath = file.path.replaceAll(/\\\\/g, '/');\n // TODO: fix this line to support further extensions.\n if (currentFilePath.includes(filePath)) {\n const strings = ['ts', 'tsx', 'js', 'jsx'].map((format) => {\n if (filePath.endsWith(format)) return filePath;\n return `${filePath}.${format}`;\n });\n return strings.find((string) => string === currentFilePath);\n }\n\n return false;\n });\n }\n\n private parsePackageNameFromPath(path: string) {\n const parts = path.split('node_modules');\n if (parts.length === 1) return '';\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 if (!file) return undefined;\n return 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\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 return this.extractor.computeSchema(node, this);\n }\n\n references() {}\n\n isExported() {}\n\n isFromComponent() {}\n\n async getFileExports(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.extractor.computeExportedIdentifiers(sourceFile, this);\n }\n\n _exports: ExportList | undefined = undefined;\n\n setExports(exports: ExportList) {\n this._exports = exports;\n return this;\n }\n\n getExportedIdentifiers(node: Node) {\n return this.extractor.computeExportedIdentifiers(node, this);\n }\n\n async jump(file: AbstractVinyl, start: any): Promise<SchemaNode | undefined> {\n const sourceFile = this.extractor.parseSourceFile(file);\n const pos = this.getPosition(sourceFile, start.line, start.offset);\n const nodeAtPos = getTokenAtPosition(sourceFile, pos);\n if (!nodeAtPos) return undefined;\n\n // this causes some infinite loops. it's helpful for getting more data from types that are not exported.\n // e.g.\n // ```ts\n // class Bar {}\n // export const getBar = () => new Bar();\n // ```\n // if (nodeAtPos.kind === ts.SyntaxKind.Identifier) {\n // // @todo: make sure with Ran that it's fine. Maybe it's better to do: `this.visit(nodeAtPos.parent);`\n // return this.visitDefinition(nodeAtPos);\n // }\n try {\n return await this.visit(nodeAtPos);\n } catch (err) {\n if (err instanceof TransformerNotFound) {\n return undefined;\n }\n throw err;\n }\n }\n\n /**\n * resolve a type by a node and its identifier.\n */\n async resolveType(\n node: Node & { type?: TypeNode },\n typeStr: string,\n isTypeStrFromQuickInfo = true\n ): Promise<SchemaNode> {\n const location = this.getLocation(node);\n if (this._exports?.includes(typeStr)) {\n return new TypeRefSchema(location, typeStr);\n }\n if (node.type && ts.isTypeNode(node.type)) {\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 return typeNodeToSchema(node.type, this);\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 const getDef = async () => {\n const typeDefinition = await this.typeDefinition(node);\n const headTypeDefinition = head(typeDefinition?.body);\n if (headTypeDefinition) {\n return headTypeDefinition;\n }\n const definition = await this.tsserver.getDefinition(node.getSourceFile().fileName, this.getLocation(node));\n return head(definition?.body);\n };\n const definition = await getDef();\n\n // when we can't figure out the component/package/type of this node, we'll use the typeStr as the type.\n const unknownExactType = async () => {\n if (isTypeStrFromQuickInfo) {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n const info = await this.getQuickInfo(node);\n const type = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(location, type, typeStr);\n };\n if (!definition) {\n return unknownExactType();\n }\n\n // the reason for this check is to avoid infinite loop when calling `this.jump` with the same file+location\n const isDefInSameLocation = () => {\n if (definition.file !== node.getSourceFile().fileName) {\n return false;\n }\n const loc = this.getLocation(node);\n return loc.line === definition.start.line && loc.character === definition.start.offset;\n };\n\n const file = this.findFileInComponent(definition.file);\n if (file) {\n if (isDefInSameLocation()) {\n return unknownExactType();\n }\n const schemaNode = await this.jump(file, definition.start);\n return schemaNode || unknownExactType();\n }\n return this.getTypeRefForExternalPath(typeStr, definition.file, location);\n }\n\n private getCompIdByPkgName(pkgName: string): ComponentID | undefined {\n return this.componentDeps.find((dep) => dep.packageName === pkgName)?.componentId;\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 async jsDocToDocSchema(node: Node): Promise<DocSchema | undefined> {\n if (!canHaveJsDoc(node)) {\n return undefined;\n }\n const jsDocs = getJsDoc(node);\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 const location = this.getLocation(jsDoc);\n const comment = getTextOfJSDocComment(jsDoc.comment);\n const tags = jsDoc.tags ? await pMapSeries(jsDoc.tags, (tag) => tagParser(tag, this, this.formatter)) : undefined;\n return new DocSchema(location, jsDoc.getText(), comment, tags);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;EAAA;EAA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AW,CAACkI,KAAK,CAAC;IACxC,MAAMC,OAAO,GAAG,IAAAC,mCAAqB,EAACF,KAAK,CAACC,OAAO,CAAC;IACpD,MAAME,IAAI,GAAGH,KAAK,CAACG,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAACJ,KAAK,CAACG,IAAI,EAAGE,GAAG,IAAK,IAAAC,6BAAS,EAACD,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC3I,SAAS,CAAC,CAAC,GAAGC,SAAS;IACjH,OAAO,KAAI4I,8BAAS,EAAC1H,QAAQ,EAAEmH,KAAK,CAACzC,OAAO,EAAE,EAAE0C,OAAO,EAAEE,IAAI,CAAC;EAChE;AACF;AAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/typescript",
3
- "version": "0.0.963",
3
+ "version": "0.0.965",
4
4
  "homepage": "https://bit.dev/teambit/typescript/typescript",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.typescript",
8
8
  "name": "typescript",
9
- "version": "0.0.963"
9
+ "version": "0.0.965"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -20,23 +20,23 @@
20
20
  "core-js": "^3.0.0",
21
21
  "@babel/runtime": "7.20.0",
22
22
  "@teambit/harmony": "0.4.6",
23
- "@teambit/compiler": "0.0.963",
23
+ "@teambit/compiler": "0.0.965",
24
24
  "@teambit/typescript.modules.ts-config-mutator": "0.0.76",
25
- "@teambit/component": "0.0.963",
26
- "@teambit/dependency-resolver": "0.0.963",
27
- "@teambit/formatter": "0.0.514",
25
+ "@teambit/component": "0.0.965",
26
+ "@teambit/dependency-resolver": "0.0.965",
27
+ "@teambit/formatter": "0.0.516",
28
28
  "@teambit/semantics.entities.semantic-schema": "0.0.48",
29
29
  "@teambit/ts-server": "0.0.39",
30
- "@teambit/aspect-loader": "0.0.963",
31
- "@teambit/envs": "0.0.963",
32
- "@teambit/logger": "0.0.739",
33
- "@teambit/workspace": "0.0.963",
30
+ "@teambit/aspect-loader": "0.0.965",
31
+ "@teambit/envs": "0.0.965",
32
+ "@teambit/logger": "0.0.741",
33
+ "@teambit/workspace": "0.0.965",
34
34
  "@teambit/bit-error": "0.0.402",
35
- "@teambit/builder": "0.0.963",
36
- "@teambit/isolator": "0.0.963",
37
- "@teambit/schema": "0.0.963",
38
- "@teambit/cli": "0.0.646",
39
- "@teambit/pkg": "0.0.963"
35
+ "@teambit/builder": "0.0.965",
36
+ "@teambit/isolator": "0.0.965",
37
+ "@teambit/schema": "0.0.965",
38
+ "@teambit/cli": "0.0.648",
39
+ "@teambit/pkg": "0.0.965"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/lodash": "4.14.165",
@@ -52,7 +52,7 @@
52
52
  "@teambit/typescript.aspect-docs.typescript": "0.0.151"
53
53
  },
54
54
  "peerDependencies": {
55
- "@teambit/legacy": "1.0.426",
55
+ "@teambit/legacy": "1.0.429",
56
56
  "react": "^16.8.0 || ^17.0.0",
57
57
  "react-dom": "^16.8.0 || ^17.0.0"
58
58
  },