@teambit/typescript 0.0.965 → 0.0.967

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 (204) hide show
  1. package/dist/export-identifier.d.ts +5 -4
  2. package/dist/export-identifier.js +23 -4
  3. package/dist/export-identifier.js.map +1 -1
  4. package/dist/identifier-list.d.ts +7 -0
  5. package/dist/identifier-list.js +21 -0
  6. package/dist/identifier-list.js.map +1 -0
  7. package/dist/identifier.d.ts +9 -0
  8. package/dist/identifier.js +30 -0
  9. package/dist/identifier.js.map +1 -0
  10. package/dist/{preview-1674271762484.js → preview-1674617375675.js} +2 -2
  11. package/dist/schema-extractor-context.d.ts +40 -8
  12. package/dist/schema-extractor-context.js +243 -101
  13. package/dist/schema-extractor-context.js.map +1 -1
  14. package/dist/schema-transformer.d.ts +2 -2
  15. package/dist/schema-transformer.js.map +1 -1
  16. package/dist/transformers/array-type.d.ts +10 -0
  17. package/dist/transformers/array-type.js +38 -0
  18. package/dist/transformers/array-type.js.map +1 -0
  19. package/dist/transformers/binding-element.d.ts +2 -2
  20. package/dist/transformers/binding-element.js +7 -7
  21. package/dist/transformers/binding-element.js.map +1 -1
  22. package/dist/transformers/class-declaration.d.ts +2 -2
  23. package/dist/transformers/class-declaration.js +6 -20
  24. package/dist/transformers/class-declaration.js.map +1 -1
  25. package/dist/transformers/conditional-type.d.ts +10 -0
  26. package/dist/transformers/conditional-type.js +39 -0
  27. package/dist/transformers/conditional-type.js.map +1 -0
  28. package/dist/transformers/constructor.d.ts +10 -0
  29. package/dist/transformers/constructor.js +50 -0
  30. package/dist/transformers/constructor.js.map +1 -0
  31. package/dist/transformers/enum-declaration.d.ts +2 -2
  32. package/dist/transformers/enum-declaration.js +4 -4
  33. package/dist/transformers/enum-declaration.js.map +1 -1
  34. package/dist/transformers/{export-assignment-declaration.d.ts → export-assignment.d.ts} +7 -2
  35. package/dist/transformers/export-assignment.js +41 -0
  36. package/dist/transformers/export-assignment.js.map +1 -0
  37. package/dist/transformers/export-declaration.d.ts +2 -3
  38. package/dist/transformers/export-declaration.js +21 -10
  39. package/dist/transformers/export-declaration.js.map +1 -1
  40. package/dist/transformers/function-like.d.ts +11 -0
  41. package/dist/transformers/function-like.js +82 -0
  42. package/dist/transformers/function-like.js.map +1 -0
  43. package/dist/transformers/get-accessor.d.ts +10 -0
  44. package/dist/transformers/get-accessor.js +48 -0
  45. package/dist/transformers/get-accessor.js.map +1 -0
  46. package/dist/transformers/import-declaration.d.ts +10 -0
  47. package/dist/transformers/import-declaration.js +74 -0
  48. package/dist/transformers/import-declaration.js.map +1 -0
  49. package/dist/transformers/index-signature.d.ts +10 -0
  50. package/dist/transformers/index-signature.js +45 -0
  51. package/dist/transformers/index-signature.js.map +1 -0
  52. package/dist/transformers/index.d.ts +28 -3
  53. package/dist/transformers/index.js +337 -12
  54. package/dist/transformers/index.js.map +1 -1
  55. package/dist/transformers/indexed-access-type.d.ts +10 -0
  56. package/dist/transformers/indexed-access-type.js +37 -0
  57. package/dist/transformers/indexed-access-type.js.map +1 -0
  58. package/dist/transformers/interface-declaration.d.ts +2 -2
  59. package/dist/transformers/interface-declaration.js +6 -20
  60. package/dist/transformers/interface-declaration.js.map +1 -1
  61. package/dist/transformers/intersection-type.d.ts +10 -0
  62. package/dist/transformers/intersection-type.js +48 -0
  63. package/dist/transformers/intersection-type.js.map +1 -0
  64. package/dist/transformers/keyword-type.d.ts +13 -0
  65. package/dist/transformers/keyword-type.js +55 -0
  66. package/dist/transformers/keyword-type.js.map +1 -0
  67. package/dist/transformers/literal-type.d.ts +13 -0
  68. package/dist/transformers/literal-type.js +40 -0
  69. package/dist/transformers/literal-type.js.map +1 -0
  70. package/dist/transformers/named-tuple.d.ts +10 -0
  71. package/dist/transformers/named-tuple.js +38 -0
  72. package/dist/transformers/named-tuple.js.map +1 -0
  73. package/dist/transformers/parameter.d.ts +13 -0
  74. package/dist/transformers/parameter.js +112 -0
  75. package/dist/transformers/parameter.js.map +1 -0
  76. package/dist/transformers/parenthesized-type.d.ts +10 -0
  77. package/dist/transformers/parenthesized-type.js +36 -0
  78. package/dist/transformers/parenthesized-type.js.map +1 -0
  79. package/dist/transformers/property-declaration.d.ts +11 -0
  80. package/dist/transformers/property-declaration.js +57 -0
  81. package/dist/transformers/property-declaration.js.map +1 -0
  82. package/dist/transformers/set-accessor.d.ts +10 -0
  83. package/dist/transformers/set-accessor.js +45 -0
  84. package/dist/transformers/set-accessor.js.map +1 -0
  85. package/dist/transformers/source-file-transformer.d.ts +3 -2
  86. package/dist/transformers/source-file-transformer.js +44 -15
  87. package/dist/transformers/source-file-transformer.js.map +1 -1
  88. package/dist/transformers/template-literal-type-span.d.ts +10 -0
  89. package/dist/transformers/template-literal-type-span.js +37 -0
  90. package/dist/transformers/template-literal-type-span.js.map +1 -0
  91. package/dist/transformers/template-literal-type.d.ts +10 -0
  92. package/dist/transformers/template-literal-type.js +45 -0
  93. package/dist/transformers/template-literal-type.js.map +1 -0
  94. package/dist/transformers/this-type.d.ts +10 -0
  95. package/dist/transformers/this-type.js +35 -0
  96. package/dist/transformers/this-type.js.map +1 -0
  97. package/dist/transformers/tuple-type.d.ts +10 -0
  98. package/dist/transformers/tuple-type.js +47 -0
  99. package/dist/transformers/tuple-type.js.map +1 -0
  100. package/dist/transformers/type-alias.d.ts +2 -2
  101. package/dist/transformers/type-alias.js +5 -12
  102. package/dist/transformers/type-alias.js.map +1 -1
  103. package/dist/transformers/type-literal.d.ts +14 -0
  104. package/dist/transformers/type-literal.js +49 -0
  105. package/dist/transformers/type-literal.js.map +1 -0
  106. package/dist/transformers/type-operator.d.ts +14 -0
  107. package/dist/transformers/type-operator.js +52 -0
  108. package/dist/transformers/type-operator.js.map +1 -0
  109. package/dist/transformers/type-predicate.d.ts +10 -0
  110. package/dist/transformers/type-predicate.js +38 -0
  111. package/dist/transformers/type-predicate.js.map +1 -0
  112. package/dist/transformers/type-query.d.ts +13 -0
  113. package/dist/transformers/type-query.js +42 -0
  114. package/dist/transformers/type-query.js.map +1 -0
  115. package/dist/transformers/type-reference.d.ts +16 -0
  116. package/dist/transformers/type-reference.js +56 -0
  117. package/dist/transformers/type-reference.js.map +1 -0
  118. package/dist/transformers/union-type.d.ts +10 -0
  119. package/dist/transformers/union-type.js +48 -0
  120. package/dist/transformers/union-type.js.map +1 -0
  121. package/dist/transformers/utils/jsdoc-to-doc-schema.js +2 -10
  122. package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -1
  123. package/dist/transformers/variable-declaration.d.ts +2 -2
  124. package/dist/transformers/variable-declaration.js +11 -11
  125. package/dist/transformers/variable-declaration.js.map +1 -1
  126. package/dist/transformers/variable-statement.d.ts +2 -2
  127. package/dist/transformers/variable-statement.js +5 -5
  128. package/dist/transformers/variable-statement.js.map +1 -1
  129. package/dist/typescript.extractor.d.ts +10 -4
  130. package/dist/typescript.extractor.js +70 -17
  131. package/dist/typescript.extractor.js.map +1 -1
  132. package/dist/typescript.main.runtime.d.ts +4 -2
  133. package/dist/typescript.main.runtime.js +5 -11
  134. package/dist/typescript.main.runtime.js.map +1 -1
  135. package/package-tar/teambit-typescript-0.0.967.tgz +0 -0
  136. package/package.json +17 -17
  137. package/transformers/array-type.ts +21 -0
  138. package/transformers/binding-element.ts +2 -2
  139. package/transformers/class-declaration.ts +4 -6
  140. package/transformers/conditional-type.ts +23 -0
  141. package/transformers/constructor.ts +40 -0
  142. package/transformers/enum-declaration.ts +3 -3
  143. package/transformers/{export-assignment-declaration.ts → export-assignment.ts} +9 -3
  144. package/transformers/export-declaration.ts +35 -8
  145. package/transformers/function-like.ts +65 -0
  146. package/transformers/get-accessor.ts +24 -0
  147. package/transformers/import-declaration.ts +56 -0
  148. package/transformers/index-signature.ts +24 -0
  149. package/transformers/index.ts +28 -3
  150. package/transformers/indexed-access-type.ts +21 -0
  151. package/transformers/interface-declaration.ts +5 -7
  152. package/transformers/intersection-type.ts +25 -0
  153. package/transformers/keyword-type.ts +39 -0
  154. package/transformers/literal-type.ts +23 -0
  155. package/transformers/named-tuple.ts +22 -0
  156. package/transformers/parameter.ts +110 -0
  157. package/transformers/parenthesized-type.ts +20 -0
  158. package/transformers/property-declaration.ts +33 -0
  159. package/transformers/set-accessor.ts +25 -0
  160. package/transformers/source-file-transformer.ts +56 -24
  161. package/transformers/template-literal-type-span.ts +21 -0
  162. package/transformers/template-literal-type.ts +24 -0
  163. package/transformers/this-type.ts +19 -0
  164. package/transformers/tuple-type.ts +24 -0
  165. package/transformers/type-alias.ts +3 -4
  166. package/transformers/type-literal.ts +26 -0
  167. package/transformers/type-operator.ts +37 -0
  168. package/transformers/type-predicate.ts +22 -0
  169. package/transformers/type-query.ts +25 -0
  170. package/transformers/type-reference.ts +33 -0
  171. package/transformers/union-type.ts +25 -0
  172. package/transformers/utils/jsdoc-to-doc-schema.ts +2 -4
  173. package/transformers/variable-declaration.ts +7 -4
  174. package/transformers/variable-statement.ts +3 -3
  175. package/dist/export-list.d.ts +0 -6
  176. package/dist/export-list.js +0 -17
  177. package/dist/export-list.js.map +0 -1
  178. package/dist/transformers/export-assignment-declaration.js +0 -29
  179. package/dist/transformers/export-assignment-declaration.js.map +0 -1
  180. package/dist/transformers/function-declaration.d.ts +0 -11
  181. package/dist/transformers/function-declaration.js +0 -49
  182. package/dist/transformers/function-declaration.js.map +0 -1
  183. package/dist/transformers/utils/class-element-to-schema.d.ts +0 -4
  184. package/dist/transformers/utils/class-element-to-schema.js +0 -95
  185. package/dist/transformers/utils/class-element-to-schema.js.map +0 -1
  186. package/dist/transformers/utils/get-params.d.ts +0 -4
  187. package/dist/transformers/utils/get-params.js +0 -100
  188. package/dist/transformers/utils/get-params.js.map +0 -1
  189. package/dist/transformers/utils/to-function-like-schema.d.ts +0 -4
  190. package/dist/transformers/utils/to-function-like-schema.js +0 -58
  191. package/dist/transformers/utils/to-function-like-schema.js.map +0 -1
  192. package/dist/transformers/utils/type-element-to-schema.d.ts +0 -7
  193. package/dist/transformers/utils/type-element-to-schema.js +0 -106
  194. package/dist/transformers/utils/type-element-to-schema.js.map +0 -1
  195. package/dist/transformers/utils/type-node-to-schema.d.ts +0 -4
  196. package/dist/transformers/utils/type-node-to-schema.js +0 -274
  197. package/dist/transformers/utils/type-node-to-schema.js.map +0 -1
  198. package/package-tar/teambit-typescript-0.0.965.tgz +0 -0
  199. package/transformers/function-declaration.ts +0 -25
  200. package/transformers/utils/class-element-to-schema.ts +0 -64
  201. package/transformers/utils/get-params.ts +0 -92
  202. package/transformers/utils/to-function-like-schema.ts +0 -39
  203. package/transformers/utils/type-element-to-schema.ts +0 -79
  204. package/transformers/utils/type-node-to-schema.ts +0 -294
