@teambit/typescript 1.0.107 → 1.0.109

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.
Files changed (68) hide show
  1. package/artifacts/__bit_junit.xml +49 -0
  2. package/artifacts/preview/teambit_typescript_typescript-preview.js +1 -0
  3. package/dist/cmds/write-tsconfig.cmd.d.ts +2 -2
  4. package/dist/compiler-options.d.ts +2 -2
  5. package/dist/extractor-options.d.ts +1 -1
  6. package/dist/identifier-list.d.ts +1 -1
  7. package/dist/identifier.d.ts +3 -3
  8. package/dist/{preview-1703590665075.js → preview-1703698405864.js} +2 -2
  9. package/dist/schema-extractor-context.d.ts +11 -11
  10. package/dist/schema-extractor-context.js +13 -17
  11. package/dist/schema-extractor-context.js.map +1 -1
  12. package/dist/schema-transformer.d.ts +2 -2
  13. package/dist/sourceFileTransformers/export.js +1 -2
  14. package/dist/sourceFileTransformers/export.js.map +1 -1
  15. package/dist/sourceFileTransformers/function.js +2 -3
  16. package/dist/sourceFileTransformers/function.js.map +1 -1
  17. package/dist/sourceFileTransformers/import.js +1 -2
  18. package/dist/sourceFileTransformers/import.js.map +1 -1
  19. package/dist/sourceFileTransformers/index.d.ts +1 -1
  20. package/dist/sourceFileTransformers/transform.js +1 -1
  21. package/dist/sourceFileTransformers/transform.js.map +1 -1
  22. package/dist/transformers/binding-element.js +1 -2
  23. package/dist/transformers/binding-element.js.map +1 -1
  24. package/dist/transformers/class-declaration.js +3 -6
  25. package/dist/transformers/class-declaration.js.map +1 -1
  26. package/dist/transformers/constructor.js +3 -4
  27. package/dist/transformers/constructor.js.map +1 -1
  28. package/dist/transformers/enum-declaration.js +1 -2
  29. package/dist/transformers/enum-declaration.js.map +1 -1
  30. package/dist/transformers/export-declaration.js +5 -7
  31. package/dist/transformers/export-declaration.js.map +1 -1
  32. package/dist/transformers/function-like.js +5 -8
  33. package/dist/transformers/function-like.js.map +1 -1
  34. package/dist/transformers/get-accessor.js +1 -2
  35. package/dist/transformers/get-accessor.js.map +1 -1
  36. package/dist/transformers/import-declaration.js +2 -3
  37. package/dist/transformers/import-declaration.js.map +1 -1
  38. package/dist/transformers/interface-declaration.js +1 -2
  39. package/dist/transformers/interface-declaration.js.map +1 -1
  40. package/dist/transformers/parameter.js +1 -2
  41. package/dist/transformers/parameter.js.map +1 -1
  42. package/dist/transformers/property-declaration.js +1 -2
  43. package/dist/transformers/property-declaration.js.map +1 -1
  44. package/dist/transformers/source-file-transformer.js +3 -5
  45. package/dist/transformers/source-file-transformer.js.map +1 -1
  46. package/dist/transformers/utils/jsdoc-to-doc-schema.js +2 -4
  47. package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -1
  48. package/dist/transformers/utils/parse-type-from-quick-info.js +1 -2
  49. package/dist/transformers/utils/parse-type-from-quick-info.js.map +1 -1
  50. package/dist/transformers/variable-declaration.js +8 -12
  51. package/dist/transformers/variable-declaration.js.map +1 -1
  52. package/dist/tsconfig-writer.d.ts +2 -2
  53. package/dist/tsconfig-writer.js +1 -4
  54. package/dist/tsconfig-writer.js.map +1 -1
  55. package/dist/typescript.composition.d.ts +2 -2
  56. package/dist/typescript.extractor.d.ts +3 -3
  57. package/dist/typescript.extractor.js +5 -7
  58. package/dist/typescript.extractor.js.map +1 -1
  59. package/dist/typescript.main.runtime.d.ts +7 -7
  60. package/dist/typescript.main.runtime.js +1 -2
  61. package/dist/typescript.main.runtime.js.map +1 -1
  62. package/dist/typescript.parser.js +7 -8
  63. package/dist/typescript.parser.js.map +1 -1
  64. package/dist/typescript.parser.spec.js +12 -15
  65. package/dist/typescript.parser.spec.js.map +1 -1
  66. package/package.json +27 -34
  67. package/tsconfig.json +16 -21
  68. package/types/asset.d.ts +15 -3
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuites>
3
+ <testsuite name="teambit.typescript/typescript@1.0.109" timestamp="2023-12-27T17:56:28.158Z" tests="44" failures="0" errors="0" skipped="0">
4
+ <testcase classname="dedupe-path.spec.js" name="should return the root-dir if there is only one env involved" time="0.628"/>
5
+ <testcase classname="dedupe-path.spec.js" name="should set the env with the most components" time="0.001"/>
6
+ <testcase classname="dedupe-path.spec.js" name="should not set any env to a shared dir if it no env has max components" time="0.002"/>
7
+ <testcase classname="typescript.parser.spec.js" name="should parse arrowFunctions" time="0.897"/>
8
+ <testcase classname="typescript.parser.spec.js" name="should parse function exports" time="0.002"/>
9
+ <testcase classname="typescript.parser.spec.js" name="should parse classes" time="0.003"/>
10
+ <testcase classname="typescript.parser.spec.js" name="should parse declarations" time="0.001"/>
11
+ <testcase classname="typescript.parser.spec.js" name="should parse renamed declarations" time="0.001"/>
12
+ <testcase classname="typescript.parser.spec.js" name="should parse re-exports" time="0.001"/>
13
+ <testcase classname="typescript.parser.spec.js" name="should parse re-exports with default"/>
14
+ <testcase classname="typescript.parser.spec.js" name="should parse renamed re-exports all" time="0.001"/>
15
+ <testcase classname="typescript.parser.spec.js" name="should parse default exports" time="0.002"/>
16
+ <testcase classname="typescript.parser.spec.js" name="should include staticProperties, when on arrowFunctions" time="0.001"/>
17
+ <testcase classname="typescript.parser.spec.js" name="should include staticProperties, when on regular functions"/>
18
+ <testcase classname="typescript.parser.spec.js" name="should include staticProperties, when on classes"/>
19
+ <testcase classname="typescript.parser.spec.js" name="should parse all primitive values" time="0.001"/>
20
+ <testcase classname="typescript.parser.spec.js" name="should skip non primitive values"/>
21
+ <testcase classname="typescript.parser.spec.js" name="should skip non assignment statements" time="0.001"/>
22
+ <testcase classname="typescript.compiler.spec.js" name="should replace the extension with .js and prepend the dist dir" time="0.752"/>
23
+ <testcase classname="typescript.compiler.spec.js" name="should not replace the extension if the file is not supported" time="0.001"/>
24
+ <testcase classname="typescript.compiler.spec.js" name="should support .ts files" time="0.001"/>
25
+ <testcase classname="typescript.compiler.spec.js" name="should support .tsx files"/>
26
+ <testcase classname="typescript.compiler.spec.js" name="should not support .jsx files by default" time="0.001"/>
27
+ <testcase classname="typescript.compiler.spec.js" name="should not support .js files by default"/>
28
+ <testcase classname="typescript.compiler.spec.js" name="should support .jsx files when passing compileJsx" time="0.001"/>
29
+ <testcase classname="typescript.compiler.spec.js" name="should support .js files when passing compileJs"/>
30
+ <testcase classname="typescript.compiler.spec.js" name="should not support .d.ts files" time="0.001"/>
31
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with classNamesTransformer" time="0.516"/>
32
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with functionNamesTransformer" time="0.006"/>
33
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with importTransformer" time="0.006"/>
34
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with interfaceNamesTransformer" time="0.004"/>
35
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with typeAliasNamesTransformer" time="0.003"/>
36
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with variableNamesTransformer" time="0.005"/>
37
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with classNamesTransformer" time="0.003"/>
38
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with classNamesTransformer" time="0.002"/>
39
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with expressionStatementTransformer" time="0.004"/>
40
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with expressionStatementTransformer" time="0.004"/>
41
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with interfaceNamesTransformer" time="0.002"/>
42
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with importTransformer" time="0.003"/>
43
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with exportTransformer" time="0.003"/>
44
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with exportTransformer" time="0.001"/>
45
+ <testcase classname="transform-source-file.spec.js" name="should correctly transform source code with exportTransformer" time="0.002"/>
46
+ <testcase classname="transform-source-file.spec.js" name="should return original source code if no transformations are applied" time="0.003"/>
47
+ <testcase classname="transform-source-file.spec.js" name="should handle multiple transformers" time="0.002"/>
48
+ </testsuite>
49
+ </testsuites>
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.typescript/typescript-preview"]=t():e["teambit.typescript/typescript-preview"]=t()}(self,(()=>(()=>{"use strict";var e={48847:(e,t,n)=>{var o={id:"teambit.typescript/typescript@1.0.109",homepage:"https://bit.cloud/teambit/typescript/typescript",exported:!0};function r(){const e=i(n(87363));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,i.__bit_component=o;const p=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/brands/logo-typescript.svg"}));p.__bit_component=o,t.Logo=p},68929:(e,t,n)=>{Object.defineProperty(t,"x",{enumerable:!0,get:function(){return o.default}});var o=r(n(54171));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.typescript/aspect-docs/typescript@0.0.165",homepage:"https://bit.cloud/teambit/typescript/aspect-docs/typescript",exported:!0}},54171:(e,t,n)=>{var o={id:"teambit.typescript/aspect-docs/typescript@0.0.165",homepage:"https://bit.cloud/teambit/typescript/aspect-docs/typescript",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=m,p(n(87363));var r=n(40040),i=["components"];function p(e){return e&&e.__esModule?e:{default:e}}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s.apply(this,arguments)}function a(e,t){if(null==e)return{};var n,o,r=c(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function c(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}p.__bit_component=o,s.__bit_component=o,a.__bit_component=o,c.__bit_component=o;var d={},l="wrapper";function m(e){var t=e.components,n=a(e,i);return(0,r.mdx)(l,s({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("p",null,"Typescript aspect implements the ",(0,r.mdx)("inlineCode",{parentName:"p"},"Compiler")," interface and provides the ability to transpile files on the workspace and build components in the isolated capsules."),(0,r.mdx)("h2",null,"Configuration - tsconfig.json"),(0,r.mdx)("p",null,"An env that uses typescript compiler can have two tsconfig.json files, one for the workspace and one for the build process."),(0,r.mdx)("p",null,"On the workspace, the following two configurations are overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"compilerOptions.sourceRoot = <componentDir>;\ncompilerOptions.rootDir = '.';\n")),(0,r.mdx)("p",null,"The reason to override them is to make the source-map working on the workspace."),(0,r.mdx)("p",null,"As a reminder, the ",(0,r.mdx)("inlineCode",{parentName:"p"},"dists")," are written into the node_modules and not in the component-dir, without the configuration above, the source-map won't have the correct ",(0,r.mdx)("inlineCode",{parentName:"p"},"sourceRoot")," and ",(0,r.mdx)("inlineCode",{parentName:"p"},"sources")," values, and as a result, the debugger won't work."),(0,r.mdx)("p",null,"On the capsules, the following configurion is overridden:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"compilerOptions.outDir = <CompilerOptions.distDir>\n")),(0,r.mdx)("p",null,"This is done to avoid confusion when the distDir is ",(0,r.mdx)("inlineCode",{parentName:"p"},"x")," and ts-config outDir is ",(0,r.mdx)("inlineCode",{parentName:"p"},"y"),",\nin which case, the dists in the capsule are written into ",(0,r.mdx)("inlineCode",{parentName:"p"},"y"),", but other bit processes expect to find them in ",(0,r.mdx)("inlineCode",{parentName:"p"},"x"),"."),(0,r.mdx)("h1",null,"Override typescript configuration in a custom env:"),(0,r.mdx)("p",null,"When creating a new custom environment, use the following API to change the typescript compiler config."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"useTypescript(modifiers?: UseTypescriptModifiers, tsModule: any = ts)\n")),(0,r.mdx)("p",null,"The modifiers are:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"type UseTypescriptModifiers = {\n buildConfig?: TsConfigTransformer[];\n devConfig?: TsConfigTransformer[];\n};\n")),(0,r.mdx)("p",null,"As you can see, you can customize the configuration for both: the build process and for the compilation on the workspace."),(0,r.mdx)("p",null,"An example of a TsConfigTransformer used by ",(0,r.mdx)("inlineCode",{parentName:"p"},"teambit/aspect")," for the build process, which uses the typescript compiler only for generating the types:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"const tsconfig = require(\"./tsconfig.json\");\n\nconst transformer: TsConfigTransformer = (config: TypescriptConfigMutator) => {\n config\n .mergeTsConfig(tsconfig)\n .setArtifactName('declaration')\n .setDistGlobPatterns([`dist/**/*.d.ts`])\n .setShouldCopyNonSupportedFiles(false);\n return config;\n };\n")),(0,r.mdx)("p",null,"In the last example, a custom tsconfig.json was merged to the builtin tsconfig.json."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},'{\n "compilerOptions": {\n ...\n "emitDeclarationOnly": true,\n ...\n },\n}\n')),(0,r.mdx)("p",null,"Some more props were changed as well to accomodate this env"))}m.__bit_component=o,m.isMDXComponent=!0},40040:e=>{e.exports=MdxJsReact},87363:e=>{e.exports=React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{compositions:()=>m,compositions_metadata:()=>f,overview:()=>u});var e={};n.r(e),n.d(e,{default:()=>l});var t=n(48847),r=(n(87363),n(40040));const i=TeambitMdxUiMdxScopeContext;var p=n(68929),s=["components"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},a.apply(this,arguments)}var c={},d="wrapper";function l(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,s);return(0,r.mdx)(d,a({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{Typescript:p.x},mdxType:"MDXScopeProvider"},(0,r.mdx)(p.x,{mdxType:"Typescript"})))}l.isMDXComponent=!0;const m=[t],u=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
@@ -1,7 +1,7 @@
1
1
  /// <reference types="lodash" />
