@teambit/typescript 1.0.806 → 1.0.808

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.
@@ -23,4 +23,9 @@ export type ExtractorOptions = {
23
23
  * api transformers.
24
24
  */
25
25
  apiTransformers?: SchemaNodeTransformer[];
26
+ /**
27
+ * Component-relative includes. Exact if no wildcard; glob-lite if contains * or **.
28
+ * Always materialized under `internals` unless already part of the public API graph.
29
+ */
30
+ includeFiles?: string[];
26
31
  };
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["extractor-options.ts"],"sourcesContent":["import type { SchemaNodeTransformer, SchemaTransformer } from './schema-transformer';\n\nexport type ExtractorOptions = {\n /**\n * name of the string.\n */\n name?: string;\n\n /**\n * tsconfig string path.\n */\n tsconfig?: string;\n\n /**\n * TODO: support typescript module path.\n */\n // typescript?: string;\n\n /**\n * typescript compiler options. always overrides all.\n */\n compilerOptions?: string;\n\n /**\n * schema transformers.\n */\n schemaTransformers?: SchemaTransformer[];\n\n /**\n * api transformers.\n */\n apiTransformers?: SchemaNodeTransformer[];\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["extractor-options.ts"],"sourcesContent":["import type { SchemaNodeTransformer, SchemaTransformer } from './schema-transformer';\n\nexport type ExtractorOptions = {\n /**\n * name of the string.\n */\n name?: string;\n\n /**\n * tsconfig string path.\n */\n tsconfig?: string;\n\n /**\n * TODO: support typescript module path.\n */\n // typescript?: string;\n\n /**\n * typescript compiler options. always overrides all.\n */\n compilerOptions?: string;\n\n /**\n * schema transformers.\n */\n schemaTransformers?: SchemaTransformer[];\n\n /**\n * api transformers.\n */\n apiTransformers?: SchemaNodeTransformer[];\n\n /**\n * Component-relative includes. Exact if no wildcard; glob-lite if contains * or **.\n * Always materialized under `internals` unless already part of the public API graph.\n */\n includeFiles?: string[];\n};\n"],"mappings":"","ignoreList":[]}
@@ -11,6 +11,13 @@ function _path() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _legacy() {
15
+ const data = require("@teambit/legacy.utils");
16
+ _legacy = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
22
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
16
23
  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); }
@@ -25,8 +32,10 @@ class Identifier {
25
32
  }
26
33
  static computeNormalizedPath(filePath, sourceFilePath) {
27
34
  let effectivePath = filePath;
28
- if (sourceFilePath) {
29
- effectivePath = (0, _path().isAbsolute)(sourceFilePath) ? sourceFilePath : (0, _path().resolve)((0, _path().dirname)(filePath), sourceFilePath);
35
+ const isAbsoluteSourceFilePath = sourceFilePath && (0, _path().isAbsolute)(sourceFilePath);
36
+ const isRelativeSourceFilePath = sourceFilePath && (0, _legacy().isRelativeImport)(sourceFilePath);
37
+ if (isAbsoluteSourceFilePath || isRelativeSourceFilePath) {
38
+ effectivePath = isAbsoluteSourceFilePath ? sourceFilePath : (0, _path().resolve)((0, _path().dirname)(filePath), sourceFilePath);
30
39
  }
31
40
  return (0, _path().normalize)(effectivePath).replace(/\\/g, '/');
32
41
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_path","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Identifier","constructor","id","filePath","aliasId","sourceFilePath","normalizedPath","computeNormalizedPath","effectivePath","isAbsolute","resolve","dirname","normalize","replace","isEqual","identifier","isDefault","exports"],"sources":["identifier.ts"],"sourcesContent":["import { isAbsolute, resolve, dirname, normalize } from 'path';\nexport class Identifier {\n public readonly normalizedPath: string;\n\n constructor(\n readonly id: string,\n readonly filePath: string,\n readonly aliasId?: string,\n readonly sourceFilePath?: string\n ) {\n this.normalizedPath = Identifier.computeNormalizedPath(filePath, sourceFilePath);\n }\n\n private static computeNormalizedPath(filePath: string, sourceFilePath?: string): string {\n let effectivePath = filePath;\n if (sourceFilePath) {\n effectivePath = isAbsolute(sourceFilePath) ? sourceFilePath : resolve(dirname(filePath), sourceFilePath);\n }\n return normalize(effectivePath).replace(/\\\\/g, '/');\n }\n\n isEqual(identifier: Identifier): boolean {\n if (this.filePath !== identifier.filePath && this.normalizedPath !== identifier.normalizedPath) return false;\n if (Identifier.isDefault(identifier) && Identifier.isDefault(this)) return true;\n if (Identifier.isDefault(identifier) || Identifier.isDefault(this)) return false;\n return this.id === identifier.id;\n }\n\n static isDefault(identifier: Identifier) {\n return identifier.id === 'default';\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+D,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAA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,CAAC,IAAIf,UAAU,CAACgB,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK;IAChF,OAAO,IAAI,CAACd,EAAE,KAAKa,UAAU,CAACb,EAAE;EAClC;EAEA,OAAOc,SAASA,CAACD,UAAsB,EAAE;IACvC,OAAOA,UAAU,CAACb,EAAE,KAAK,SAAS;EACpC;AACF;AAACe,OAAA,CAAAjB,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_path","data","require","_legacy","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Identifier","constructor","id","filePath","aliasId","sourceFilePath","normalizedPath","computeNormalizedPath","effectivePath","isAbsoluteSourceFilePath","isAbsolute","isRelativeSourceFilePath","isRelativeImport","resolve","dirname","normalize","replace","isEqual","identifier","isDefault","exports"],"sources":["identifier.ts"],"sourcesContent":["import { isAbsolute, resolve, dirname, normalize } from 'path';\nimport { isRelativeImport } from '@teambit/legacy.utils';\n\nexport class Identifier {\n public readonly normalizedPath: string;\n\n constructor(\n readonly id: string,\n readonly filePath: string,\n readonly aliasId?: string,\n readonly sourceFilePath?: string\n ) {\n this.normalizedPath = Identifier.computeNormalizedPath(filePath, sourceFilePath);\n }\n\n private static computeNormalizedPath(filePath: string, sourceFilePath?: string): string {\n let effectivePath = filePath;\n const isAbsoluteSourceFilePath = sourceFilePath && isAbsolute(sourceFilePath);\n const isRelativeSourceFilePath = sourceFilePath && isRelativeImport(sourceFilePath);\n if (isAbsoluteSourceFilePath || isRelativeSourceFilePath) {\n effectivePath = isAbsoluteSourceFilePath ? sourceFilePath : resolve(dirname(filePath), sourceFilePath);\n }\n return normalize(effectivePath).replace(/\\\\/g, '/');\n }\n\n isEqual(identifier: Identifier): boolean {\n if (this.filePath !== identifier.filePath && this.normalizedPath !== identifier.normalizedPath) return false;\n if (Identifier.isDefault(identifier) && Identifier.isDefault(this)) return true;\n if (Identifier.isDefault(identifier) || Identifier.isDefault(this)) return false;\n return this.id === identifier.id;\n }\n\n static isDefault(identifier: Identifier) {\n return identifier.id === 'default';\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyD,SAAAG,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAElD,MAAMgB,UAAU,CAAC;EAGtBC,WAAWA,CACAC,EAAU,EACVC,QAAgB,EAChBC,OAAgB,EAChBC,cAAuB,EAChC;IAAA,KAJSH,EAAU,GAAVA,EAAU;IAAA,KACVC,QAAgB,GAAhBA,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;EACpC;AACF;AAACkB,OAAA,CAAApB,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.806/dist/typescript.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.806/dist/typescript.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.808/dist/typescript.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.808/dist/typescript.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -160,5 +160,19 @@ export declare class SchemaExtractorContext {
160
160
  resolveTypeRef(identifier: Identifier, location: Location, isExportedFromMain?: boolean): Promise<TypeRefSchema>;
161
161
  getTypeRefForExternalNode(node: Node): Promise<TypeRefSchema>;
162
162
  getTypeRefForExternalPath(typeStr: string, filePath: string, location: Location): Promise<TypeRefSchema>;
163
+ buildTopLevelNameIndex(sf: ts.SourceFile): Map<string, ts.Node>;
164
+ /**
165
+ * Walk a SchemaNode tree and collect all TypeRefSchema names that
166
+ * have an internalFilePath.
167
+ *
168
+ * We intentionally do NOT try to match the identifierKey here –
169
+ * we already scope lookups by `nameIndex` for the current file,
170
+ * so cross-file refs will just fail `nameIndex.get(name)` and be ignored.
171
+ *
172
+ * This lets us correctly close over cases like:
173
+ * type MyFirstCombinedProps = MyFirstProps & MyFirstPropsExtra;
174
+ * where `MyFirstPropsExtra` is internal to the same file.
175
+ */
176
+ collectSameFileInternalTypeRefs(root: SchemaNode): string[];
163
177
  jsDocToDocSchema(node: Node): Promise<DocSchema | undefined>;
164
178
  }
@@ -527,7 +527,7 @@ class SchemaExtractorContext {
527
527
  * Create schema for function type, handling params and return type
528
528
  */
529
529
  async createFunctionSchema(node, location, signature) {
530
- const match = signature.match(/\((.*)\)\s*(?:=>|:)\s*(.+)/);
530
+ const match = signature.match(/^\s*\(([^)]*)\)\s*(?:=>|:)\s*(.+)$/);
531
531
  if (!match) {
532
532
  return new (_semanticsEntities().FunctionLikeSchema)(location, 'anonymous', [], new (_semanticsEntities().InferenceTypeSchema)(location, 'any'), signature);
533
533
  }
@@ -651,16 +651,20 @@ class SchemaExtractorContext {
651
651
  const parsedMainIdentifier = mainIdentifierList?.find(mainIdentifier);
652
652
  const isExportedFromMain = parsedMainIdentifier && _exportIdentifier().ExportIdentifier.isExportIdentifier(parsedMainIdentifier);
653
653
  if (!parsedNodeIdentifier) return undefined;
654
- const internalRef = !isExportedFromMain;
655
- if (internalRef) {
656
- this.setInternalIdentifiers(parsedNodeIdentifier.normalizedPath, new (_identifierList().IdentifierList)([parsedNodeIdentifier]));
654
+ if (!isExportedFromMain) {
655
+ const src = parsedNodeIdentifier.sourceFilePath;
656
+ const isLocalOrRelative = !src || (0, _legacy().isRelativeImport)(src); // bare specifiers (e.g., 'react') are excluded
657
+ if (isLocalOrRelative) {
658
+ const key = src ? parsedNodeIdentifier.normalizedPath : parsedNodeIdentifier.filePath;
659
+ this.setInternalIdentifiers(this.getIdentifierKey(key), new (_identifierList().IdentifierList)([parsedNodeIdentifier]));
660
+ }
657
661
  }
658
662
  return this.resolveTypeRef(parsedNodeIdentifier, location, isExportedFromMain);
659
663
  }
660
664
  async resolveTypeRef(identifier, location, isExportedFromMain) {
661
665
  const sourceFilePath = identifier.sourceFilePath;
662
666
  if (!sourceFilePath || isExportedFromMain && (0, _legacy().isRelativeImport)(sourceFilePath)) {
663
- return new (_semanticsEntities().TypeRefSchema)(location, identifier.id, undefined, undefined, !isExportedFromMain ? this.getPathRelativeToComponent(identifier.filePath) : undefined);
667
+ return new (_semanticsEntities().TypeRefSchema)(location, identifier.id, undefined, undefined, !isExportedFromMain ? this.getPathRelativeToComponent(identifier.filePath) : undefined, sourceFilePath);
664
668
  }
665
669
  if (!(0, _legacy().isRelativeImport)(sourceFilePath)) {
666
670
  const pkgName = this.parsePackageNameFromPath(sourceFilePath);
@@ -693,7 +697,7 @@ class SchemaExtractorContext {
693
697
  if (exportedIdentifier) {
694
698
  return this.resolveTypeRef(exportedIdentifier, location, isExportedFromMain);
695
699
  }
696
- return new (_semanticsEntities().TypeRefSchema)(location, identifier.id);
700
+ return new (_semanticsEntities().TypeRefSchema)(location, identifier.id, undefined, undefined, undefined);
697
701
  }
698
702
  async getTypeRefForExternalNode(node) {
699
703
  const info = await this.getQuickInfo(node);
@@ -714,6 +718,50 @@ class SchemaExtractorContext {
714
718
  }
715
719
  return new (_semanticsEntities().TypeRefSchema)(location, typeStr, undefined, pkgName);
716
720
  }
721
+ buildTopLevelNameIndex(sf) {
722
+ const map = new Map();
723
+ for (const s of sf.statements) {
724
+ const name = 'name' in s && s.name && _typescript().default.isIdentifier(s.name) ? s.name.text : _typescript().default.isVariableStatement(s) && s.declarationList.declarations.length === 1 && _typescript().default.isIdentifier(s.declarationList.declarations[0].name) ? s.declarationList.declarations[0].name.text : undefined;
725
+ if (name && !map.has(name)) map.set(name, s);
726
+ }
727
+ return map;
728
+ }
729
+
730
+ // inside TypeScriptExtractor
731
+ /**
732
+ * Walk a SchemaNode tree and collect all TypeRefSchema names that
733
+ * have an internalFilePath.
734
+ *
735
+ * We intentionally do NOT try to match the identifierKey here –
736
+ * we already scope lookups by `nameIndex` for the current file,
737
+ * so cross-file refs will just fail `nameIndex.get(name)` and be ignored.
738
+ *
739
+ * This lets us correctly close over cases like:
740
+ * type MyFirstCombinedProps = MyFirstProps & MyFirstPropsExtra;
741
+ * where `MyFirstPropsExtra` is internal to the same file.
742
+ */
743
+ collectSameFileInternalTypeRefs(root) {
744
+ const result = new Set();
745
+ const stack = [root];
746
+ while (stack.length) {
747
+ const node = stack.pop();
748
+ if (!node || typeof node !== 'object') continue;
749
+ if (_semanticsEntities().TypeRefSchema.isTypeRefSchema(node) && typeof node.name === 'string' && node.internalFilePath) {
750
+ result.add(node.name);
751
+ }
752
+ for (const value of Object.values(node)) {
753
+ if (!value) continue;
754
+ if (Array.isArray(value)) {
755
+ for (const v of value) {
756
+ if (v && typeof v === 'object') stack.push(v);
757
+ }
758
+ } else if (typeof value === 'object') {
759
+ stack.push(value);
760
+ }
761
+ }
762
+ }
763
+ return Array.from(result);
764
+ }
717
765
  async jsDocToDocSchema(node) {
718
766
  if (!(0, _tsutils().canHaveJsDoc)(node)) {
719
767
  return undefined;
@@ -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","normalizedPath","resolveTypeRef","sourceFilePath","isRelativeImport","TypeRefSchema","compIdByPkg","compIdByPath","getComponentIDByPath","relativeDir","lastIndexOf","absFilePath","compFilePath","idKey","exportedIdentifier","parseTypeFromQuickInfo","jsDocToDocSchema","canHaveJsDoc","jsDocs","getJsDoc","jsDoc","linkComments","comment","c","JSDocLink","linkTags","linkComment","tagName","tagText","text","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\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*(.+)/);\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 const parsedMainIdentifier = mainIdentifierList?.find(mainIdentifier);\n const isExportedFromMain = parsedMainIdentifier && ExportIdentifier.isExportIdentifier(parsedMainIdentifier);\n\n if (!parsedNodeIdentifier) return undefined;\n\n const internalRef = !isExportedFromMain;\n if (internalRef) {\n this.setInternalIdentifiers(parsedNodeIdentifier.normalizedPath, new IdentifierList([parsedNodeIdentifier]));\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 );\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);\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\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, jsDo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,OAAO,KAAIa,8BAAS,EAACrP,QAAQ,EAAEmO,KAAK,CAAC7G,OAAO,CAAC,CAAC,EAAE+G,OAAO,EAAEY,IAAI,CAAC;EAChE;AACF;AAACK,OAAA,CAAAvR,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","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\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,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AM;MACtB,MAAMC,OAAO,GAAG,GAAGF,WAAW,CAAChP,IAAI,EAAEwG,OAAO,CAAC,CAAC,IAAI,EAAE,GAAGwI,WAAW,CAACzB,IAAI,IAAI,EAAE,EAAE;MAC/E,MAAM4B,WAAW,GAAG,IAAI,CAAC7O,WAAW,CAAC0O,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,EAAExO,MAAM,CAAEyO,CAAC,IAAKA,CAAC,CAACrO,IAAI,KAAKgK,qBAAE,CAACjK,UAAU,CAACuO,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,CAACnR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAEoB,MAAM,CACjHqP,QACF,CAAC;IAED,OAAO,KAAIY,8BAAS,EAACzQ,QAAQ,EAAEwP,KAAK,CAAClI,OAAO,CAAC,CAAC,EAAEoI,OAAO,EAAEW,IAAI,CAAC;EAChE;AACF;AAACK,OAAA,CAAA3S,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -25,6 +25,13 @@ function _semanticsEntities() {
25
25
  };
26
26
  return data;
27
27
  }
28
+ function _parseTypeFromQuickInfo() {
29
+ const data = require("./utils/parse-type-from-quick-info");
30
+ _parseTypeFromQuickInfo = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
28
35
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
29
36
  class ObjectLiteralExpressionTransformer {
30
37
  predicate(node) {
@@ -36,9 +43,24 @@ class ObjectLiteralExpressionTransformer {
36
43
  async transform(node, context) {
37
44
  const properties = await (0, _pMapSeries().default)(node.properties, async prop => {
38
45
  const schema = await context.computeSchema(prop);
39
- if (schema instanceof _semanticsEntities().UnImplementedSchema) {
40
- const typeRef = await context.resolveType(prop, prop.getText());
41
- return typeRef;
46
+ if (schema instanceof _semanticsEntities().UnImplementedSchema && _typescript().default.isPropertyAssignment(prop)) {
47
+ const init = prop.initializer;
48
+ if (_typescript().default.isIdentifier(init)) {
49
+ const internalRef = await context.getTypeRef(init.getText(), context.getIdentifierKeyForNode(init), context.getLocation(init));
50
+ if (internalRef) return internalRef;
51
+ return context.getTypeRefForExternalNode(init);
52
+ }
53
+ const qi = await context.getQuickInfo(init);
54
+ const typeStr = qi?.body?.displayString && (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(qi) || '';
55
+ return context.resolveType(init, typeStr);
56
+ }
57
+ if (schema instanceof _semanticsEntities().PropertyAssignmentSchema && _typescript().default.isPropertyAssignment(prop)) {
58
+ const init = prop.initializer;
59
+ if (schema.value instanceof _semanticsEntities().UnImplementedSchema && _typescript().default.isIdentifier(init)) {
60
+ const internalRef = await context.getTypeRef(init.getText(), context.getIdentifierKeyForNode(init), context.getLocation(init));
61
+ const valueSchema = internalRef ?? (await context.getTypeRefForExternalNode(init));
62
+ return new (_semanticsEntities().PropertyAssignmentSchema)(schema.name, valueSchema, schema.location, schema.doc);
63
+ }
42
64
  }
43
65
  return schema;
44
66
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_typescript","data","_interopRequireDefault","require","_pMapSeries","_semanticsEntities","e","__esModule","default","ObjectLiteralExpressionTransformer","predicate","node","kind","ts","SyntaxKind","ObjectLiteralExpression","getIdentifiers","transform","context","properties","pMapSeries","prop","schema","computeSchema","UnImplementedSchema","typeRef","resolveType","getText","location","getLocation","ObjectLiteralExpressionSchema","exports"],"sources":["object-literal-expression.ts"],"sourcesContent":["import type { Node, ObjectLiteralExpression } from 'typescript';\nimport ts from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport { ObjectLiteralExpressionSchema, UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { SchemaTransformer } from '../schema-transformer';\n\nexport class ObjectLiteralExpressionTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ObjectLiteralExpression;\n }\n\n async getIdentifiers() {\n return [];\n }\n\n async transform(node: ObjectLiteralExpression, context: SchemaExtractorContext) {\n const properties = await pMapSeries(node.properties, async (prop) => {\n const schema = await context.computeSchema(prop);\n if (schema instanceof UnImplementedSchema) {\n const typeRef = await context.resolveType(prop, prop.getText());\n return typeRef;\n }\n return schema;\n });\n const location = context.getLocation(node);\n return new ObjectLiteralExpressionSchema(properties, location);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,mBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,kBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiH,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI1G,MAAMG,kCAAkC,CAA8B;EAC3EC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,uBAAuB;EAC5D;EAEA,MAAMC,cAAcA,CAAA,EAAG;IACrB,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACN,IAA6B,EAAEO,OAA+B,EAAE;IAC9E,MAAMC,UAAU,GAAG,MAAM,IAAAC,qBAAU,EAACT,IAAI,CAACQ,UAAU,EAAE,MAAOE,IAAI,IAAK;MACnE,MAAMC,MAAM,GAAG,MAAMJ,OAAO,CAACK,aAAa,CAACF,IAAI,CAAC;MAChD,IAAIC,MAAM,YAAYE,wCAAmB,EAAE;QACzC,MAAMC,OAAO,GAAG,MAAMP,OAAO,CAACQ,WAAW,CAACL,IAAI,EAAEA,IAAI,CAACM,OAAO,CAAC,CAAC,CAAC;QAC/D,OAAOF,OAAO;MAChB;MACA,OAAOH,MAAM;IACf,CAAC,CAAC;IACF,MAAMM,QAAQ,GAAGV,OAAO,CAACW,WAAW,CAAClB,IAAI,CAAC;IAC1C,OAAO,KAAImB,kDAA6B,EAACX,UAAU,EAAES,QAAQ,CAAC;EAChE;AACF;AAACG,OAAA,CAAAtB,kCAAA,GAAAA,kCAAA","ignoreList":[]}
1
+ {"version":3,"names":["_typescript","data","_interopRequireDefault","require","_pMapSeries","_semanticsEntities","_parseTypeFromQuickInfo","e","__esModule","default","ObjectLiteralExpressionTransformer","predicate","node","kind","ts","SyntaxKind","ObjectLiteralExpression","getIdentifiers","transform","context","properties","pMapSeries","prop","schema","computeSchema","UnImplementedSchema","isPropertyAssignment","init","initializer","isIdentifier","internalRef","getTypeRef","getText","getIdentifierKeyForNode","getLocation","getTypeRefForExternalNode","qi","getQuickInfo","typeStr","body","displayString","parseTypeFromQuickInfo","resolveType","PropertyAssignmentSchema","value","valueSchema","name","location","doc","ObjectLiteralExpressionSchema","exports"],"sources":["object-literal-expression.ts"],"sourcesContent":["import type { Node, ObjectLiteralExpression } from 'typescript';\nimport ts from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport {\n ObjectLiteralExpressionSchema,\n UnImplementedSchema,\n PropertyAssignmentSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\n\nexport class ObjectLiteralExpressionTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ObjectLiteralExpression;\n }\n\n async getIdentifiers() {\n return [];\n }\n\n async transform(node: ObjectLiteralExpression, context: SchemaExtractorContext) {\n const properties = await pMapSeries(node.properties, async (prop) => {\n const schema = await context.computeSchema(prop);\n\n if (schema instanceof UnImplementedSchema && ts.isPropertyAssignment(prop)) {\n const init = prop.initializer;\n\n if (ts.isIdentifier(init)) {\n const internalRef = await context.getTypeRef(\n init.getText(),\n context.getIdentifierKeyForNode(init),\n context.getLocation(init)\n );\n\n if (internalRef) return internalRef;\n\n return context.getTypeRefForExternalNode(init);\n }\n\n const qi = await context.getQuickInfo(init);\n const typeStr = (qi?.body?.displayString && parseTypeFromQuickInfo(qi)) || '';\n return context.resolveType(init as ts.Node & { type?: ts.TypeNode }, typeStr);\n }\n\n if (schema instanceof PropertyAssignmentSchema && ts.isPropertyAssignment(prop)) {\n const init = prop.initializer;\n if (schema.value instanceof UnImplementedSchema && ts.isIdentifier(init)) {\n const internalRef = await context.getTypeRef(\n init.getText(),\n context.getIdentifierKeyForNode(init),\n context.getLocation(init)\n );\n\n const valueSchema = internalRef ?? (await context.getTypeRefForExternalNode(init));\n return new PropertyAssignmentSchema(schema.name, valueSchema, schema.location, schema.doc);\n }\n }\n return schema;\n });\n const location = context.getLocation(node);\n return new ObjectLiteralExpressionSchema(properties, location);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,Y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Q,CAAC;EAChE;AACF;AAACG,OAAA,CAAAxC,kCAAA,GAAAA,kCAAA","ignoreList":[]}
@@ -65,6 +65,11 @@ class VariableDeclaration {
65
65
  const doc = await context.jsDocToDocSchema(varDec);
66
66
  const nodeModifiers = _typescript().default.canHaveModifiers(varDec) ? _typescript().default.getModifiers(varDec) : undefined;
67
67
  const modifiers = nodeModifiers?.map(modifier => modifier.getText()) || [];
68
+ if (varDec.initializer && _typescript().default.isObjectLiteralExpression(varDec.initializer)) {
69
+ const typeFromInit = await context.computeSchema(varDec.initializer);
70
+ const defaultValue = varDec.initializer.getText();
71
+ return new (_semanticsEntities().VariableLikeSchema)(location, name, displaySig, typeFromInit, false, doc, defaultValue);
72
+ }
68
73
  if (varDec.initializer?.kind === _typescript().default.SyntaxKind.ArrowFunction) {
69
74
  const functionLikeInfo = await context.getQuickInfo(varDec.initializer.equalsGreaterThanToken);
70
75
  const returnTypeStr = functionLikeInfo ? (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(functionLikeInfo) : 'any';