@@ -0,0 +1,10 @@
1
+ import { ArrayTypeNode, Node } from 'typescript';
2
+ import { TypeArraySchema } from '@teambit/semantics.entities.semantic-schema';
3
+ import { SchemaTransformer } from '../schema-transformer';
4
+ import { SchemaExtractorContext } from '../schema-extractor-context';
5
+ import { Identifier } from '../identifier';
6
+ export declare class ArrayTypeTransformer implements SchemaTransformer {
7
+ predicate(node: Node): boolean;
8
+ getIdentifiers(): Promise<Identifier[]>;
9
+ transform(node: ArrayTypeNode, context: SchemaExtractorContext): Promise<TypeArraySchema>;
10
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.promise.js");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ArrayTypeTransformer = void 0;
9
+ function _typescript() {
10
+ const data = _interopRequireDefault(require("typescript"));
11
+ _typescript = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ function _semanticsEntities() {
17
+ const data = require("@teambit/semantics.entities.semantic-schema");
18
+ _semanticsEntities = function () {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
23
+ class ArrayTypeTransformer {
24
+ predicate(node) {
25
+ return node.kind === _typescript().default.SyntaxKind.ArrayType;
26
+ }
27
+ async getIdentifiers() {
28
+ return [];
29
+ }
30
+ async transform(node, context) {
31
+ const type = await context.computeSchema(node.elementType);
32
+ const location = context.getLocation(node);
33
+ return new (_semanticsEntities().TypeArraySchema)(location, type);
34
+ }
35
+ }
36
+ exports.ArrayTypeTransformer = ArrayTypeTransformer;
37
+
38
+ //# sourceMappingURL=array-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ArrayTypeTransformer","predicate","node","kind","ts","SyntaxKind","ArrayType","getIdentifiers","transform","context","type","computeSchema","elementType","location","getLocation","TypeArraySchema"],"sources":["array-type.ts"],"sourcesContent":["import ts, { ArrayTypeNode, Node } from 'typescript';\nimport { TypeArraySchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ArrayTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ArrayType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ArrayTypeNode, context: SchemaExtractorContext) {\n const type = await context.computeSchema(node.elementType);\n const location = context.getLocation(node);\n return new TypeArraySchema(location, type);\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,oBAAoB,CAA8B;EAC7DC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,SAAS;EAC9C;EAEA,MAAMC,cAAc,GAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAAS,CAACN,IAAmB,EAAEO,OAA+B,EAAE;IACpE,MAAMC,IAAI,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACT,IAAI,CAACU,WAAW,CAAC;IAC1D,MAAMC,QAAQ,GAAGJ,OAAO,CAACK,WAAW,CAACZ,IAAI,CAAC;IAC1C,OAAO,KAAIa,oCAAe,EAACF,QAAQ,EAAEH,IAAI,CAAC;EAC5C;AACF;AAAC"}
@@ -2,7 +2,7 @@ import { BindingElement, Node } from 'typescript';
2
2
  import { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';
3
3
  import { SchemaTransformer } from '../schema-transformer';
4
4
  import { SchemaExtractorContext } from '../schema-extractor-context';
5
- import { ExportIdentifier } from '../export-identifier';
5
+ import { Identifier } from '../identifier';
6
6
  /**
7
7
  * for example:
8
8
  *
@@ -12,6 +12,6 @@ import { ExportIdentifier } from '../export-identifier';
12
12
  */
13
13
  export declare class BindingElementTransformer implements SchemaTransformer {
14
14
  predicate(node: Node): boolean;
15
- getIdentifiers(node: BindingElement): Promise<ExportIdentifier[]>;
15
+ getIdentifiers(node: BindingElement): Promise<Identifier[]>;
16
16
  transform(node: BindingElement, context: SchemaExtractorContext): Promise<VariableLikeSchema>;
17
17
  }
@@ -20,16 +20,16 @@ function _semanticsEntities() {
20
20
  };
21
21
  return data;
22
22
  }
23
- function _exportIdentifier() {
24
- const data = require("../export-identifier");
25
- _exportIdentifier = function () {
23
+ function _parseTypeFromQuickInfo() {
24
+ const data = require("./utils/parse-type-from-quick-info");
25
+ _parseTypeFromQuickInfo = function () {
26
26
  return data;
27
27
  };
28
28
  return data;
29
29
  }
30
- function _parseTypeFromQuickInfo() {
31
- const data = require("./utils/parse-type-from-quick-info");
32
- _parseTypeFromQuickInfo = function () {
30
+ function _identifier() {
31
+ const data = require("../identifier");
32
+ _identifier = function () {
33
33
  return data;
34
34
  };
35
35
  return data;
@@ -46,7 +46,7 @@ class BindingElementTransformer {
46
46
  return node.kind === _typescript().default.SyntaxKind.BindingElement;
47
47
  }
48
48
  async getIdentifiers(node) {
49
- return [new (_exportIdentifier().ExportIdentifier)(node.name.getText(), node.getSourceFile().fileName)];
49
+ return [new (_identifier().Identifier)(node.name.getText(), node.getSourceFile().fileName)];
50
50
  }
51
51
  async transform(node, context) {
52
52
  var _info$body;
@@ -1 +1 @@
1
- {"version":3,"names":["BindingElementTransformer","predicate","node","kind","ts","SyntaxKind","BindingElement","getIdentifiers","ExportIdentifier","name","getText","getSourceFile","fileName","transform","context","info","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","doc","jsDocToDocSchema","VariableLikeSchema","getLocation"],"sources":["binding-element.ts"],"sourcesContent":["import ts, { BindingElement, Node } from 'typescript';\nimport { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { ExportIdentifier } from '../export-identifier';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\n\n/**\n * for example:\n *\n * const objBindingElem = { elem1: 1, elem2: 2 };\n * const { elem1 } = objBindingElem;\n * export { elem1 };\n */\nexport class BindingElementTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.BindingElement;\n }\n\n async getIdentifiers(node: BindingElement) {\n return [new ExportIdentifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(node: BindingElement, context: SchemaExtractorContext) {\n const name = node.name.getText();\n const info = await context.getQuickInfo(node.name);\n const displaySig = info?.body?.displayString || '';\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(node, typeStr);\n const doc = await context.jsDocToDocSchema(node);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, false, doc);\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,yBAAyB,CAA8B;EAClEC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,cAAc;EACnD;EAEA,MAAMC,cAAc,CAACL,IAAoB,EAAE;IACzC,OAAO,CAAC,KAAIM,oCAAgB,EAACN,IAAI,CAACO,IAAI,CAACC,OAAO,EAAE,EAAER,IAAI,CAACS,aAAa,EAAE,CAACC,QAAQ,CAAC,CAAC;EACnF;EAEA,MAAMC,SAAS,CAACX,IAAoB,EAAEY,OAA+B,EAAE;IAAA;IACrE,MAAML,IAAI,GAAGP,IAAI,CAACO,IAAI,CAACC,OAAO,EAAE;IAChC,MAAMK,IAAI,GAAG,MAAMD,OAAO,CAACE,YAAY,CAACd,IAAI,CAACO,IAAI,CAAC;IAClD,MAAMQ,UAAU,GAAG,CAAAF,IAAI,aAAJA,IAAI,qCAAJA,IAAI,CAAEG,IAAI,+CAAV,WAAYC,aAAa,KAAI,EAAE;IAClD,MAAMC,OAAO,GAAG,IAAAC,gDAAsB,EAACN,IAAI,CAAC;IAC5C,MAAMO,IAAI,GAAG,MAAMR,OAAO,CAACS,WAAW,CAACrB,IAAI,EAAEkB,OAAO,CAAC;IACrD,MAAMI,GAAG,GAAG,MAAMV,OAAO,CAACW,gBAAgB,CAACvB,IAAI,CAAC;IAChD,OAAO,KAAIwB,uCAAkB,EAACZ,OAAO,CAACa,WAAW,CAACzB,IAAI,CAAC,EAAEO,IAAI,EAAEQ,UAAU,EAAEK,IAAI,EAAE,KAAK,EAAEE,GAAG,CAAC;EAC9F;AACF;AAAC"}
1
+ {"version":3,"names":["BindingElementTransformer","predicate","node","kind","ts","SyntaxKind","BindingElement","getIdentifiers","Identifier","name","getText","getSourceFile","fileName","transform","context","info","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","doc","jsDocToDocSchema","VariableLikeSchema","getLocation"],"sources":["binding-element.ts"],"sourcesContent":["import ts, { BindingElement, Node } from 'typescript';\nimport { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport { Identifier } from '../identifier';\n\n/**\n * for example:\n *\n * const objBindingElem = { elem1: 1, elem2: 2 };\n * const { elem1 } = objBindingElem;\n * export { elem1 };\n */\nexport class BindingElementTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.BindingElement;\n }\n\n async getIdentifiers(node: BindingElement) {\n return [new Identifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(node: BindingElement, context: SchemaExtractorContext) {\n const name = node.name.getText();\n const info = await context.getQuickInfo(node.name);\n const displaySig = info?.body?.displayString || '';\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(node, typeStr);\n const doc = await context.jsDocToDocSchema(node);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, false, doc);\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,yBAAyB,CAA8B;EAClEC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,cAAc;EACnD;EAEA,MAAMC,cAAc,CAACL,IAAoB,EAAE;IACzC,OAAO,CAAC,KAAIM,wBAAU,EAACN,IAAI,CAACO,IAAI,CAACC,OAAO,EAAE,EAAER,IAAI,CAACS,aAAa,EAAE,CAACC,QAAQ,CAAC,CAAC;EAC7E;EAEA,MAAMC,SAAS,CAACX,IAAoB,EAAEY,OAA+B,EAAE;IAAA;IACrE,MAAML,IAAI,GAAGP,IAAI,CAACO,IAAI,CAACC,OAAO,EAAE;IAChC,MAAMK,IAAI,GAAG,MAAMD,OAAO,CAACE,YAAY,CAACd,IAAI,CAACO,IAAI,CAAC;IAClD,MAAMQ,UAAU,GAAG,CAAAF,IAAI,aAAJA,IAAI,qCAAJA,IAAI,CAAEG,IAAI,+CAAV,WAAYC,aAAa,KAAI,EAAE;IAClD,MAAMC,OAAO,GAAG,IAAAC,gDAAsB,EAACN,IAAI,CAAC;IAC5C,MAAMO,IAAI,GAAG,MAAMR,OAAO,CAACS,WAAW,CAACrB,IAAI,EAAEkB,OAAO,CAAC;IACrD,MAAMI,GAAG,GAAG,MAAMV,OAAO,CAACW,gBAAgB,CAACvB,IAAI,CAAC;IAChD,OAAO,KAAIwB,uCAAkB,EAACZ,OAAO,CAACa,WAAW,CAACzB,IAAI,CAAC,EAAEO,IAAI,EAAEQ,UAAU,EAAEK,IAAI,EAAE,KAAK,EAAEE,GAAG,CAAC;EAC9F;AACF;AAAC"}
@@ -2,11 +2,11 @@ import { ClassSchema } from '@teambit/semantics.entities.semantic-schema';
2
2
  import { Node, ClassDeclaration } from 'typescript';
3
3
  import { SchemaTransformer } from '../schema-transformer';
4
4
  import { SchemaExtractorContext } from '../schema-extractor-context';
5
- import { ExportIdentifier } from '../export-identifier';
5
+ import { Identifier } from '../identifier';
6
6
  export declare class ClassDeclarationTransformer implements SchemaTransformer {
7
7
  predicate(node: Node): boolean;
8
8
  private getName;
9
- getIdentifiers(node: ClassDeclaration): Promise<ExportIdentifier[]>;
9
+ getIdentifiers(node: ClassDeclaration): Promise<Identifier[]>;
10
10
  private getExpressionWithTypeArgs;
11
11
  transform(node: ClassDeclaration, context: SchemaExtractorContext): Promise<ClassSchema>;
12
12
  }
@@ -43,23 +43,9 @@ function _typescript() {
43
43
  };
44
44
  return data;
45
45
  }
46
- function _exportIdentifier() {
47
- const data = require("../export-identifier");
48
- _exportIdentifier = function () {
49
- return data;
50
- };
51
- return data;
52
- }
53
- function _classElementToSchema() {
54
- const data = require("./utils/class-element-to-schema");
55
- _classElementToSchema = function () {
56
- return data;
57
- };
58
- return data;
59
- }
60
- function _typeNodeToSchema() {
61
- const data = require("./utils/type-node-to-schema");
62
- _typeNodeToSchema = function () {
46
+ function _identifier() {
47
+ const data = require("../identifier");
48
+ _identifier = function () {
63
49
  return data;
64
50
  };
65
51
  return data;
@@ -77,7 +63,7 @@ class ClassDeclarationTransformer {
77
63
  return ((_node$name = node.name) === null || _node$name === void 0 ? void 0 : _node$name.getText()) || 'default';
78
64
  }
79
65
  async getIdentifiers(node) {
80
- return [new (_exportIdentifier().ExportIdentifier)(this.getName(node), node.getSourceFile().fileName)];
66
+ return [new (_identifier().Identifier)(this.getName(node), node.getSourceFile().fileName)];
81
67
  }
82
68
  async getExpressionWithTypeArgs(node, context, token) {
83
69
  if (!node.heritageClauses) return [];
@@ -95,7 +81,7 @@ class ClassDeclarationTransformer {
95
81
  expression,
96
82
  name
97
83
  } = expressionWithTypeArgs;
98
- const typeArgsNodes = typeArguments ? await (0, _pMapSeries().default)(typeArguments, t => (0, _typeNodeToSchema().typeNodeToSchema)(t, context)) : [];
84
+ const typeArgsNodes = typeArguments ? await (0, _pMapSeries().default)(typeArguments, t => context.computeSchema(t)) : [];
99
85
  const location = context.getLocation(expression);
100
86
  const expressionNode = (await context.visitDefinition(expression)) || new (_semanticsEntities().UnresolvedSchema)(location, expression.getText());
101
87
  return new (_semanticsEntities().ExpressionWithTypeArgumentsSchema)(typeArgsNodes, expressionNode, name, location);
@@ -116,7 +102,7 @@ class ClassDeclarationTransformer {
116
102
  if (isPrivate) {
117
103
  return null;
118
104
  }
119
- return (0, _classElementToSchema().classElementToSchema)(member, context);
105
+ return context.computeSchema(member);
120
106
  });
121
107
  const doc = await context.jsDocToDocSchema(node);
122
108
  if (!signature) {
@@ -1 +1 @@
1
- {"version":3,"names":["ClassDeclarationTransformer","predicate","node","kind","ts","SyntaxKind","ClassDeclaration","getName","name","getText","getIdentifiers","ExportIdentifier","getSourceFile","fileName","getExpressionWithTypeArgs","context","token","heritageClauses","pMapSeries","filter","heritageClause","flatMap","h","types","map","type","expressionWithTypeArgs","typeArguments","expression","typeArgsNodes","t","typeNodeToSchema","location","getLocation","expressionNode","visitDefinition","UnresolvedSchema","ExpressionWithTypeArgumentsSchema","transform","className","extendsExpressionsWithTypeArgs","ExtendsKeyword","implementsExpressionsWithTypeArgs","ImplementsKeyword","typeParameters","typeParam","signature","getQuickInfoDisplayString","undefined","members","member","isPrivate","modifiers","some","modifier","PrivateKeyword","classElementToSchema","doc","jsDocToDocSchema","Error","ClassSchema","compact"],"sources":["class-declaration.ts"],"sourcesContent":["import pMapSeries from 'p-map-series';\nimport { compact } from 'lodash';\nimport {\n ClassSchema,\n UnresolvedSchema,\n ExpressionWithTypeArgumentsSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, ClassDeclaration } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { ExportIdentifier } from '../export-identifier';\nimport { classElementToSchema } from './utils/class-element-to-schema';\nimport { typeNodeToSchema } from './utils/type-node-to-schema';\n\nexport class ClassDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ClassDeclaration;\n }\n\n // @todo: in case of `export default class` the class has no name.\n private getName(node: ClassDeclaration) {\n return node.name?.getText() || 'default';\n }\n\n async getIdentifiers(node: ClassDeclaration) {\n return [new ExportIdentifier(this.getName(node), node.getSourceFile().fileName)];\n }\n\n private async getExpressionWithTypeArgs(\n node: ClassDeclaration,\n context: SchemaExtractorContext,\n token: ts.SyntaxKind.ExtendsKeyword | ts.SyntaxKind.ImplementsKeyword\n ) {\n if (!node.heritageClauses) return [];\n\n return pMapSeries(\n node.heritageClauses\n .filter((heritageClause: ts.HeritageClause) => heritageClause.token === token)\n .flatMap((h: ts.HeritageClause) => {\n const { types } = h;\n const name = h.getText();\n return types.map((type) => ({ ...type, name }));\n }),\n async (expressionWithTypeArgs: ts.ExpressionWithTypeArguments & { name: string }) => {\n const { typeArguments, expression, name } = expressionWithTypeArgs;\n const typeArgsNodes = typeArguments ? await pMapSeries(typeArguments, (t) => typeNodeToSchema(t, context)) : [];\n const location = context.getLocation(expression);\n const expressionNode =\n (await context.visitDefinition(expression)) || new UnresolvedSchema(location, expression.getText());\n return new ExpressionWithTypeArgumentsSchema(typeArgsNodes, expressionNode, name, location);\n }\n );\n }\n\n async transform(node: ClassDeclaration, context: SchemaExtractorContext) {\n const className = this.getName(node);\n const extendsExpressionsWithTypeArgs = await this.getExpressionWithTypeArgs(\n node,\n context,\n ts.SyntaxKind.ExtendsKeyword\n );\n\n const implementsExpressionsWithTypeArgs = await this.getExpressionWithTypeArgs(\n node,\n context,\n ts.SyntaxKind.ImplementsKeyword\n );\n\n const typeParameters = node.typeParameters?.map((typeParam) => {\n return typeParam.name.getText();\n });\n const signature = node.name ? await context.getQuickInfoDisplayString(node.name) : undefined;\n const members = await pMapSeries(node.members, async (member) => {\n const isPrivate = member.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword);\n if (isPrivate) {\n return null;\n }\n return classElementToSchema(member, context);\n });\n const doc = await context.jsDocToDocSchema(node);\n\n if (!signature) {\n throw Error(`Missing signature for class ${className} declaration`);\n }\n\n return new ClassSchema(\n className,\n compact(members),\n context.getLocation(node),\n signature,\n doc,\n typeParameters,\n extendsExpressionsWithTypeArgs,\n implementsExpressionsWithTypeArgs\n );\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"names":["ClassDeclarationTransformer","predicate","node","kind","ts","SyntaxKind","ClassDeclaration","getName","name","getText","getIdentifiers","Identifier","getSourceFile","fileName","getExpressionWithTypeArgs","context","token","heritageClauses","pMapSeries","filter","heritageClause","flatMap","h","types","map","type","expressionWithTypeArgs","typeArguments","expression","typeArgsNodes","t","computeSchema","location","getLocation","expressionNode","visitDefinition","UnresolvedSchema","ExpressionWithTypeArgumentsSchema","transform","className","extendsExpressionsWithTypeArgs","ExtendsKeyword","implementsExpressionsWithTypeArgs","ImplementsKeyword","typeParameters","typeParam","signature","getQuickInfoDisplayString","undefined","members","member","isPrivate","modifiers","some","modifier","PrivateKeyword","doc","jsDocToDocSchema","Error","ClassSchema","compact"],"sources":["class-declaration.ts"],"sourcesContent":["import pMapSeries from 'p-map-series';\nimport { compact } from 'lodash';\nimport {\n ClassSchema,\n UnresolvedSchema,\n ExpressionWithTypeArgumentsSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, ClassDeclaration } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ClassDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ClassDeclaration;\n }\n\n // @todo: in case of `export default class` the class has no name.\n private getName(node: ClassDeclaration) {\n return node.name?.getText() || 'default';\n }\n\n async getIdentifiers(node: ClassDeclaration) {\n return [new Identifier(this.getName(node), node.getSourceFile().fileName)];\n }\n\n private async getExpressionWithTypeArgs(\n node: ClassDeclaration,\n context: SchemaExtractorContext,\n token: ts.SyntaxKind.ExtendsKeyword | ts.SyntaxKind.ImplementsKeyword\n ) {\n if (!node.heritageClauses) return [];\n\n return pMapSeries(\n node.heritageClauses\n .filter((heritageClause: ts.HeritageClause) => heritageClause.token === token)\n .flatMap((h: ts.HeritageClause) => {\n const { types } = h;\n const name = h.getText();\n return types.map((type) => ({ ...type, name }));\n }),\n async (expressionWithTypeArgs: ts.ExpressionWithTypeArguments & { name: string }) => {\n const { typeArguments, expression, name } = expressionWithTypeArgs;\n const typeArgsNodes = typeArguments ? await pMapSeries(typeArguments, (t) => context.computeSchema(t)) : [];\n const location = context.getLocation(expression);\n const expressionNode =\n (await context.visitDefinition(expression)) || new UnresolvedSchema(location, expression.getText());\n return new ExpressionWithTypeArgumentsSchema(typeArgsNodes, expressionNode, name, location);\n }\n );\n }\n\n async transform(node: ClassDeclaration, context: SchemaExtractorContext) {\n const className = this.getName(node);\n const extendsExpressionsWithTypeArgs = await this.getExpressionWithTypeArgs(\n node,\n context,\n ts.SyntaxKind.ExtendsKeyword\n );\n\n const implementsExpressionsWithTypeArgs = await this.getExpressionWithTypeArgs(\n node,\n context,\n ts.SyntaxKind.ImplementsKeyword\n );\n\n const typeParameters = node.typeParameters?.map((typeParam) => {\n return typeParam.name.getText();\n });\n const signature = node.name ? await context.getQuickInfoDisplayString(node.name) : undefined;\n const members = await pMapSeries(node.members, async (member) => {\n const isPrivate = member.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword);\n if (isPrivate) {\n return null;\n }\n return context.computeSchema(member);\n });\n const doc = await context.jsDocToDocSchema(node);\n\n if (!signature) {\n throw Error(`Missing signature for class ${className} declaration`);\n }\n\n return new ClassSchema(\n className,\n compact(members),\n context.getLocation(node),\n signature,\n doc,\n typeParameters,\n extendsExpressionsWithTypeArgs,\n implementsExpressionsWithTypeArgs\n );\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ import { Node, ConditionalTypeNode } from 'typescript';
2
+ import { ConditionalTypeSchema } from '@teambit/semantics.entities.semantic-schema';
3
+ import { SchemaTransformer } from '../schema-transformer';
4
+ import { SchemaExtractorContext } from '../schema-extractor-context';
5
+ import { Identifier } from '../identifier';
6
+ export declare class ConditionalTypeTransformer implements SchemaTransformer {
7
+ predicate(node: Node): boolean;
8
+ getIdentifiers(): Promise<Identifier[]>;
9
+ transform(node: ConditionalTypeNode, context: SchemaExtractorContext): Promise<ConditionalTypeSchema>;
10
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.promise.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ConditionalTypeTransformer = void 0;
8
+ function _typescript() {
9
+ const data = require("typescript");
10
+ _typescript = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ function _semanticsEntities() {
16
+ const data = require("@teambit/semantics.entities.semantic-schema");
17
+ _semanticsEntities = function () {
18
+ return data;
19
+ };
20
+ return data;
21
+ }
22
+ class ConditionalTypeTransformer {
23
+ predicate(node) {
24
+ return node.kind === _typescript().SyntaxKind.ConditionalType;
25
+ }
26
+ async getIdentifiers() {
27
+ return [];
28
+ }
29
+ async transform(node, context) {
30
+ const checkType = await context.computeSchema(node.checkType);
31
+ const extendsType = await context.computeSchema(node.extendsType);
32
+ const trueType = await context.computeSchema(node.trueType);
33
+ const falseType = await context.computeSchema(node.falseType);
34
+ return new (_semanticsEntities().ConditionalTypeSchema)(context.getLocation(node), checkType, extendsType, trueType, falseType);
35
+ }
36
+ }
37
+ exports.ConditionalTypeTransformer = ConditionalTypeTransformer;
38
+
39
+ //# sourceMappingURL=conditional-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ConditionalTypeTransformer","predicate","node","kind","SyntaxKind","ConditionalType","getIdentifiers","transform","context","checkType","computeSchema","extendsType","trueType","falseType","ConditionalTypeSchema","getLocation"],"sources":["conditional-type.ts"],"sourcesContent":["import { Node, SyntaxKind, ConditionalTypeNode } from 'typescript';\nimport { ConditionalTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ConditionalTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ConditionalType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ConditionalTypeNode, context: SchemaExtractorContext) {\n const checkType = await context.computeSchema(node.checkType);\n const extendsType = await context.computeSchema(node.extendsType);\n const trueType = await context.computeSchema(node.trueType);\n const falseType = await context.computeSchema(node.falseType);\n return new ConditionalTypeSchema(context.getLocation(node), checkType, extendsType, trueType, falseType);\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,0BAA0B,CAA8B;EACnEC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,eAAe;EACjD;EAEA,MAAMC,cAAc,GAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAAS,CAACL,IAAyB,EAAEM,OAA+B,EAAE;IAC1E,MAAMC,SAAS,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACR,IAAI,CAACO,SAAS,CAAC;IAC7D,MAAME,WAAW,GAAG,MAAMH,OAAO,CAACE,aAAa,CAACR,IAAI,CAACS,WAAW,CAAC;IACjE,MAAMC,QAAQ,GAAG,MAAMJ,OAAO,CAACE,aAAa,CAACR,IAAI,CAACU,QAAQ,CAAC;IAC3D,MAAMC,SAAS,GAAG,MAAML,OAAO,CAACE,aAAa,CAACR,IAAI,CAACW,SAAS,CAAC;IAC7D,OAAO,KAAIC,0CAAqB,EAACN,OAAO,CAACO,WAAW,CAACb,IAAI,CAAC,EAAEO,SAAS,EAAEE,WAAW,EAAEC,QAAQ,EAAEC,SAAS,CAAC;EAC1G;AACF;AAAC"}
@@ -0,0 +1,10 @@
1
+ import { Node, ConstructorDeclaration } from 'typescript';
2
+ import { ConstructorSchema } from '@teambit/semantics.entities.semantic-schema';
3
+ import { SchemaTransformer } from '../schema-transformer';
4
+ import { SchemaExtractorContext } from '../schema-extractor-context';
5
+ import { Identifier } from '../identifier';
6
+ export declare class ConstructorTransformer implements SchemaTransformer {
7
+ predicate(node: Node): boolean;
8
+ getIdentifiers(): Promise<Identifier[]>;
9
+ transform(node: ConstructorDeclaration, context: SchemaExtractorContext): Promise<ConstructorSchema>;
10
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ require("core-js/modules/es.promise.js");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ConstructorTransformer = void 0;
9
+ function _typescript() {
10
+ const data = _interopRequireDefault(require("typescript"));
11
+ _typescript = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ function _semanticsEntities() {
17
+ const data = require("@teambit/semantics.entities.semantic-schema");
18
+ _semanticsEntities = function () {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
23
+ function _pMapSeries() {
24
+ const data = _interopRequireDefault(require("p-map-series"));
25
+ _pMapSeries = function () {
26
+ return data;
27
+ };
28
+ return data;
29
+ }
30
+ class ConstructorTransformer {
31
+ predicate(node) {
32
+ return node.kind === _typescript().default.SyntaxKind.Constructor;
33
+ }
34
+ async getIdentifiers() {
35
+ return [];
36
+ }
37
+ async transform(node, context) {
38
+ var _info$body, _node$modifiers;
39
+ const args = await (0, _pMapSeries().default)(node.parameters, async param => context.computeSchema(param));
40
+ const info = await context.getQuickInfo(node);
41
+ const displaySig = (info === null || info === void 0 ? void 0 : (_info$body = info.body) === null || _info$body === void 0 ? void 0 : _info$body.displayString) || '';
42
+ const returns = new (_semanticsEntities().ThisTypeSchema)(context.getLocation(node.parent));
43
+ const modifiers = ((_node$modifiers = node.modifiers) === null || _node$modifiers === void 0 ? void 0 : _node$modifiers.map(modifier => modifier.getText())) || [];
44
+ const doc = await context.jsDocToDocSchema(node);
45
+ return new (_semanticsEntities().ConstructorSchema)(context.getLocation(node), args, returns, displaySig, modifiers, doc);
46
+ }
47
+ }
48
+ exports.ConstructorTransformer = ConstructorTransformer;
49
+
50
+ //# sourceMappingURL=constructor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ConstructorTransformer","predicate","node","kind","ts","SyntaxKind","Constructor","getIdentifiers","transform","context","args","pMapSeries","parameters","param","computeSchema","info","getQuickInfo","displaySig","body","displayString","returns","ThisTypeSchema","getLocation","parent","modifiers","map","modifier","getText","doc","jsDocToDocSchema","ConstructorSchema"],"sources":["constructor.ts"],"sourcesContent":["import ts, { Node, ConstructorDeclaration } from 'typescript';\nimport {\n ConstructorSchema,\n ParameterSchema,\n ThisTypeSchema,\n Modifier,\n} from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ConstructorTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.Constructor;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ConstructorDeclaration, context: SchemaExtractorContext) {\n const args = await pMapSeries(node.parameters, async (param) => context.computeSchema(param));\n const info = await context.getQuickInfo(node);\n const displaySig = info?.body?.displayString || '';\n\n const returns = new ThisTypeSchema(context.getLocation(node.parent));\n const modifiers = node.modifiers?.map((modifier) => modifier.getText()) || [];\n const doc = await context.jsDocToDocSchema(node);\n\n return new ConstructorSchema(\n context.getLocation(node),\n args as ParameterSchema[],\n returns,\n displaySig,\n modifiers as Modifier[],\n doc\n );\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,sBAAsB,CAA8B;EAC/DC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,WAAW;EAChD;EAEA,MAAMC,cAAc,GAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAAS,CAACN,IAA4B,EAAEO,OAA+B,EAAE;IAAA;IAC7E,MAAMC,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAACT,IAAI,CAACU,UAAU,EAAE,MAAOC,KAAK,IAAKJ,OAAO,CAACK,aAAa,CAACD,KAAK,CAAC,CAAC;IAC7F,MAAME,IAAI,GAAG,MAAMN,OAAO,CAACO,YAAY,CAACd,IAAI,CAAC;IAC7C,MAAMe,UAAU,GAAG,CAAAF,IAAI,aAAJA,IAAI,qCAAJA,IAAI,CAAEG,IAAI,+CAAV,WAAYC,aAAa,KAAI,EAAE;IAElD,MAAMC,OAAO,GAAG,KAAIC,mCAAc,EAACZ,OAAO,CAACa,WAAW,CAACpB,IAAI,CAACqB,MAAM,CAAC,CAAC;IACpE,MAAMC,SAAS,GAAG,oBAAAtB,IAAI,CAACsB,SAAS,oDAAd,gBAAgBC,GAAG,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,OAAO,EAAE,CAAC,KAAI,EAAE;IAC7E,MAAMC,GAAG,GAAG,MAAMnB,OAAO,CAACoB,gBAAgB,CAAC3B,IAAI,CAAC;IAEhD,OAAO,KAAI4B,sCAAiB,EAC1BrB,OAAO,CAACa,WAAW,CAACpB,IAAI,CAAC,EACzBQ,IAAI,EACJU,OAAO,EACPH,UAAU,EACVO,SAAS,EACTI,GAAG,CACJ;EACH;AACF;AAAC"}
@@ -2,9 +2,9 @@ import { Node, EnumDeclaration } from 'typescript';
2
2
  import { EnumSchema } from '@teambit/semantics.entities.semantic-schema';
3
3
  import { SchemaTransformer } from '../schema-transformer';
4
4
  import { SchemaExtractorContext } from '../schema-extractor-context';
5
- import { ExportIdentifier } from '../export-identifier';
5
+ import { Identifier } from '../identifier';
6
6
  export declare class EnumDeclarationTransformer implements SchemaTransformer {
7
7
  predicate(node: Node): boolean;
8
- getIdentifiers(node: EnumDeclaration): Promise<ExportIdentifier[]>;
8
+ getIdentifiers(node: EnumDeclaration): Promise<Identifier[]>;
9
9
  transform(enumDec: EnumDeclaration, context: SchemaExtractorContext): Promise<EnumSchema>;
10
10
  }
@@ -27,9 +27,9 @@ function _pMapSeries() {
27
27
  };
28
28
  return data;
29
29
  }
30
- function _exportIdentifier() {
31
- const data = require("../export-identifier");
32
- _exportIdentifier = function () {
30
+ function _identifier() {
31
+ const data = require("../identifier");
32
+ _identifier = function () {
33
33
  return data;
34
34
  };
35
35
  return data;
@@ -39,7 +39,7 @@ class EnumDeclarationTransformer {
39
39
  return node.kind === _typescript().default.SyntaxKind.EnumDeclaration;
40
40
  }
41
41
  async getIdentifiers(node) {
42
- return [new (_exportIdentifier().ExportIdentifier)(node.name.getText(), node.getSourceFile().fileName)];
42
+ return [new (_identifier().Identifier)(node.name.getText(), node.getSourceFile().fileName)];
43
43
  }
44
44
  async transform(enumDec, context) {
45
45
  const name = enumDec.name.getText();
@@ -1 +1 @@
1
- {"version":3,"names":["EnumDeclarationTransformer","predicate","node","kind","ts","SyntaxKind","EnumDeclaration","getIdentifiers","ExportIdentifier","name","getText","getSourceFile","fileName","transform","enumDec","context","members","pMapSeries","member","memberName","memberSignature","getQuickInfoDisplayString","memberDoc","jsDocToDocSchema","memberLocation","getLocation","memberValue","initializer","EnumMemberSchema","signature","doc","EnumSchema"],"sources":["enum-declaration.ts"],"sourcesContent":["import ts, { Node, EnumDeclaration } from 'typescript';\nimport { EnumMemberSchema, EnumSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { ExportIdentifier } from '../export-identifier';\n\nexport class EnumDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.EnumDeclaration;\n }\n\n async getIdentifiers(node: EnumDeclaration): Promise<ExportIdentifier[]> {\n return [new ExportIdentifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(enumDec: EnumDeclaration, context: SchemaExtractorContext) {\n const name = enumDec.name.getText();\n const members = await pMapSeries(enumDec.members, async (member) => {\n const memberName = member.name.getText();\n const memberSignature = await context.getQuickInfoDisplayString(member);\n const memberDoc = await context.jsDocToDocSchema(member);\n const memberLocation = await context.getLocation(member);\n const memberValue = member.initializer?.getText();\n return new EnumMemberSchema(memberLocation, memberName, memberSignature, memberValue, memberDoc);\n });\n const signature = await context.getQuickInfoDisplayString(enumDec.name);\n const doc = await context.jsDocToDocSchema(enumDec);\n return new EnumSchema(context.getLocation(enumDec), name, members, signature, doc);\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,0BAA0B,CAA8B;EACnEC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,eAAe;EACpD;EAEA,MAAMC,cAAc,CAACL,IAAqB,EAA+B;IACvE,OAAO,CAAC,KAAIM,oCAAgB,EAACN,IAAI,CAACO,IAAI,CAACC,OAAO,EAAE,EAAER,IAAI,CAACS,aAAa,EAAE,CAACC,QAAQ,CAAC,CAAC;EACnF;EAEA,MAAMC,SAAS,CAACC,OAAwB,EAAEC,OAA+B,EAAE;IACzE,MAAMN,IAAI,GAAGK,OAAO,CAACL,IAAI,CAACC,OAAO,EAAE;IACnC,MAAMM,OAAO,GAAG,MAAM,IAAAC,qBAAU,EAACH,OAAO,CAACE,OAAO,EAAE,MAAOE,MAAM,IAAK;MAAA;MAClE,MAAMC,UAAU,GAAGD,MAAM,CAACT,IAAI,CAACC,OAAO,EAAE;MACxC,MAAMU,eAAe,GAAG,MAAML,OAAO,CAACM,yBAAyB,CAACH,MAAM,CAAC;MACvE,MAAMI,SAAS,GAAG,MAAMP,OAAO,CAACQ,gBAAgB,CAACL,MAAM,CAAC;MACxD,MAAMM,cAAc,GAAG,MAAMT,OAAO,CAACU,WAAW,CAACP,MAAM,CAAC;MACxD,MAAMQ,WAAW,0BAAGR,MAAM,CAACS,WAAW,wDAAlB,oBAAoBjB,OAAO,EAAE;MACjD,OAAO,KAAIkB,qCAAgB,EAACJ,cAAc,EAAEL,UAAU,EAAEC,eAAe,EAAEM,WAAW,EAAEJ,SAAS,CAAC;IAClG,CAAC,CAAC;IACF,MAAMO,SAAS,GAAG,MAAMd,OAAO,CAACM,yBAAyB,CAACP,OAAO,CAACL,IAAI,CAAC;IACvE,MAAMqB,GAAG,GAAG,MAAMf,OAAO,CAACQ,gBAAgB,CAACT,OAAO,CAAC;IACnD,OAAO,KAAIiB,+BAAU,EAAChB,OAAO,CAACU,WAAW,CAACX,OAAO,CAAC,EAAEL,IAAI,EAAEO,OAAO,EAAEa,SAAS,EAAEC,GAAG,CAAC;EACpF;AACF;AAAC"}
1
+ {"version":3,"names":["EnumDeclarationTransformer","predicate","node","kind","ts","SyntaxKind","EnumDeclaration","getIdentifiers","Identifier","name","getText","getSourceFile","fileName","transform","enumDec","context","members","pMapSeries","member","memberName","memberSignature","getQuickInfoDisplayString","memberDoc","jsDocToDocSchema","memberLocation","getLocation","memberValue","initializer","EnumMemberSchema","signature","doc","EnumSchema"],"sources":["enum-declaration.ts"],"sourcesContent":["import ts, { Node, EnumDeclaration } from 'typescript';\nimport { EnumMemberSchema, EnumSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class EnumDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.EnumDeclaration;\n }\n\n async getIdentifiers(node: EnumDeclaration): Promise<Identifier[]> {\n return [new Identifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(enumDec: EnumDeclaration, context: SchemaExtractorContext) {\n const name = enumDec.name.getText();\n const members = await pMapSeries(enumDec.members, async (member) => {\n const memberName = member.name.getText();\n const memberSignature = await context.getQuickInfoDisplayString(member);\n const memberDoc = await context.jsDocToDocSchema(member);\n const memberLocation = await context.getLocation(member);\n const memberValue = member.initializer?.getText();\n return new EnumMemberSchema(memberLocation, memberName, memberSignature, memberValue, memberDoc);\n });\n const signature = await context.getQuickInfoDisplayString(enumDec.name);\n const doc = await context.jsDocToDocSchema(enumDec);\n return new EnumSchema(context.getLocation(enumDec), name, members, signature, doc);\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,0BAA0B,CAA8B;EACnEC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,eAAe;EACpD;EAEA,MAAMC,cAAc,CAACL,IAAqB,EAAyB;IACjE,OAAO,CAAC,KAAIM,wBAAU,EAACN,IAAI,CAACO,IAAI,CAACC,OAAO,EAAE,EAAER,IAAI,CAACS,aAAa,EAAE,CAACC,QAAQ,CAAC,CAAC;EAC7E;EAEA,MAAMC,SAAS,CAACC,OAAwB,EAAEC,OAA+B,EAAE;IACzE,MAAMN,IAAI,GAAGK,OAAO,CAACL,IAAI,CAACC,OAAO,EAAE;IACnC,MAAMM,OAAO,GAAG,MAAM,IAAAC,qBAAU,EAACH,OAAO,CAACE,OAAO,EAAE,MAAOE,MAAM,IAAK;MAAA;MAClE,MAAMC,UAAU,GAAGD,MAAM,CAACT,IAAI,CAACC,OAAO,EAAE;MACxC,MAAMU,eAAe,GAAG,MAAML,OAAO,CAACM,yBAAyB,CAACH,MAAM,CAAC;MACvE,MAAMI,SAAS,GAAG,MAAMP,OAAO,CAACQ,gBAAgB,CAACL,MAAM,CAAC;MACxD,MAAMM,cAAc,GAAG,MAAMT,OAAO,CAACU,WAAW,CAACP,MAAM,CAAC;MACxD,MAAMQ,WAAW,0BAAGR,MAAM,CAACS,WAAW,wDAAlB,oBAAoBjB,OAAO,EAAE;MACjD,OAAO,KAAIkB,qCAAgB,EAACJ,cAAc,EAAEL,UAAU,EAAEC,eAAe,EAAEM,WAAW,EAAEJ,SAAS,CAAC;IAClG,CAAC,CAAC;IACF,MAAMO,SAAS,GAAG,MAAMd,OAAO,CAACM,yBAAyB,CAACP,OAAO,CAACL,IAAI,CAAC;IACvE,MAAMqB,GAAG,GAAG,MAAMf,OAAO,CAACQ,gBAAgB,CAACT,OAAO,CAAC;IACnD,OAAO,KAAIiB,+BAAU,EAAChB,OAAO,CAACU,WAAW,CAACX,OAAO,CAAC,EAAEL,IAAI,EAAEO,OAAO,EAAEa,SAAS,EAAEC,GAAG,CAAC;EACpF;AACF;AAAC"}
@@ -1,9 +1,14 @@
1
1
  import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
2
  import { Node, ExportAssignment as ExportAssignmentNode } from 'typescript';
3
+ import { ExportIdentifier } from '../export-identifier';
3
4
  import { SchemaExtractorContext } from '../schema-extractor-context';
4
5
  import { SchemaTransformer } from '../schema-transformer';
5
- export declare class ExportAssignmentDeclaration implements SchemaTransformer {
6
+ /**
7
+ * This is either an export = or an export default declaration.
8
+ * Unless isExportEquals is set, this node was parsed as an export default
9
+ */
10
+ export declare class ExportAssignmentTransformer implements SchemaTransformer {
6
11
  predicate(node: Node): boolean;
7
- getIdentifiers(exportDec: ExportAssignmentNode, context: SchemaExtractorContext): Promise<import("../export-identifier").ExportIdentifier[]>;
12
+ getIdentifiers(exportDec: ExportAssignmentNode): Promise<ExportIdentifier[]>;
8
13
  transform(exportDec: ExportAssignmentNode, context: SchemaExtractorContext): Promise<SchemaNode>;
9
14
  }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.promise.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ExportAssignmentTransformer = void 0;
8
+ function _typescript() {
9
+ const data = require("typescript");
10
+ _typescript = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ function _exportIdentifier() {
16
+ const data = require("../export-identifier");
17
+ _exportIdentifier = function () {
18
+ return data;
19
+ };
20
+ return data;
21
+ }
22
+ /**
23
+ * This is either an export = or an export default declaration.
24
+ * Unless isExportEquals is set, this node was parsed as an export default
25
+ */
26
+ class ExportAssignmentTransformer {
27
+ predicate(node) {
28
+ return node.kind === _typescript().SyntaxKind.ExportAssignment;
29
+ }
30
+ async getIdentifiers(exportDec) {
31
+ const specifier = exportDec.expression;
32
+ return [new (_exportIdentifier().ExportIdentifier)(specifier.getText(), exportDec.getSourceFile().fileName)];
33
+ }
34
+ async transform(exportDec, context) {
35
+ const specifier = exportDec.expression;
36
+ return context.computeSchema(specifier);
37
+ }
38
+ }
39
+ exports.ExportAssignmentTransformer = ExportAssignmentTransformer;
40
+
41
+ //# sourceMappingURL=export-assignment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ExportAssignmentTransformer","predicate","node","kind","SyntaxKind","ExportAssignment","getIdentifiers","exportDec","specifier","expression","ExportIdentifier","getText","getSourceFile","fileName","transform","context","computeSchema"],"sources":["export-assignment.ts"],"sourcesContent":["import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';\nimport { Node, SyntaxKind, ExportAssignment as ExportAssignmentNode } from 'typescript';\nimport { ExportIdentifier } from '../export-identifier';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { SchemaTransformer } from '../schema-transformer';\n\n/**\n * This is either an export = or an export default declaration.\n * Unless isExportEquals is set, this node was parsed as an export default\n */\nexport class ExportAssignmentTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ExportAssignment;\n }\n\n async getIdentifiers(exportDec: ExportAssignmentNode) {\n const specifier = exportDec.expression;\n return [new ExportIdentifier(specifier.getText(), exportDec.getSourceFile().fileName)];\n }\n\n async transform(exportDec: ExportAssignmentNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const specifier = exportDec.expression;\n return context.computeSchema(specifier);\n }\n}\n"],"mappings":";;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,CAA8B;EACpEC,SAAS,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,gBAAgB;EAClD;EAEA,MAAMC,cAAc,CAACC,SAA+B,EAAE;IACpD,MAAMC,SAAS,GAAGD,SAAS,CAACE,UAAU;IACtC,OAAO,CAAC,KAAIC,oCAAgB,EAACF,SAAS,CAACG,OAAO,EAAE,EAAEJ,SAAS,CAACK,aAAa,EAAE,CAACC,QAAQ,CAAC,CAAC;EACxF;EAEA,MAAMC,SAAS,CAACP,SAA+B,EAAEQ,OAA+B,EAAuB;IACrG,MAAMP,SAAS,GAAGD,SAAS,CAACE,UAAU;IACtC,OAAOM,OAAO,CAACC,aAAa,CAACR,SAAS,CAAC;EACzC;AACF;AAAC"}
@@ -2,9 +2,8 @@ import { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
2
2
  import { Node, ExportDeclaration as ExportDeclarationNode } from 'typescript';
3
3
  import { SchemaExtractorContext } from '../schema-extractor-context';
4
4
  import { SchemaTransformer } from '../schema-transformer';
5
- import { ExportIdentifier } from '../export-identifier';
6
- export declare class ExportDeclaration implements SchemaTransformer {
5
+ export declare class ExportDeclarationTransformer implements SchemaTransformer {
7
6
  predicate(node: Node): boolean;
8
- getIdentifiers(exportDec: ExportDeclarationNode, context: SchemaExtractorContext): Promise<ExportIdentifier[]>;
7
+ getIdentifiers(exportDec: ExportDeclarationNode, context: SchemaExtractorContext): Promise<import("../identifier").Identifier[]>;
9
8
  transform(exportDec: ExportDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode>;
10
9
  }
@@ -5,7 +5,7 @@ require("core-js/modules/es.promise.js");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.ExportDeclaration = void 0;
8
+ exports.ExportDeclarationTransformer = void 0;
9
9
  function _semanticsEntities() {
10
10
  const data = require("@teambit/semantics.entities.semantic-schema");
11
11
  _semanticsEntities = function () {
@@ -29,20 +29,30 @@ function _exportIdentifier() {
29
29
  }
30
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
31
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
32
- class ExportDeclaration {
32
+ class ExportDeclarationTransformer {
33
33
  predicate(node) {
34
34
  return node.kind === _typescript().SyntaxKind.ExportDeclaration;
35
35
  }
36
36
  async getIdentifiers(exportDec, context) {
37
- var _exportDec$exportClau, _exportDec$exportClau2;
37
+ var _exportDec$moduleSpec, _exportDec$exportClau, _exportDec$exportClau2;
38
+ // e.g. `export { button1, button2 } as Composition from './button';
39
+ const rawSourceFilePath = (_exportDec$moduleSpec = exportDec.moduleSpecifier) === null || _exportDec$moduleSpec === void 0 ? void 0 : _exportDec$moduleSpec.getText();
40
+
41
+ // strip off quotes ''
42
+ const sourceFilePath = rawSourceFilePath && rawSourceFilePath.substring(1, (rawSourceFilePath === null || rawSourceFilePath === void 0 ? void 0 : rawSourceFilePath.length) - 1);
38
43
  if (((_exportDec$exportClau = exportDec.exportClause) === null || _exportDec$exportClau === void 0 ? void 0 : _exportDec$exportClau.kind) === _typescript().default.SyntaxKind.NamedExports) {
39
- exportDec.exportClause;
40
44
  return exportDec.exportClause.elements.map(elm => {
41
- return new (_exportIdentifier().ExportIdentifier)(elm.name.getText(), elm.getSourceFile().fileName);
45
+ var _elm$propertyName;
46
+ const alias = elm.propertyName && elm.name.getText() || undefined;
47
+ const id = ((_elm$propertyName = elm.propertyName) === null || _elm$propertyName === void 0 ? void 0 : _elm$propertyName.getText()) || elm.name.getText();
48
+ const fileName = elm.getSourceFile().fileName;
49
+ return new (_exportIdentifier().ExportIdentifier)(id, fileName, alias, sourceFilePath);
42
50
  });
43
51
  }
52
+
53
+ // e.g. `export * as Composition from './button';
44
54
  if (((_exportDec$exportClau2 = exportDec.exportClause) === null || _exportDec$exportClau2 === void 0 ? void 0 : _exportDec$exportClau2.kind) === _typescript().default.SyntaxKind.NamespaceExport) {
45
- return [new (_exportIdentifier().ExportIdentifier)(exportDec.exportClause.name.getText(), exportDec.getSourceFile().fileName)];
55
+ return [new (_exportIdentifier().ExportIdentifier)(exportDec.exportClause.name.getText(), exportDec.getSourceFile().fileName, undefined, sourceFilePath)];
46
56
  }
47
57
  if (exportDec.moduleSpecifier) {
48
58
  return context.getFileExports(exportDec);
@@ -59,8 +69,9 @@ class ExportDeclaration {
59
69
  throw new Error(`fatal: no specifier`);
60
70
  }
61
71
  const sourceFile = await context.getSourceFileFromNode(specifier);
72
+ // export * from 'webpack', export-all from a package
62
73
  if (!sourceFile) {
63
- throw new Error(`unable to find the source-file`);
74
+ return new (_semanticsEntities().UnImplementedSchema)(context.getLocation(exportDec), exportDec.getText(), _typescript().SyntaxKind[_typescript().SyntaxKind.ExportDeclaration]);
64
75
  }
65
76
  return context.computeSchema(sourceFile);
66
77
  }
@@ -68,7 +79,7 @@ class ExportDeclaration {
68
79
  // e.g. `export { button1, button2 } as Composition from './button';
69
80
  if (exportClause.kind === _typescript().SyntaxKind.NamedExports) {
70
81
  const schemas = await namedExport(exportClause, context);
71
- return new (_semanticsEntities().ModuleSchema)(context.getLocation(exportDec), schemas);
82
+ return new (_semanticsEntities().ModuleSchema)(context.getLocation(exportDec), schemas, []);
72
83
  }
73
84
  // e.g. `export * as Composition from './button';
74
85
  if (exportClause.kind === _typescript().SyntaxKind.NamespaceExport) {
@@ -79,7 +90,7 @@ class ExportDeclaration {
79
90
  throw new Error(`unrecognized exportClause type`);
80
91
  }
81
92
  }
82
- exports.ExportDeclaration = ExportDeclaration;
93
+ exports.ExportDeclarationTransformer = ExportDeclarationTransformer;
83
94
  function isSameNode(nodeA, nodeB) {
84
95
  return nodeA.kind === nodeB.kind && nodeA.pos === nodeB.pos && nodeA.end === nodeB.end;
85
96
  }
@@ -98,7 +109,7 @@ async function exportSpecifierToSchemaNode(element, context) {
98
109
  }
99
110
  const definitionNode = await context.definition(definitionInfo);
100
111
  if (!definitionNode) {
101
- return context.getTypeRefForExternalNode(element);
112
+ return context.resolveType(element, element.name.getText(), false);
102
113
  }
103
114
 
104
115
  // if it is reexported from another export