2
2
  import { Command, CommandOptions } from '@teambit/cli';
3
3
  import { TypescriptMain } from '../typescript.main.runtime';
4
- declare type Flags = {
4
+ type Flags = {
5
5
  dryRun?: boolean;
6
6
  noDedupe?: boolean;
7
7
  dryRunWithTsconfig?: boolean;
@@ -19,7 +19,7 @@ export default class WriteTsconfigCmd implements Command {
19
19
  constructor(tsMain: TypescriptMain);
20
20
  report(_args: any, flags: Flags): Promise<string>;
21
21
  json(_args: any, flags: Flags): Promise<{
22
- cleanResults: string[] | undefined;
22
+ cleanResults: string[];
23
23
  writeResults: import("lodash").Omit<import("../tsconfig-writer").TsconfigPathsPerEnv, "tsconfig">[];
24
24
  }>;
25
25
  }
@@ -1,5 +1,5 @@
1
1
  import type { CompilerOptions } from '@teambit/compiler';
2
- export declare type TypeScriptCompilerOptions = {
2
+ export type TypeScriptCompilerOptions = {
3
3
  /**
4
4
  * tsconfig to use during compilation.
5
5
  */
@@ -19,4 +19,4 @@ export declare type TypeScriptCompilerOptions = {
19
19
  */
20
20
  compileJsx?: boolean;
21
21
  } & Partial<CompilerOptions>;
22
- export declare type TsCompilerOptionsWithoutTsConfig = Omit<TypeScriptCompilerOptions, 'tsconfig'>;
22
+ export type TsCompilerOptionsWithoutTsConfig = Omit<TypeScriptCompilerOptions, 'tsconfig'>;
@@ -1,4 +1,4 @@
1
- export declare type ExtractorOptions = {
1
+ export type ExtractorOptions = {
2
2
  /**
3
3
  * name of the string.
4
4
  */
@@ -2,6 +2,6 @@ import { Identifier } from './identifier';
2
2
  export declare class IdentifierList {
3
3
  readonly identifiers: Identifier[];
4
4
  constructor(identifiers: Identifier[]);
5
- find(identifier: Identifier): Identifier | undefined;
5
+ find(identifier: Identifier): Identifier;
6
6
  includes(identifier: Identifier): boolean;
7
7
  }
@@ -1,9 +1,9 @@
1
1
  export declare class Identifier {
2
2
  readonly id: string;
3
3
  readonly filePath: string;
4
- readonly aliasId?: string | undefined;
5
- readonly sourceFilePath?: string | undefined;
6
- constructor(id: string, filePath: string, aliasId?: string | undefined, sourceFilePath?: string | undefined);
4
+ readonly aliasId?: string;
5
+ readonly sourceFilePath?: string;
6
+ constructor(id: string, filePath: string, aliasId?: string, sourceFilePath?: string);
7
7
  isEqual(identifier: Identifier): boolean;
8
8
  static isDefault(identifier: Identifier): boolean;
9
9
  }
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@1.0.107/dist/typescript.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@1.0.107/dist/typescript.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@1.0.109/dist/typescript.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@1.0.109/dist/typescript.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -15,7 +15,7 @@ export declare class SchemaExtractorContext {
15
15
  readonly componentDeps: ComponentDependency[];
16
16
  readonly componentRootPath: string;
17
17
  readonly hostRootPath: string;
18
- readonly formatter?: Formatter | undefined;
18
+ readonly formatter?: Formatter;
19
19
  /**
20
20
  * list of all declared identifiers (exported and internal) by filename
21
21
  */
@@ -30,8 +30,8 @@ export declare class SchemaExtractorContext {
30
30
  get internalIdentifiers(): Map<string, IdentifierList>;
31
31
  get computed(): Map<string, SchemaNode>;
32
32
  get mainFileIdentifierKey(): string;
33
- get mainModuleIdentifiers(): IdentifierList | undefined;
34
- constructor(tsserver: TsserverClient, component: Component, extractor: TypeScriptExtractor, componentDeps: ComponentDependency[], componentRootPath: string, hostRootPath: string, formatter?: Formatter | undefined);
33
+ get mainModuleIdentifiers(): IdentifierList;
34
+ constructor(tsserver: TsserverClient, component: Component, extractor: TypeScriptExtractor, componentDeps: ComponentDependency[], componentRootPath: string, hostRootPath: string, formatter?: Formatter);
35
35
  getComputedNodeKey({ filePath, line, character }: Location): string;
36
36
  getIdentifierKeyForNode(node: Node): string;
37
37
  getIdentifierKey(filePath: string): string;
@@ -50,7 +50,7 @@ export declare class SchemaExtractorContext {
50
50
  /**
51
51
  * returns a signature for a node.
52
52
  */
53
- getSignature(node: Node): Promise<protocol.SignatureHelpResponse | undefined>;
53
+ getSignature(node: Node): Promise<protocol.SignatureHelpResponse>;
54
54
  /**
55
55
  * get the position for the tsserver.
56
56
  */
@@ -59,24 +59,24 @@ export declare class SchemaExtractorContext {
59
59
  * get the path for a source file.
60
60
  */
61
61
  getPath(node: Node): string;
62
- getQuickInfo(node: Node): Promise<protocol.QuickInfoResponse | undefined>;
62
+ getQuickInfo(node: Node): Promise<protocol.QuickInfoResponse>;
63
63
  getQuickInfoDisplayString(node: Node): Promise<string>;
64
64
  /**
65
65
  * returns the type definition for a type.
66
66
  */
67
- typeDefinition(node: Node): Promise<protocol.TypeDefinitionResponse | undefined>;
67
+ typeDefinition(node: Node): Promise<protocol.TypeDefinitionResponse>;
68
68
  visitTypeDefinition(): void;
69
69
  private getPathWithoutExtension;
70
70
  private isIndexFile;
71
- findFileInComponent(filePath: string): import("@teambit/legacy/dist/consumer/component/sources").AbstractVinyl | undefined;
71
+ findFileInComponent(filePath: string): import("@teambit/legacy/dist/consumer/component/sources").AbstractVinyl;
72
72
  private parsePackageNameFromPath;
73
73
  /**
74
74
  * return the file if part of the component.
75
75
  * otherwise, a reference to the target package and the type name.
76
76
  */
77
- getSourceFileInsideComponent(filePath: string): ts.SourceFile | undefined;
78
- getSourceFileFromNode(node: Node): Promise<ts.SourceFile | undefined>;
79
- getFilePathByNode(node: Node): Promise<string | undefined>;
77
+ getSourceFileInsideComponent(filePath: string): ts.SourceFile;
78
+ getSourceFileFromNode(node: Node): Promise<ts.SourceFile>;
79
+ getFilePathByNode(node: Node): Promise<string>;
80
80
  definitionInfo(node: Node): Promise<protocol.DefinitionInfo | undefined>;
81
81
  /**
82
82
  * get a definition for a given node.
@@ -101,7 +101,7 @@ export declare class SchemaExtractorContext {
101
101
  * helpful. (couldn't find a rule when to use each one. e.g. "VariableDeclaration" sometimes has data only in
102
102
  * "definition" but it's not clear when/why).
103
103
  */
104
- getDefinition(node: Node): Promise<protocol.FileSpanWithContext | undefined>;
104
+ getDefinition(node: Node): Promise<protocol.FileSpanWithContext>;
105
105
  private unknownExactType;
106
106
  private isDefInSameLocation;
107
107
  /**
@@ -255,9 +255,8 @@ class SchemaExtractorContext {
255
255
  }
256
256
  }
257
257
  async getQuickInfoDisplayString(node) {
258
- var _quickInfo$body;
259
258
  const quickInfo = await this.getQuickInfo(node);
260
- return (quickInfo === null || quickInfo === void 0 || (_quickInfo$body = quickInfo.body) === null || _quickInfo$body === void 0 ? void 0 : _quickInfo$body.displayString) || '';
259
+ return quickInfo?.body?.displayString || '';
261
260
  }
262
261
 
263
262
  /**
@@ -339,14 +338,14 @@ class SchemaExtractorContext {
339
338
  }
340
339
  async getFilePathByNode(node) {
341
340
  const def = await this.tsserver.getDefinition(this.getPath(node), this.getLocation(node));
342
- const firstDef = (0, _lodash().head)(def === null || def === void 0 ? void 0 : def.body);
343
- return firstDef === null || firstDef === void 0 ? void 0 : firstDef.file;
341
+ const firstDef = (0, _lodash().head)(def?.body);
342
+ return firstDef?.file;
344
343
  }
345
344
  async definitionInfo(node) {
346
345
  const location = this.getLocation(node);
347
346
  const filePath = this.getPath(node);
348
347
  const def = await this.tsserver.getDefinition(filePath, location);
349
- const firstDef = (0, _lodash().head)(def === null || def === void 0 ? void 0 : def.body);
348
+ const firstDef = (0, _lodash().head)(def?.body);
350
349
  return firstDef;
351
350
  }
352
351
 
@@ -389,9 +388,8 @@ class SchemaExtractorContext {
389
388
  isExported() {}
390
389
  isFromComponent() {}
391
390
  async getFileIdentifiers(exportDec) {
392
- var _exportDec$moduleSpec;
393
391
  const file = exportDec.getSourceFile().fileName;
394
- const specifierPathStr = exportDec.kind === _typescript().SyntaxKind.ExportDeclaration && ((_exportDec$moduleSpec = exportDec.moduleSpecifier) === null || _exportDec$moduleSpec === void 0 ? void 0 : _exportDec$moduleSpec.getText()) || '';
392
+ const specifierPathStr = exportDec.kind === _typescript().SyntaxKind.ExportDeclaration && exportDec.moduleSpecifier?.getText() || '';
395
393
  const specifierPath = specifierPathStr.substring(1, specifierPathStr.length - 1);
396
394
  const absPath = (0, _path().resolve)(file, '..', specifierPath);
397
395
  const sourceFile = this.getSourceFileInsideComponent(absPath);
@@ -419,12 +417,12 @@ class SchemaExtractorContext {
419
417
  */
420
418
  async getDefinition(node) {
421
419
  const typeDefinition = await this.typeDefinition(node);
422
- const headTypeDefinition = (0, _lodash().head)(typeDefinition === null || typeDefinition === void 0 ? void 0 : typeDefinition.body);
420
+ const headTypeDefinition = (0, _lodash().head)(typeDefinition?.body);
423
421
  if (headTypeDefinition) {
424
422
  return headTypeDefinition;
425
423
  }
426
424
  const definition = await this.tsserver.getDefinition(node.getSourceFile().fileName, this.getLocation(node));
427
- const headDefinition = (0, _lodash().head)(definition === null || definition === void 0 ? void 0 : definition.body);
425
+ const headDefinition = (0, _lodash().head)(definition?.body);
428
426
  return headDefinition;
429
427
  }
430
428
 
@@ -473,7 +471,7 @@ class SchemaExtractorContext {
473
471
  if (!definitionNode) {
474
472
  return this.unknownExactType(node, location, typeStr, isTypeStrFromQuickInfo);
475
473
  }
476
- const definitionNodeName = definitionNode === null || definitionNode === void 0 ? void 0 : definitionNode.getText();
474
+ const definitionNodeName = definitionNode?.getText();
477
475
 
478
476
  // check if internal ref with definition info
479
477
  const definitionInternalRef = await this.getTypeRef(definitionNodeName, this.getIdentifierKeyForNode(definitionNode), location);
@@ -492,8 +490,7 @@ class SchemaExtractorContext {
492
490
  return apiTransformer ? apiTransformer.transform(schemaNode, this) : schemaNode;
493
491
  }
494
492
  getCompIdByPkgName(pkgName) {
495
- var _this$componentDeps$f;
496
- return (_this$componentDeps$f = this.componentDeps.find(dep => dep.packageName === pkgName)) === null || _this$componentDeps$f === void 0 ? void 0 : _this$componentDeps$f.componentId;
493
+ return this.componentDeps.find(dep => dep.packageName === pkgName)?.componentId;
497
494
  }
498
495
  async getTypeRef(typeStr, filePath, location) {
499
496
  const nodeIdentifierKey = this.getIdentifierKey(filePath);
@@ -502,8 +499,8 @@ class SchemaExtractorContext {
502
499
  const mainIdentifierList = this.identifiers.get(mainFileIdentifierKey);
503
500
  const nodeIdentifier = new (_identifier().Identifier)(typeStr, nodeIdentifierKey);
504
501
  const mainIdentifier = new (_identifier().Identifier)(typeStr, mainFileIdentifierKey);
505
- const parsedNodeIdentifier = nodeIdentifierList === null || nodeIdentifierList === void 0 ? void 0 : nodeIdentifierList.find(nodeIdentifier);
506
- const parsedMainIdentifier = mainIdentifierList === null || mainIdentifierList === void 0 ? void 0 : mainIdentifierList.find(mainIdentifier);
502
+ const parsedNodeIdentifier = nodeIdentifierList?.find(nodeIdentifier);
503
+ const parsedMainIdentifier = mainIdentifierList?.find(mainIdentifier);
507
504
  const isExportedFromMain = parsedMainIdentifier && _exportIdentifier().ExportIdentifier.isExportIdentifier(parsedMainIdentifier);
508
505
  if (!parsedNodeIdentifier) return undefined;
509
506
  const internalRef = !isExportedFromMain;
@@ -513,7 +510,6 @@ class SchemaExtractorContext {
513
510
  return this.resolveTypeRef(parsedNodeIdentifier, location, isExportedFromMain);
514
511
  }
515
512
  async resolveTypeRef(identifier, location, isExportedFromMain) {
516
- var _this$identifiers$get;
517
513
  const sourceFilePath = identifier.sourceFilePath;
518
514
  if (!sourceFilePath || isExportedFromMain && (0, _isRelativeImport().default)(sourceFilePath)) {
519
515
  return new (_semanticsEntities().TypeRefSchema)(location, identifier.id, undefined, undefined, !isExportedFromMain ? this.getPathRelativeToComponent(identifier.filePath) : undefined);
@@ -542,10 +538,10 @@ class SchemaExtractorContext {
542
538
  absFilePath ${absFilePath}`);
543
539
  return new (_semanticsEntities().TypeRefSchema)(location, identifier.id);
544
540
  }
545
- const idKey = this.getIdentifierKey(compFilePath === null || compFilePath === void 0 ? void 0 : compFilePath.path);
541
+ const idKey = this.getIdentifierKey(compFilePath?.path);
546
542
 
547
543
  // if re exported from a file, recurse until definition
548
- const exportedIdentifier = (((_this$identifiers$get = this.identifiers.get(idKey)) === null || _this$identifiers$get === void 0 ? void 0 : _this$identifiers$get.identifiers) || []).find(i => i.id === identifier.id);
544
+ const exportedIdentifier = (this.identifiers.get(idKey)?.identifiers || []).find(i => i.id === identifier.id);
549
545
  if (exportedIdentifier) {
550
546
  return this.resolveTypeRef(exportedIdentifier, location, isExportedFromMain);
551
547
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_tsutils","data","require","_typescript","_interopRequireWildcard","_lodash","_utils","_path","_semanticsEntities","_isRelativeImport","_interopRequireDefault","_pMapSeries","_identifierList","_parseTypeFromQuickInfo","_jsdocToDocSchema","_identifier","_exportIdentifier","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","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","getIdentifierKeyForNode","node","getSourceFile","fileName","setComputed","location","setIdentifiers","setInternalIdentifiers","existing","uniqueIdentifiers","uniqBy","concat","k","aliasId","id","IdentifierList","findComputedSchemaByName","name","Array","from","values","filter","schema","computeSchema","getLocation","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","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","kind","SyntaxKind","Identifier","SourceFile","references","isExported","isFromComponent","getFileIdentifiers","exportDec","_exportDec$moduleSpec","specifierPathStr","ExportDeclaration","moduleSpecifier","getText","specifierPath","absPath","resolve","getIdentifiers","getFileExports","identifier","ExportIdentifier","isExportIdentifier","getFileInternals","computeIdentifiers","headTypeDefinition","headDefinition","unknownExactType","typeStr","isTypeStrFromQuickInfo","InferenceTypeSchema","info","type","parseTypeFromQuickInfo","isDefInSameLocation","loc","resolveType","internalRef","getTypeRef","ts","isTypeNode","definitionNode","definitionNodeName","definitionInternalRef","transformer","getTransformer","getTypeRefForExternalPath","schemaNode","apiTransformer","getAPITransformer","transform","getCompIdByPkgName","_this$componentDeps$f","dep","packageName","componentId","nodeIdentifierKey","nodeIdentifierList","mainIdentifierList","nodeIdentifier","mainIdentifier","parsedNodeIdentifier","parsedMainIdentifier","isExportedFromMain","resolveTypeRef","_this$identifiers$get","sourceFilePath","isRelativeImport","TypeRefSchema","compIdByPkg","compIdByPath","getComponentIDByPath","relativeDir","lastIndexOf","absFilePath","compFilePath","idKey","exportedIdentifier","jsDocToDocSchema","canHaveJsDoc","jsDocs","getJsDoc","jsDoc","comment","getTextOfJSDocComment","tags","pMapSeries","tag","tagParser","DocSchema","exports"],"sources":["schema-extractor-context.ts"],"sourcesContent":["import { TsserverClient } from '@teambit/ts-server';\nimport { getTokenAtPosition, canHaveJsDoc, getJsDoc } from 'tsutils';\nimport ts, { ExportAssignment, getTextOfJSDocComment, ExportDeclaration, Node, SyntaxKind, TypeNode } from 'typescript';\nimport { head, uniqBy } from 'lodash';\n// @ts-ignore david we should figure fix this.\n// eslint-disable-next-line import/no-unresolved\nimport protocol from 'typescript/lib/protocol';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { resolve, sep, relative, join, isAbsolute, extname } from 'path';\nimport { Component, ComponentID } from '@teambit/component';\nimport {\n TypeRefSchema,\n SchemaNode,\n InferenceTypeSchema,\n Location,\n DocSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport isRelativeImport from '@teambit/legacy/dist/utils/is-relative-import';\nimport { ComponentDependency } from '@teambit/dependency-resolver';\nimport { Formatter } from '@teambit/formatter';\nimport pMapSeries from 'p-map-series';\nimport { 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) {\n return `${filePath}:${line}:${character}`;\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 } = node;\n const key = this.getComputedNodeKey(location);\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);\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 // when we can't figure out the component/package/type of this node, we'll use the typeStr as the type.\n private async unknownExactType(node: Node, location: Location, typeStr = 'any', isTypeStrFromQuickInfo = true) {\n if (isTypeStrFromQuickInfo) {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n const info = await this.getQuickInfo(node);\n const type = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(location, type, typeStr);\n }\n\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(\n node: Node & { type?: TypeNode },\n typeStr: string,\n isTypeStrFromQuickInfo = true\n ): 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, isTypeStrFromQuickInfo);\n }\n\n if (this.isDefInSameLocation(node, definition)) {\n return this.unknownExactType(node, location, typeStr, isTypeStrFromQuickInfo);\n }\n\n const definitionNode = await this.definition(definition);\n\n if (!definitionNode) {\n return this.unknownExactType(node, location, typeStr, isTypeStrFromQuickInfo);\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, isTypeStrFromQuickInfo);\n }\n\n const schemaNode = await this.visit(definitionNode);\n\n if (!schemaNode) {\n return this.unknownExactType(node, location, typeStr, isTypeStrFromQuickInfo);\n }\n\n const apiTransformer = this.extractor.getAPITransformer(schemaNode);\n return apiTransformer ? apiTransformer.transform(schemaNode, this) : schemaNode;\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\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\n if (internalRef) {\n this.setInternalIdentifiers(filePath, 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 );\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 if (!jsDocs.length) {\n return undefined;\n }\n // not sure how common it is to have multiple JSDocs. never seen it before.\n // regardless, in typescript implementation of methods like `getJSDocDeprecatedTag()`, they use the first one. (`getFirstJSDocTag()`)\n const jsDoc = jsDocs[0];\n const location = this.getLocation(jsDoc);\n const comment = getTextOfJSDocComment(jsDoc.comment);\n const tags = jsDoc.tags ? await pMapSeries(jsDoc.tags, (tag) => tagParser(tag, this, this.formatter)) : undefined;\n return new DocSchema(location, jsDoc.getText(), comment, tags);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,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S;IAClB;IACA;IACA;IACA,MAAMiG,KAAK,GAAGF,MAAM,CAAC,CAAC,CAAC;IACvB,MAAMzL,QAAQ,GAAG,IAAI,CAACmB,WAAW,CAACwK,KAAK,CAAC;IACxC,MAAMC,OAAO,GAAG,IAAAC,mCAAqB,EAACF,KAAK,CAACC,OAAO,CAAC;IACpD,MAAME,IAAI,GAAGH,KAAK,CAACG,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAACJ,KAAK,CAACG,IAAI,EAAGE,GAAG,IAAK,IAAAC,6BAAS,EAACD,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC3M,SAAS,CAAC,CAAC,GAAGqG,SAAS;IACjH,OAAO,KAAIwG,8BAAS,EAAClM,QAAQ,EAAE2L,KAAK,CAACpE,OAAO,CAAC,CAAC,EAAEqE,OAAO,EAAEE,IAAI,CAAC;EAChE;AACF;AAACK,OAAA,CAAAnO,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_tsutils","data","require","_typescript","_interopRequireWildcard","_lodash","_utils","_path","_semanticsEntities","_isRelativeImport","_interopRequireDefault","_pMapSeries","_identifierList","_parseTypeFromQuickInfo","_jsdocToDocSchema","_identifier","_exportIdentifier","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_defineProperty","key","value","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","String","Symbol","toPrimitive","TypeError","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","getIdentifierKeyForNode","node","getSourceFile","fileName","setComputed","location","setIdentifiers","setInternalIdentifiers","existing","uniqueIdentifiers","uniqBy","concat","k","aliasId","id","IdentifierList","findComputedSchemaByName","name","Array","from","values","filter","schema","computeSchema","getLocation","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","kind","SyntaxKind","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","isTypeStrFromQuickInfo","InferenceTypeSchema","info","type","parseTypeFromQuickInfo","isDefInSameLocation","loc","resolveType","internalRef","getTypeRef","ts","isTypeNode","definitionNode","definitionNodeName","definitionInternalRef","transformer","getTransformer","getTypeRefForExternalPath","schemaNode","apiTransformer","getAPITransformer","transform","getCompIdByPkgName","dep","packageName","componentId","nodeIdentifierKey","nodeIdentifierList","mainIdentifierList","nodeIdentifier","mainIdentifier","parsedNodeIdentifier","parsedMainIdentifier","isExportedFromMain","resolveTypeRef","sourceFilePath","isRelativeImport","TypeRefSchema","compIdByPkg","compIdByPath","getComponentIDByPath","relativeDir","lastIndexOf","absFilePath","compFilePath","idKey","exportedIdentifier","jsDocToDocSchema","canHaveJsDoc","jsDocs","getJsDoc","jsDoc","comment","getTextOfJSDocComment","tags","pMapSeries","tag","tagParser","DocSchema","exports"],"sources":["schema-extractor-context.ts"],"sourcesContent":["import { TsserverClient } from '@teambit/ts-server';\nimport { getTokenAtPosition, canHaveJsDoc, getJsDoc } from 'tsutils';\nimport ts, { ExportAssignment, getTextOfJSDocComment, ExportDeclaration, Node, SyntaxKind, TypeNode } from 'typescript';\nimport { head, uniqBy } from 'lodash';\n// @ts-ignore david we should figure fix this.\n// eslint-disable-next-line import/no-unresolved\nimport protocol from 'typescript/lib/protocol';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\nimport { resolve, sep, relative, join, isAbsolute, extname } from 'path';\nimport { Component, ComponentID } from '@teambit/component';\nimport {\n TypeRefSchema,\n SchemaNode,\n InferenceTypeSchema,\n Location,\n DocSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport isRelativeImport from '@teambit/legacy/dist/utils/is-relative-import';\nimport { ComponentDependency } from '@teambit/dependency-resolver';\nimport { Formatter } from '@teambit/formatter';\nimport pMapSeries from 'p-map-series';\nimport { 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) {\n return `${filePath}:${line}:${character}`;\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 } = node;\n const key = this.getComputedNodeKey(location);\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);\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 // when we can't figure out the component/package/type of this node, we'll use the typeStr as the type.\n private async unknownExactType(node: Node, location: Location, typeStr = 'any', isTypeStrFromQuickInfo = true) {\n if (isTypeStrFromQuickInfo) {\n return new InferenceTypeSchema(location, typeStr || 'any');\n }\n const info = await this.getQuickInfo(node);\n const type = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(location, type, typeStr);\n }\n\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(\n node: Node & { type?: TypeNode },\n typeStr: string,\n isTypeStrFromQuickInfo = true\n ): 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, isTypeStrFromQuickInfo);\n }\n\n if (this.isDefInSameLocation(node, definition)) {\n return this.unknownExactType(node, location, typeStr, isTypeStrFromQuickInfo);\n }\n\n const definitionNode = await this.definition(definition);\n\n if (!definitionNode) {\n return this.unknownExactType(node, location, typeStr, isTypeStrFromQuickInfo);\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, isTypeStrFromQuickInfo);\n }\n\n const schemaNode = await this.visit(definitionNode);\n\n if (!schemaNode) {\n return this.unknownExactType(node, location, typeStr, isTypeStrFromQuickInfo);\n }\n\n const apiTransformer = this.extractor.getAPITransformer(schemaNode);\n return apiTransformer ? apiTransformer.transform(schemaNode, this) : schemaNode;\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\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\n if (internalRef) {\n this.setInternalIdentifiers(filePath, 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 );\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 if (!jsDocs.length) {\n return undefined;\n }\n // not sure how common it is to have multiple JSDocs. never seen it before.\n // regardless, in typescript implementation of methods like `getJSDocDeprecatedTag()`, they use the first one. (`getFirstJSDocTag()`)\n const jsDoc = jsDocs[0];\n const location = this.getLocation(jsDoc);\n const comment = getTextOfJSDocComment(jsDoc.comment);\n const tags = jsDoc.tags ? await pMapSeries(jsDoc.tags, (tag) => tagParser(tag, this, this.formatter)) : undefined;\n return new DocSchema(location, jsDoc.getText(), comment, tags);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,uBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,mBAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,kBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAQ,kBAAA;EAAA,MAAAR,IAAA,GAAAS,sBAAA,CAAAR,OAAA;EAAAO,iBAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAU,YAAA;EAAA,MAAAV,IAAA,GAAAS,sBAAA,CAAAR,OAAA;EAAAS,WAAA,YAAAA,CAAA;IAAA,OAAAV,IAAA;EAAA;EAAA,OAAAA,I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IACxC,MAAMC,OAAO,GAAG,IAAAC,mCAAqB,EAACF,KAAK,CAACC,OAAO,CAAC;IACpD,MAAME,IAAI,GAAGH,KAAK,CAACG,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAACJ,KAAK,CAACG,IAAI,EAAGE,GAAG,IAAK,IAAAC,6BAAS,EAACD,GAAG,EAAE,IAAI,EAAE,IAAI,CAACvM,SAAS,CAAC,CAAC,GAAGoG,SAAS;IACjH,OAAO,KAAIqG,8BAAS,EAAC9L,QAAQ,EAAEuL,KAAK,CAAClE,OAAO,CAAC,CAAC,EAAEmE,OAAO,EAAEE,IAAI,CAAC;EAChE;AACF;AAACK,OAAA,CAAA/N,sBAAA,GAAAA,sBAAA"}
@@ -2,7 +2,7 @@ import { Node } from 'typescript';
2
2
  import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
3
3
  import { SchemaExtractorContext } from './schema-extractor-context';
4
4
  import { Identifier } from './identifier';
5
- export declare type SchemaTransformer = {
5
+ export type SchemaTransformer = {
6
6
  /**
7
7
  * determine whether to apply schema on given node.
8
8
  */
@@ -13,7 +13,7 @@ export declare type SchemaTransformer = {
13
13
  */
14
14
  transform(node: Node, context: SchemaExtractorContext): Promise<SchemaNode>;
15
15
  };
16
- export declare type SchemaNodeTransformer = {
16
+ export type SchemaNodeTransformer = {
17
17
  predicate(node: SchemaNode): boolean;
18
18
  transform(node: SchemaNode, context: SchemaExtractorContext): Promise<SchemaNode>;
19
19
  };
@@ -16,8 +16,7 @@ const exportTransformer = mapping => {
16
16
  return context => {
17
17
  const visit = node => {
18
18
  if (_typescript().default.isExportDeclaration(node)) {
19
- var _node$moduleSpecifier;
20
- let moduleSpecifier = (_node$moduleSpecifier = node.moduleSpecifier) === null || _node$moduleSpecifier === void 0 ? void 0 : _node$moduleSpecifier.getText().slice(1, -1);
19
+ let moduleSpecifier = node.moduleSpecifier?.getText().slice(1, -1);
21
20
  for (const [oldName, newName] of Object.entries(mapping)) {
22
21
  if (moduleSpecifier && moduleSpecifier.includes(oldName)) {
23
22
  moduleSpecifier = moduleSpecifier.replace(oldName, newName);