@teambit/typescript 0.0.880 → 0.0.882

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 (78) hide show
  1. package/dist/cmds/check-types.cmd.js +0 -21
  2. package/dist/cmds/check-types.cmd.js.map +1 -1
  3. package/dist/cmds/write-tsconfig.cmd.js +2 -25
  4. package/dist/cmds/write-tsconfig.cmd.js.map +1 -1
  5. package/dist/dedupe-path.spec.js +6 -8
  6. package/dist/dedupe-path.spec.js.map +1 -1
  7. package/dist/exceptions/index.js +0 -3
  8. package/dist/exceptions/index.js.map +1 -1
  9. package/dist/exceptions/transformer-not-found.js +0 -7
  10. package/dist/exceptions/transformer-not-found.js.map +1 -1
  11. package/dist/export-identifier.js +0 -3
  12. package/dist/export-identifier.js.map +1 -1
  13. package/dist/export-list.js +0 -4
  14. package/dist/export-list.js.map +1 -1
  15. package/dist/index.js +0 -9
  16. package/dist/index.js.map +1 -1
  17. package/dist/schema-extractor-context.js +16 -120
  18. package/dist/schema-extractor-context.js.map +1 -1
  19. package/dist/schema-transformer.plugin.js +0 -8
  20. package/dist/schema-transformer.plugin.js.map +1 -1
  21. package/dist/transformers/binding-element.js +0 -23
  22. package/dist/transformers/binding-element.js.map +1 -1
  23. package/dist/transformers/class-deceleration.js +2 -34
  24. package/dist/transformers/class-deceleration.js.map +1 -1
  25. package/dist/transformers/enum-declaration.js +0 -16
  26. package/dist/transformers/enum-declaration.js.map +1 -1
  27. package/dist/transformers/export-declaration.js +8 -47
  28. package/dist/transformers/export-declaration.js.map +1 -1
  29. package/dist/transformers/function-declaration.js +2 -19
  30. package/dist/transformers/function-declaration.js.map +1 -1
  31. package/dist/transformers/index.js +0 -30
  32. package/dist/transformers/index.js.map +1 -1
  33. package/dist/transformers/interface-declaration.js +0 -25
  34. package/dist/transformers/interface-declaration.js.map +1 -1
  35. package/dist/transformers/source-file-transformer.js +3 -24
  36. package/dist/transformers/source-file-transformer.js.map +1 -1
  37. package/dist/transformers/type-alias.js +0 -23
  38. package/dist/transformers/type-alias.js.map +1 -1
  39. package/dist/transformers/utils/class-element-to-schema.js +0 -35
  40. package/dist/transformers/utils/class-element-to-schema.js.map +1 -1
  41. package/dist/transformers/utils/get-params.js +6 -33
  42. package/dist/transformers/utils/get-params.js.map +1 -1
  43. package/dist/transformers/utils/jsdoc-to-doc-schema.js +4 -49
  44. package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -1
  45. package/dist/transformers/utils/parse-type-from-quick-info.js +4 -16
  46. package/dist/transformers/utils/parse-type-from-quick-info.js.map +1 -1
  47. package/dist/transformers/utils/to-function-like-schema.js +0 -15
  48. package/dist/transformers/utils/to-function-like-schema.js.map +1 -1
  49. package/dist/transformers/utils/type-element-to-schema.js +0 -37
  50. package/dist/transformers/utils/type-element-to-schema.js.map +1 -1
  51. package/dist/transformers/utils/type-node-to-schema.js +5 -71
  52. package/dist/transformers/utils/type-node-to-schema.js.map +1 -1
  53. package/dist/transformers/variable-declaration.js +0 -30
  54. package/dist/transformers/variable-declaration.js.map +1 -1
  55. package/dist/transformers/variable-statement.js +0 -22
  56. package/dist/transformers/variable-statement.js.map +1 -1
  57. package/dist/tsconfig-writer.js +8 -58
  58. package/dist/tsconfig-writer.js.map +1 -1
  59. package/dist/typescript.aspect.js +0 -5
  60. package/dist/typescript.aspect.js.map +1 -1
  61. package/dist/typescript.compiler.js +16 -83
  62. package/dist/typescript.compiler.js.map +1 -1
  63. package/dist/typescript.compiler.spec.js +0 -25
  64. package/dist/typescript.compiler.spec.js.map +1 -1
  65. package/dist/typescript.composition.js +0 -6
  66. package/dist/typescript.composition.js.map +1 -1
  67. package/dist/typescript.extractor.js +6 -50
  68. package/dist/typescript.extractor.js.map +1 -1
  69. package/dist/typescript.main.runtime.js +10 -114
  70. package/dist/typescript.main.runtime.js.map +1 -1
  71. package/dist/typescript.parser.js +3 -30
  72. package/dist/typescript.parser.js.map +1 -1
  73. package/dist/typescript.parser.spec.js +0 -22
  74. package/dist/typescript.parser.spec.js.map +1 -1
  75. package/package-tar/teambit-typescript-0.0.882.tgz +0 -0
  76. package/package.json +15 -15
  77. package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
  78. package/package-tar/teambit-typescript-0.0.880.tgz +0 -0
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.promise.js");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -9,108 +8,77 @@ exports.getAccessor = getAccessor;
9
8
  exports.indexSignature = indexSignature;
10
9
  exports.setAccessor = setAccessor;
11
10
  exports.typeElementToSchema = typeElementToSchema;
12
-
13
11
  function _typescript() {
14
12
  const data = require("typescript");
15
-
16
13
  _typescript = function () {
17
14
  return data;
18
15
  };
19
-
20
16
  return data;
21
17
  }
22
-
23
18
  function _semanticsEntities() {
24
19
  const data = require("@teambit/semantics.entities.semantic-schema");
25
-
26
20
  _semanticsEntities = function () {
27
21
  return data;
28
22
  };
29
-
30
23
  return data;
31
24
  }
32
-
33
25
  function _toFunctionLikeSchema() {
34
26
  const data = require("./to-function-like-schema");
35
-
36
27
  _toFunctionLikeSchema = function () {
37
28
  return data;
38
29
  };
39
-
40
30
  return data;
41
31
  }
42
-
43
32
  function _parseTypeFromQuickInfo() {
44
33
  const data = require("./parse-type-from-quick-info");
45
-
46
34
  _parseTypeFromQuickInfo = function () {
47
35
  return data;
48
36
  };
49
-
50
37
  return data;
51
38
  }
52
-
53
39
  function _typeNodeToSchema() {
54
40
  const data = require("./type-node-to-schema");
55
-
56
41
  _typeNodeToSchema = function () {
57
42
  return data;
58
43
  };
59
-
60
44
  return data;
61
45
  }
62
-
63
46
  function _getParams() {
64
47
  const data = require("./get-params");
65
-
66
48
  _getParams = function () {
67
49
  return data;
68
50
  };
69
-
70
51
  return data;
71
52
  }
72
-
73
53
  function _jsdocToDocSchema() {
74
54
  const data = require("./jsdoc-to-doc-schema");
75
-
76
55
  _jsdocToDocSchema = function () {
77
56
  return data;
78
57
  };
79
-
80
58
  return data;
81
59
  }
82
-
83
60
  async function typeElementToSchema(node, context) {
84
61
  switch (node.kind) {
85
62
  case _typescript().SyntaxKind.MethodSignature:
86
63
  return (0, _toFunctionLikeSchema().toFunctionLikeSchema)(node, context);
87
-
88
64
  case _typescript().SyntaxKind.ConstructSignature:
89
65
  return (0, _toFunctionLikeSchema().toFunctionLikeSchema)(node, context, 'new');
90
-
91
66
  case _typescript().SyntaxKind.CallSignature:
92
67
  return callSignature(node, context);
93
-
94
68
  case _typescript().SyntaxKind.PropertySignature:
95
69
  return propertySignature(node, context);
96
-
97
70
  case _typescript().SyntaxKind.IndexSignature:
98
71
  return indexSignature(node, context);
99
-
100
72
  case _typescript().SyntaxKind.GetAccessor:
101
73
  return getAccessor(node, context);
102
-
103
74
  case _typescript().SyntaxKind.SetAccessor:
104
75
  return setAccessor(node, context);
105
-
106
76
  default:
107
77
  throw new Error(`typeElementToSchema expect type-element node. got ${node.kind}`);
108
78
  }
109
79
  }
110
-
111
80
  async function propertySignature(node, context) {
112
81
  var _info$body;
113
-
114
82
  const name = node.name.getText();
115
83
  const info = (0, _typescript().isComputedPropertyName)(node.name) ? undefined : await context.getQuickInfo(node.name);
116
84
  const displaySig = (info === null || info === void 0 ? void 0 : (_info$body = info.body) === null || _info$body === void 0 ? void 0 : _info$body.displayString) || '';
@@ -120,29 +88,24 @@ async function propertySignature(node, context) {
120
88
  const doc = await (0, _jsdocToDocSchema().jsDocToDocSchema)(node, context);
121
89
  return new (_semanticsEntities().VariableLikeSchema)(context.getLocation(node), name, displaySig, type, isOptional, doc);
122
90
  }
123
-
124
91
  async function indexSignature(node, context) {
125
92
  const params = await (0, _getParams().getParams)(node.parameters, context);
126
93
  const type = await (0, _typeNodeToSchema().typeNodeToSchema)(node.type, context);
127
94
  return new (_semanticsEntities().IndexSignatureSchema)(context.getLocation(node), params, type);
128
95
  }
129
-
130
96
  async function getAccessor(node, context) {
131
97
  var _info$body2;
132
-
133
98
  const info = await context.getQuickInfo(node.name);
134
99
  const displaySig = (info === null || info === void 0 ? void 0 : (_info$body2 = info.body) === null || _info$body2 === void 0 ? void 0 : _info$body2.displayString) || '';
135
100
  const typeStr = (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(info);
136
101
  const type = await context.resolveType(node, typeStr);
137
102
  return new (_semanticsEntities().GetAccessorSchema)(context.getLocation(node), node.name.getText(), type, displaySig);
138
103
  }
139
-
140
104
  async function setAccessor(node, context) {
141
105
  const params = await (0, _getParams().getParams)(node.parameters, context);
142
106
  const displaySig = await context.getQuickInfoDisplayString(node.name);
143
107
  return new (_semanticsEntities().SetAccessorSchema)(context.getLocation(node), node.name.getText(), params[0], displaySig);
144
108
  }
145
-
146
109
  async function callSignature(node, context) {
147
110
  return (0, _toFunctionLikeSchema().toFunctionLikeSchema)(node, context);
148
111
  }
@@ -1 +1 @@
1
- {"version":3,"names":["typeElementToSchema","node","context","kind","SyntaxKind","MethodSignature","toFunctionLikeSchema","ConstructSignature","CallSignature","callSignature","PropertySignature","propertySignature","IndexSignature","indexSignature","GetAccessor","getAccessor","SetAccessor","setAccessor","Error","name","getText","info","isComputedPropertyName","undefined","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","doc","jsDocToDocSchema","VariableLikeSchema","getLocation","params","getParams","parameters","typeNodeToSchema","IndexSignatureSchema","GetAccessorSchema","getQuickInfoDisplayString","SetAccessorSchema"],"sources":["type-element-to-schema.ts"],"sourcesContent":["import ts, {\n SyntaxKind,\n TypeElement,\n MethodSignature,\n isComputedPropertyName,\n IndexSignatureDeclaration,\n GetAccessorDeclaration,\n SetAccessorDeclaration,\n ConstructSignatureDeclaration,\n CallSignatureDeclaration,\n} from 'typescript';\nimport {\n GetAccessorSchema,\n IndexSignatureSchema,\n SchemaNode,\n SetAccessorSchema,\n VariableLikeSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { toFunctionLikeSchema } from './to-function-like-schema';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './parse-type-from-quick-info';\nimport { typeNodeToSchema } from './type-node-to-schema';\nimport { getParams } from './get-params';\nimport { jsDocToDocSchema } from './jsdoc-to-doc-schema';\n\nexport async function typeElementToSchema(node: TypeElement, context: SchemaExtractorContext): Promise<SchemaNode> {\n switch (node.kind) {\n case SyntaxKind.MethodSignature:\n return toFunctionLikeSchema(node as MethodSignature, context);\n case SyntaxKind.ConstructSignature:\n return toFunctionLikeSchema(node as ConstructSignatureDeclaration, context, 'new');\n case SyntaxKind.CallSignature:\n return callSignature(node as CallSignatureDeclaration, context);\n case SyntaxKind.PropertySignature:\n return propertySignature(node as ts.PropertySignature, context);\n case SyntaxKind.IndexSignature:\n return indexSignature(node as IndexSignatureDeclaration, context);\n case SyntaxKind.GetAccessor:\n return getAccessor(node as GetAccessorDeclaration, context);\n case SyntaxKind.SetAccessor:\n return setAccessor(node as SetAccessorDeclaration, context);\n default:\n throw new Error(`typeElementToSchema expect type-element node. got ${node.kind}`);\n }\n}\n\nasync function propertySignature(node: ts.PropertySignature, context: SchemaExtractorContext) {\n const name = node.name.getText();\n const info = isComputedPropertyName(node.name) ? undefined : 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 isOptional = Boolean(node.questionToken);\n const doc = await jsDocToDocSchema(node, context);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, isOptional, doc);\n}\n\nexport async function indexSignature(node: IndexSignatureDeclaration, context: SchemaExtractorContext) {\n const params = await getParams(node.parameters, context);\n const type = await typeNodeToSchema(node.type, context);\n return new IndexSignatureSchema(context.getLocation(node), params, type);\n}\n\nexport async function getAccessor(node: GetAccessorDeclaration, context: SchemaExtractorContext) {\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 return new GetAccessorSchema(context.getLocation(node), node.name.getText(), type, displaySig);\n}\n\nexport async function setAccessor(node: SetAccessorDeclaration, context: SchemaExtractorContext) {\n const params = await getParams(node.parameters, context);\n const displaySig = await context.getQuickInfoDisplayString(node.name);\n return new SetAccessorSchema(context.getLocation(node), node.name.getText(), params[0], displaySig);\n}\n\nasync function callSignature(node: CallSignatureDeclaration, context: SchemaExtractorContext) {\n return toFunctionLikeSchema(node, context);\n}\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAWA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAOA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,eAAeA,mBAAf,CAAmCC,IAAnC,EAAsDC,OAAtD,EAA4G;EACjH,QAAQD,IAAI,CAACE,IAAb;IACE,KAAKC,wBAAA,CAAWC,eAAhB;MACE,OAAO,IAAAC,4CAAA,EAAqBL,IAArB,EAA8CC,OAA9C,CAAP;;IACF,KAAKE,wBAAA,CAAWG,kBAAhB;MACE,OAAO,IAAAD,4CAAA,EAAqBL,IAArB,EAA4DC,OAA5D,EAAqE,KAArE,CAAP;;IACF,KAAKE,wBAAA,CAAWI,aAAhB;MACE,OAAOC,aAAa,CAACR,IAAD,EAAmCC,OAAnC,CAApB;;IACF,KAAKE,wBAAA,CAAWM,iBAAhB;MACE,OAAOC,iBAAiB,CAACV,IAAD,EAA+BC,OAA/B,CAAxB;;IACF,KAAKE,wBAAA,CAAWQ,cAAhB;MACE,OAAOC,cAAc,CAACZ,IAAD,EAAoCC,OAApC,CAArB;;IACF,KAAKE,wBAAA,CAAWU,WA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kB,IAAL,CAAUC,OAAV,EAAjD,EAAsEmB,MAAM,CAAC,CAAD,CAA5E,EAAiFd,UAAjF,CAAP;AACD;;AAED,eAAehB,aAAf,CAA6BR,IAA7B,EAA6DC,OAA7D,EAA8F;EAC5F,OAAO,IAAAI,4CAAA,EAAqBL,IAArB,EAA2BC,OAA3B,CAAP;AACD"}
1
+ {"version":3,"names":["typeElementToSchema","node","context","kind","SyntaxKind","MethodSignature","toFunctionLikeSchema","ConstructSignature","CallSignature","callSignature","PropertySignature","propertySignature","IndexSignature","indexSignature","GetAccessor","getAccessor","SetAccessor","setAccessor","Error","name","getText","info","isComputedPropertyName","undefined","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","doc","jsDocToDocSchema","VariableLikeSchema","getLocation","params","getParams","parameters","typeNodeToSchema","IndexSignatureSchema","GetAccessorSchema","getQuickInfoDisplayString","SetAccessorSchema"],"sources":["type-element-to-schema.ts"],"sourcesContent":["import ts, {\n SyntaxKind,\n TypeElement,\n MethodSignature,\n isComputedPropertyName,\n IndexSignatureDeclaration,\n GetAccessorDeclaration,\n SetAccessorDeclaration,\n ConstructSignatureDeclaration,\n CallSignatureDeclaration,\n} from 'typescript';\nimport {\n GetAccessorSchema,\n IndexSignatureSchema,\n SchemaNode,\n SetAccessorSchema,\n VariableLikeSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { toFunctionLikeSchema } from './to-function-like-schema';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './parse-type-from-quick-info';\nimport { typeNodeToSchema } from './type-node-to-schema';\nimport { getParams } from './get-params';\nimport { jsDocToDocSchema } from './jsdoc-to-doc-schema';\n\nexport async function typeElementToSchema(node: TypeElement, context: SchemaExtractorContext): Promise<SchemaNode> {\n switch (node.kind) {\n case SyntaxKind.MethodSignature:\n return toFunctionLikeSchema(node as MethodSignature, context);\n case SyntaxKind.ConstructSignature:\n return toFunctionLikeSchema(node as ConstructSignatureDeclaration, context, 'new');\n case SyntaxKind.CallSignature:\n return callSignature(node as CallSignatureDeclaration, context);\n case SyntaxKind.PropertySignature:\n return propertySignature(node as ts.PropertySignature, context);\n case SyntaxKind.IndexSignature:\n return indexSignature(node as IndexSignatureDeclaration, context);\n case SyntaxKind.GetAccessor:\n return getAccessor(node as GetAccessorDeclaration, context);\n case SyntaxKind.SetAccessor:\n return setAccessor(node as SetAccessorDeclaration, context);\n default:\n throw new Error(`typeElementToSchema expect type-element node. got ${node.kind}`);\n }\n}\n\nasync function propertySignature(node: ts.PropertySignature, context: SchemaExtractorContext) {\n const name = node.name.getText();\n const info = isComputedPropertyName(node.name) ? undefined : 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 isOptional = Boolean(node.questionToken);\n const doc = await jsDocToDocSchema(node, context);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, isOptional, doc);\n}\n\nexport async function indexSignature(node: IndexSignatureDeclaration, context: SchemaExtractorContext) {\n const params = await getParams(node.parameters, context);\n const type = await typeNodeToSchema(node.type, context);\n return new IndexSignatureSchema(context.getLocation(node), params, type);\n}\n\nexport async function getAccessor(node: GetAccessorDeclaration, context: SchemaExtractorContext) {\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 return new GetAccessorSchema(context.getLocation(node), node.name.getText(), type, displaySig);\n}\n\nexport async function setAccessor(node: SetAccessorDeclaration, context: SchemaExtractorContext) {\n const params = await getParams(node.parameters, context);\n const displaySig = await context.getQuickInfoDisplayString(node.name);\n return new SetAccessorSchema(context.getLocation(node), node.name.getText(), params[0], displaySig);\n}\n\nasync function callSignature(node: CallSignatureDeclaration, context: SchemaExtractorContext) {\n return toFunctionLikeSchema(node, context);\n}\n"],"mappings":";;;;;;;;;;AAAA;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U,GAAG,CAAAJ,IAAI,aAAJA,IAAI,sCAAJA,IAAI,CAAEK,IAAI,gDAAV,YAAYC,aAAa,KAAI,EAAE;EAClD,MAAMC,OAAO,GAAG,IAAAC,gDAAsB,EAACR,IAAI,CAAC;EAC5C,MAAMS,IAAI,GAAG,MAAM5B,OAAO,CAAC6B,WAAW,CAAC9B,IAAI,EAAE2B,OAAO,CAAC;EACrD,OAAO,KAAIgB,sCAAiB,EAAC1C,OAAO,CAACoC,WAAW,CAACrC,IAAI,CAAC,EAAEA,IAAI,CAACkB,IAAI,CAACC,OAAO,EAAE,EAAEU,IAAI,EAAEL,UAAU,CAAC;AAChG;AAEO,eAAeR,WAAW,CAAChB,IAA4B,EAAEC,OAA+B,EAAE;EAC/F,MAAMqC,MAAM,GAAG,MAAM,IAAAC,sBAAS,EAACvC,IAAI,CAACwC,UAAU,EAAEvC,OAAO,CAAC;EACxD,MAAMuB,UAAU,GAAG,MAAMvB,OAAO,CAAC2C,yBAAyB,CAAC5C,IAAI,CAACkB,IAAI,CAAC;EACrE,OAAO,KAAI2B,sCAAiB,EAAC5C,OAAO,CAACoC,WAAW,CAACrC,IAAI,CAAC,EAAEA,IAAI,CAACkB,IAAI,CAACC,OAAO,EAAE,EAAEmB,MAAM,CAAC,CAAC,CAAC,EAAEd,UAAU,CAAC;AACrG;AAEA,eAAehB,aAAa,CAACR,IAA8B,EAAEC,OAA+B,EAAE;EAC5F,OAAO,IAAAI,4CAAoB,EAACL,IAAI,EAAEC,OAAO,CAAC;AAC5C"}
@@ -1,135 +1,95 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.promise.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.typeNodeToSchema = typeNodeToSchema;
11
-
12
9
  function _typescript() {
13
10
  const data = require("typescript");
14
-
15
11
  _typescript = function () {
16
12
  return data;
17
13
  };
18
-
19
14
  return data;
20
15
  }
21
-
22
16
  function _semanticsEntities() {
23
17
  const data = require("@teambit/semantics.entities.semantic-schema");
24
-
25
18
  _semanticsEntities = function () {
26
19
  return data;
27
20
  };
28
-
29
21
  return data;
30
22
  }
31
-
32
23
  function _pMapSeries() {
33
24
  const data = _interopRequireDefault(require("p-map-series"));
34
-
35
25
  _pMapSeries = function () {
36
26
  return data;
37
27
  };
38
-
39
28
  return data;
40
29
  }
41
-
42
30
  function _getParams() {
43
31
  const data = require("./get-params");
44
-
45
32
  _getParams = function () {
46
33
  return data;
47
34
  };
48
-
49
35
  return data;
50
36
  }
51
-
52
37
  function _typeElementToSchema() {
53
38
  const data = require("./type-element-to-schema");
54
-
55
39
  _typeElementToSchema = function () {
56
40
  return data;
57
41
  };
58
-
59
42
  return data;
60
43
  }
61
-
62
44
  function _jsdocToDocSchema() {
63
45
  const data = require("./jsdoc-to-doc-schema");
64
-
65
46
  _jsdocToDocSchema = function () {
66
47
  return data;
67
48
  };
68
-
69
49
  return data;
70
50
  }
71
-
72
51
  // eslint-disable-next-line complexity
73
52
  async function typeNodeToSchema(node, context) {
74
53
  const location = context.getLocation(node);
75
-
76
54
  if (isKeywordType(node)) {
77
55
  return new (_semanticsEntities().KeywordTypeSchema)(location, node.getText());
78
56
  }
79
-
80
57
  switch (node.kind) {
81
58
  case _typescript().SyntaxKind.IntersectionType:
82
59
  return intersectionType(node, context);
83
-
84
60
  case _typescript().SyntaxKind.UnionType:
85
61
  return unionType(node, context);
86
-
87
62
  case _typescript().SyntaxKind.TypeReference:
88
63
  return typeReference(node, context);
89
-
90
64
  case _typescript().SyntaxKind.TypeLiteral:
91
65
  return typeLiteral(node, context);
92
-
93
66
  case _typescript().SyntaxKind.LiteralType:
94
67
  // e.g. string/boolean
95
68
  return new (_semanticsEntities().LiteralTypeSchema)(location, node.getText());
96
-
97
69
  case _typescript().SyntaxKind.FunctionType:
98
70
  return functionType(node, context);
99
-
100
71
  case _typescript().SyntaxKind.TypeQuery:
101
72
  return typeQuery(node, context);
102
-
103
73
  case _typescript().SyntaxKind.ArrayType:
104
74
  return arrayType(node, context);
105
-
106
75
  case _typescript().SyntaxKind.TypeOperator:
107
76
  return typeOperator(node, context);
108
-
109
77
  case _typescript().SyntaxKind.TupleType:
110
78
  return tupleType(node, context);
111
-
112
79
  case _typescript().SyntaxKind.ParenthesizedType:
113
80
  return parenthesizedType(node, context);
114
-
115
81
  case _typescript().SyntaxKind.TypePredicate:
116
82
  return typePredicate(node, context);
117
-
118
83
  case _typescript().SyntaxKind.IndexedAccessType:
119
84
  return indexedAccessType(node, context);
120
-
121
85
  case _typescript().SyntaxKind.TemplateLiteralTypeSpan:
122
86
  return templateLiteralTypeSpan(node, context);
123
-
124
87
  case _typescript().SyntaxKind.TemplateLiteralType:
125
88
  return templateLiteralType(node, context);
126
-
127
89
  case _typescript().SyntaxKind.ThisType:
128
90
  return thisType(node, context);
129
-
130
91
  case _typescript().SyntaxKind.ConditionalType:
131
92
  return conditionalType(node, context);
132
-
133
93
  case _typescript().SyntaxKind.ConstructorType:
134
94
  case _typescript().SyntaxKind.NamedTupleMember:
135
95
  case _typescript().SyntaxKind.OptionalType:
@@ -151,17 +111,15 @@ async function typeNodeToSchema(node, context) {
151
111
  case _typescript().SyntaxKind.JSDocTypeLiteral:
152
112
  throw new Error(`TypeNode ${node.kind} (probably ${_typescript().SyntaxKind[node.kind]}) was not implemented yet.
153
113
  context: ${node.getText()}`);
154
-
155
114
  default:
156
115
  throw new Error(`Node ${node.kind} (probably ${_typescript().SyntaxKind[node.kind]}) is not a TypeNode.
157
116
  context: ${node.getText()}`);
158
117
  }
159
118
  }
119
+
160
120
  /**
161
121
  * whether it's kind of `ts.KeywordTypeSyntaxKind`
162
122
  */
163
-
164
-
165
123
  function isKeywordType(node) {
166
124
  switch (node.kind) {
167
125
  case _typescript().SyntaxKind.AnyKeyword:
@@ -177,12 +135,10 @@ function isKeywordType(node) {
177
135
  case _typescript().SyntaxKind.UnknownKeyword:
178
136
  case _typescript().SyntaxKind.VoidKeyword:
179
137
  return true;
180
-
181
138
  default:
182
139
  return false;
183
140
  }
184
141
  }
185
-
186
142
  async function intersectionType(node, context) {
187
143
  const types = await (0, _pMapSeries().default)(node.types, async type => {
188
144
  const typeSchema = await typeNodeToSchema(type, context);
@@ -191,7 +147,6 @@ async function intersectionType(node, context) {
191
147
  const location = context.getLocation(node);
192
148
  return new (_semanticsEntities().TypeIntersectionSchema)(location, types);
193
149
  }
194
-
195
150
  async function unionType(node, context) {
196
151
  const types = await (0, _pMapSeries().default)(node.types, async type => {
197
152
  const typeSchema = await typeNodeToSchema(type, context);
@@ -200,17 +155,17 @@ async function unionType(node, context) {
200
155
  const location = context.getLocation(node);
201
156
  return new (_semanticsEntities().TypeUnionSchema)(location, types);
202
157
  }
158
+
203
159
  /**
204
160
  * not to be confused with "LiteralType", which is string/boolean/null.
205
161
  * this "TypeLiteral" is an object with properties, such as: `{ a: string; b: number }`, similar to Interface.
206
162
  */
207
-
208
-
209
163
  async function typeLiteral(node, context) {
210
164
  const members = await (0, _pMapSeries().default)(node.members, member => (0, _typeElementToSchema().typeElementToSchema)(member, context));
211
165
  const location = context.getLocation(node);
212
166
  return new (_semanticsEntities().TypeLiteralSchema)(location, members);
213
167
  }
168
+
214
169
  /**
215
170
  * In the following example, `AriaButtonProps` is a type reference
216
171
  * ```ts
@@ -218,23 +173,17 @@ async function typeLiteral(node, context) {
218
173
  * export type ButtonProps = AriaButtonProps & { a: string };
219
174
  * ```
220
175
  */
221
-
222
-
223
176
  async function typeReference(node, context) {
224
177
  const name = node.typeName.getText();
225
178
  const type = await context.resolveType(node, name, false);
226
-
227
179
  if (node.typeArguments && type instanceof _semanticsEntities().TypeRefSchema) {
228
180
  const args = await (0, _pMapSeries().default)(node.typeArguments, arg => typeNodeToSchema(arg, context));
229
181
  type.typeArgs = args;
230
182
  }
231
-
232
183
  return type;
233
184
  }
234
-
235
185
  async function functionType(node, context) {
236
186
  var _node$name, _node$modifiers;
237
-
238
187
  const name = ((_node$name = node.name) === null || _node$name === void 0 ? void 0 : _node$name.getText()) || '';
239
188
  const params = await (0, _getParams().getParams)(node.parameters, context);
240
189
  const returnType = await typeNodeToSchema(node.type, context);
@@ -243,50 +192,42 @@ async function functionType(node, context) {
243
192
  const doc = await (0, _jsdocToDocSchema().jsDocToDocSchema)(node, context);
244
193
  return new (_semanticsEntities().FunctionLikeSchema)(location, name, params, returnType, '', modifiers, doc);
245
194
  }
195
+
246
196
  /**
247
197
  * e.g. `typeof Foo`
248
198
  */
249
-
250
-
251
199
  async function typeQuery(node, context) {
252
200
  const displaySig = await context.getQuickInfoDisplayString(node.exprName);
253
201
  const type = await context.resolveType(node.exprName, node.exprName.getText(), false);
254
202
  const location = context.getLocation(node);
255
203
  return new (_semanticsEntities().TypeQuerySchema)(location, type, displaySig);
256
204
  }
257
-
258
205
  async function arrayType(node, context) {
259
206
  const type = await typeNodeToSchema(node.elementType, context);
260
207
  const location = context.getLocation(node);
261
208
  return new (_semanticsEntities().TypeArraySchema)(location, type);
262
209
  }
210
+
263
211
  /**
264
212
  * e.g. keyof typeof Foo
265
213
  */
266
-
267
-
268
214
  async function typeOperator(node, context) {
269
215
  const operatorName = getOperatorName(node.operator);
270
216
  const type = await typeNodeToSchema(node.type, context);
271
217
  return new (_semanticsEntities().TypeOperatorSchema)(context.getLocation(node), operatorName, type);
272
218
  }
273
-
274
219
  function getOperatorName(operator) {
275
220
  switch (operator) {
276
221
  case _typescript().SyntaxKind.KeyOfKeyword:
277
222
  return 'keyof';
278
-
279
223
  case _typescript().SyntaxKind.UniqueKeyword:
280
224
  return 'unique';
281
-
282
225
  case _typescript().SyntaxKind.ReadonlyKeyword:
283
226
  return 'readonly';
284
-
285
227
  default:
286
228
  throw new Error(`getOperatorName: unable to find operator name for ${operator}`);
287
229
  }
288
230
  }
289
-
290
231
  async function tupleType(node, context) {
291
232
  const elements = await (0, _pMapSeries().default)(node.elements, async elem => {
292
233
  const typeSchema = await typeNodeToSchema(elem, context);
@@ -294,41 +235,34 @@ async function tupleType(node, context) {
294
235
  });
295
236
  return new (_semanticsEntities().TupleTypeSchema)(context.getLocation(node), elements);
296
237
  }
297
-
298
238
  async function parenthesizedType(node, context) {
299
239
  const type = await typeNodeToSchema(node.type, context);
300
240
  return new (_semanticsEntities().ParenthesizedTypeSchema)(context.getLocation(node), type);
301
241
  }
302
-
303
242
  async function typePredicate(node, context) {
304
243
  const parameterName = (0, _typescript().isIdentifier)(node.parameterName) ? node.parameterName.getText() : 'this';
305
244
  const type = node.type ? await typeNodeToSchema(node.type, context) : undefined;
306
245
  const hasAssertsModifier = Boolean(node.assertsModifier);
307
246
  return new (_semanticsEntities().TypePredicateSchema)(context.getLocation(node), parameterName, type, hasAssertsModifier);
308
247
  }
309
-
310
248
  async function indexedAccessType(node, context) {
311
249
  const objectType = await typeNodeToSchema(node.objectType, context);
312
250
  const indexType = await typeNodeToSchema(node.indexType, context);
313
251
  return new (_semanticsEntities().IndexedAccessSchema)(context.getLocation(node), objectType, indexType);
314
252
  }
315
-
316
253
  async function templateLiteralType(node, context) {
317
254
  const templateSpans = await (0, _pMapSeries().default)(node.templateSpans, span => templateLiteralTypeSpan(span, context));
318
255
  const head = node.head.text;
319
256
  return new (_semanticsEntities().TemplateLiteralTypeSchema)(context.getLocation(node), head, templateSpans);
320
257
  }
321
-
322
258
  async function templateLiteralTypeSpan(node, context) {
323
259
  const type = await typeNodeToSchema(node.type, context);
324
260
  const literal = node.literal.text;
325
261
  return new (_semanticsEntities().TemplateLiteralTypeSpanSchema)(context.getLocation(node), literal, type);
326
262
  }
327
-
328
263
  async function thisType(node, context) {
329
264
  return new (_semanticsEntities().ThisTypeSchema)(context.getLocation(node));
330
265
  }
331
-
332
266
  async function conditionalType(node, context) {
333
267
  const checkType = await typeNodeToSchema(node.checkType, context);
334
268
  const extendsType = await typeNodeToSchema(node.extendsType, context);
@@ -1 +1 @@
1
- {"version":3,"names":["typeNodeToSchema","node","context","location","getLocation","isKeywordType","KeywordTypeSchema","getText","kind","SyntaxKind","IntersectionType","intersectionType","UnionType","unionType","TypeReference","typeReference","TypeLiteral","typeLiteral","LiteralType","LiteralTypeSchema","FunctionType","functionType","TypeQuery","typeQuery","ArrayType","arrayType","TypeOperator","typeOperator","TupleType","tupleType","ParenthesizedType","parenthesizedType","TypePredicate","typePredicate","IndexedAccessType","indexedAccessType","TemplateLiteralTypeSpan","templateLiteralTypeSpan","TemplateLiteralType","templateLiteralType","ThisType","thisType","ConditionalType","conditionalType","ConstructorType","NamedTupleMember","OptionalType","RestType","InferType","MappedType","ImportType","ExpressionWithTypeArguments","JSDocTypeExpression","JSDocAllType","JSDocUnknownType","JSDocNonNullableType","JSDocNullableType","JSDocOptionalType","JSDocFunctionType","JSDocVariadicType","JSDocNamepathType","JSDocSignature","JSDocTypeLiteral","Error","AnyKeyword","BigIntKeyword","BooleanKeyword","IntrinsicKeyword","NeverKeyword","NumberKeyword","ObjectKeyword","StringKeyword","SymbolKeyword","UndefinedKeyword","UnknownKeyword","VoidKeyword","types","pMapSeries","type","typeSchema","TypeIntersectionSchema","TypeUnionSchema","members","member","typeElementToSchema","TypeLiteralSchema","name","typeName","resolveType","typeArguments","TypeRefSchema","args","arg","typeArgs","params","getParams","parameters","returnType","modifiers","map","modifier","doc","jsDocToDocSchema","FunctionLikeSchema","displaySig","getQuickInfoDisplayString","exprName","TypeQuerySchema","elementType","TypeArraySchema","operatorName","getOperatorName","operator","TypeOperatorSchema","KeyOfKeyword","UniqueKeyword","ReadonlyKeyword","elements","elem","TupleTypeSchema","ParenthesizedTypeSchema","parameterName","isIdentifier","undefined","hasAssertsModifier","Boolean","assertsModifier","TypePredicateSchema","objectType","indexType","IndexedAccessSchema","templateSpans","span","head","text","TemplateLiteralTypeSchema","literal","TemplateLiteralTypeSpanSchema","ThisTypeSchema","checkType","extendsType","trueType","falseType","ConditionalTypeSchema"],"sources":["type-node-to-schema.ts"],"sourcesContent":["import {\n TypeNode,\n SyntaxKind,\n KeywordTypeNode,\n FunctionTypeNode,\n TypeQueryNode,\n TypeReferenceNode,\n ArrayTypeNode,\n TypeOperatorNode,\n TupleTypeNode,\n IntersectionTypeNode,\n UnionTypeNode,\n TypeLiteralNode,\n ParenthesizedTypeNode,\n TypePredicateNode,\n isIdentifier,\n IndexedAccessTypeNode,\n TemplateLiteralTypeNode,\n TemplateLiteralTypeSpan,\n ThisTypeNode,\n ConditionalTypeNode,\n} from 'typescript';\nimport {\n SchemaNode,\n TypeRefSchema,\n TypeIntersectionSchema,\n TypeUnionSchema,\n TypeLiteralSchema,\n TypeQuerySchema,\n LiteralTypeSchema,\n KeywordTypeSchema,\n TypeArraySchema,\n TypeOperatorSchema,\n TupleTypeSchema,\n FunctionLikeSchema,\n ParenthesizedTypeSchema,\n TypePredicateSchema,\n IndexedAccessSchema,\n TemplateLiteralTypeSpanSchema,\n TemplateLiteralTypeSchema,\n ThisTypeSchema,\n Modifier,\n ConditionalTypeSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\nimport { getParams } from './get-params';\nimport { typeElementToSchema } from './type-element-to-schema';\nimport { jsDocToDocSchema } from './jsdoc-to-doc-schema';\n\n// eslint-disable-next-line complexity\nexport async function typeNodeToSchema(node: TypeNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const location = context.getLocation(node);\n if (isKeywordType(node)) {\n return new KeywordTypeSchema(location, node.getText());\n }\n switch (node.kind) {\n case SyntaxKind.IntersectionType:\n return intersectionType(node as IntersectionTypeNode, context);\n case SyntaxKind.UnionType:\n return unionType(node as UnionTypeNode, context);\n case SyntaxKind.TypeReference:\n return typeReference(node as TypeReferenceNode, context);\n case SyntaxKind.TypeLiteral:\n return typeLiteral(node as TypeLiteralNode, context);\n case SyntaxKind.LiteralType: // e.g. string/boolean\n return new LiteralTypeSchema(location, node.getText());\n case SyntaxKind.FunctionType:\n return functionType(node as FunctionTypeNode, context);\n case SyntaxKind.TypeQuery:\n return typeQuery(node as TypeQueryNode, context);\n case SyntaxKind.ArrayType:\n return arrayType(node as ArrayTypeNode, context);\n case SyntaxKind.TypeOperator:\n return typeOperator(node as TypeOperatorNode, context);\n case SyntaxKind.TupleType:\n return tupleType(node as TupleTypeNode, context);\n case SyntaxKind.ParenthesizedType:\n return parenthesizedType(node as ParenthesizedTypeNode, context);\n case SyntaxKind.TypePredicate:\n return typePredicate(node as TypePredicateNode, context);\n case SyntaxKind.IndexedAccessType:\n return indexedAccessType(node as IndexedAccessTypeNode, context);\n case SyntaxKind.TemplateLiteralTypeSpan:\n return templateLiteralTypeSpan(node as TemplateLiteralTypeSpan, context);\n case SyntaxKind.TemplateLiteralType:\n return templateLiteralType(node as TemplateLiteralTypeNode, context);\n case SyntaxKind.ThisType:\n return thisType(node as ThisTypeNode, context);\n case SyntaxKind.ConditionalType:\n return conditionalType(node as ConditionalTypeNode, context);\n case SyntaxKind.ConstructorType:\n case SyntaxKind.NamedTupleMember:\n case SyntaxKind.OptionalType:\n case SyntaxKind.RestType:\n case SyntaxKind.InferType:\n case SyntaxKind.MappedType:\n case SyntaxKind.ImportType:\n case SyntaxKind.ExpressionWithTypeArguments:\n case SyntaxKind.JSDocTypeExpression:\n case SyntaxKind.JSDocAllType:\n case SyntaxKind.JSDocUnknownType:\n case SyntaxKind.JSDocNonNullableType:\n case SyntaxKind.JSDocNullableType:\n case SyntaxKind.JSDocOptionalType:\n case SyntaxKind.JSDocFunctionType:\n case SyntaxKind.JSDocVariadicType:\n case SyntaxKind.JSDocNamepathType:\n case SyntaxKind.JSDocSignature:\n case SyntaxKind.JSDocTypeLiteral:\n throw new Error(`TypeNode ${node.kind} (probably ${SyntaxKind[node.kind]}) was not implemented yet.\ncontext: ${node.getText()}`);\n default:\n throw new Error(`Node ${node.kind} (probably ${SyntaxKind[node.kind]}) is not a TypeNode.\ncontext: ${node.getText()}`);\n }\n}\n\n/**\n * whether it's kind of `ts.KeywordTypeSyntaxKind`\n */\nfunction isKeywordType(node: TypeNode): node is KeywordTypeNode {\n switch (node.kind) {\n case SyntaxKind.AnyKeyword:\n case SyntaxKind.BigIntKeyword:\n case SyntaxKind.BooleanKeyword:\n case SyntaxKind.IntrinsicKeyword:\n case SyntaxKind.NeverKeyword:\n case SyntaxKind.NumberKeyword:\n case SyntaxKind.ObjectKeyword:\n case SyntaxKind.StringKeyword:\n case SyntaxKind.SymbolKeyword:\n case SyntaxKind.UndefinedKeyword:\n case SyntaxKind.UnknownKeyword:\n case SyntaxKind.VoidKeyword:\n return true;\n default:\n return false;\n }\n}\n\nasync function intersectionType(node: IntersectionTypeNode, context: SchemaExtractorContext) {\n const types = await pMapSeries(node.types, async (type) => {\n const typeSchema = await typeNodeToSchema(type, context);\n return typeSchema;\n });\n const location = context.getLocation(node);\n return new TypeIntersectionSchema(location, types);\n}\n\nasync function unionType(node: UnionTypeNode, context: SchemaExtractorContext) {\n const types = await pMapSeries(node.types, async (type) => {\n const typeSchema = await typeNodeToSchema(type, context);\n return typeSchema;\n });\n const location = context.getLocation(node);\n return new TypeUnionSchema(location, types);\n}\n\n/**\n * not to be confused with \"LiteralType\", which is string/boolean/null.\n * this \"TypeLiteral\" is an object with properties, such as: `{ a: string; b: number }`, similar to Interface.\n */\nasync function typeLiteral(node: TypeLiteralNode, context: SchemaExtractorContext) {\n const members = await pMapSeries(node.members, (member) => typeElementToSchema(member, context));\n const location = context.getLocation(node);\n return new TypeLiteralSchema(location, members);\n}\n\n/**\n * In the following example, `AriaButtonProps` is a type reference\n * ```ts\n * import type { AriaButtonProps } from '@react-types/button';\n * export type ButtonProps = AriaButtonProps & { a: string };\n * ```\n */\nasync function typeReference(node: TypeReferenceNode, context: SchemaExtractorContext) {\n const name = node.typeName.getText();\n const type = await context.resolveType(node, name, false);\n if (node.typeArguments && type instanceof TypeRefSchema) {\n const args = await pMapSeries(node.typeArguments, (arg) => typeNodeToSchema(arg, context));\n type.typeArgs = args;\n }\n return type;\n}\n\nasync function functionType(node: FunctionTypeNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const name = node.name?.getText() || '';\n const params = await getParams(node.parameters, context);\n const returnType = await typeNodeToSchema(node.type, context);\n const location = context.getLocation(node);\n const modifiers = node.modifiers?.map((modifier) => modifier.getText()) || [];\n const doc = await jsDocToDocSchema(node, context);\n return new FunctionLikeSchema(location, name, params, returnType, '', modifiers as Modifier[], doc);\n}\n\n/**\n * e.g. `typeof Foo`\n */\nasync function typeQuery(node: TypeQueryNode, context: SchemaExtractorContext) {\n const displaySig = await context.getQuickInfoDisplayString(node.exprName);\n const type = await context.resolveType(node.exprName, node.exprName.getText(), false);\n const location = context.getLocation(node);\n return new TypeQuerySchema(location, type, displaySig);\n}\n\nasync function arrayType(node: ArrayTypeNode, context: SchemaExtractorContext) {\n const type = await typeNodeToSchema(node.elementType, context);\n const location = context.getLocation(node);\n return new TypeArraySchema(location, type);\n}\n\n/**\n * e.g. keyof typeof Foo\n */\nasync function typeOperator(node: TypeOperatorNode, context: SchemaExtractorContext) {\n const operatorName = getOperatorName(node.operator);\n const type = await typeNodeToSchema(node.type, context);\n return new TypeOperatorSchema(context.getLocation(node), operatorName, type);\n}\n\nfunction getOperatorName(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword) {\n switch (operator) {\n case SyntaxKind.KeyOfKeyword:\n return 'keyof';\n case SyntaxKind.UniqueKeyword:\n return 'unique';\n case SyntaxKind.ReadonlyKeyword:\n return 'readonly';\n default:\n throw new Error(`getOperatorName: unable to find operator name for ${operator}`);\n }\n}\n\nasync function tupleType(node: TupleTypeNode, context: SchemaExtractorContext) {\n const elements = await pMapSeries(node.elements, async (elem) => {\n const typeSchema = await typeNodeToSchema(elem, context);\n return typeSchema;\n });\n return new TupleTypeSchema(context.getLocation(node), elements);\n}\n\nasync function parenthesizedType(node: ParenthesizedTypeNode, context: SchemaExtractorContext) {\n const type = await typeNodeToSchema(node.type, context);\n return new ParenthesizedTypeSchema(context.getLocation(node), type);\n}\n\nasync function typePredicate(node: TypePredicateNode, context: SchemaExtractorContext) {\n const parameterName = isIdentifier(node.parameterName) ? node.parameterName.getText() : 'this';\n const type = node.type ? await typeNodeToSchema(node.type, context) : undefined;\n const hasAssertsModifier = Boolean(node.assertsModifier);\n return new TypePredicateSchema(context.getLocation(node), parameterName, type, hasAssertsModifier);\n}\n\nasync function indexedAccessType(node: IndexedAccessTypeNode, context: SchemaExtractorContext) {\n const objectType = await typeNodeToSchema(node.objectType, context);\n const indexType = await typeNodeToSchema(node.indexType, context);\n return new IndexedAccessSchema(context.getLocation(node), objectType, indexType);\n}\n\nasync function templateLiteralType(node: TemplateLiteralTypeNode, context: SchemaExtractorContext) {\n const templateSpans = await pMapSeries(node.templateSpans, (span) => templateLiteralTypeSpan(span, context));\n const head = node.head.text;\n return new TemplateLiteralTypeSchema(context.getLocation(node), head, templateSpans);\n}\n\nasync function templateLiteralTypeSpan(node: TemplateLiteralTypeSpan, context: SchemaExtractorContext) {\n const type = await typeNodeToSchema(node.type, context);\n const literal = node.literal.text;\n return new TemplateLiteralTypeSpanSchema(context.getLocation(node), literal, type);\n}\n\nasync function thisType(node: ThisTypeNode, context: SchemaExtractorContext) {\n return new ThisTypeSchema(context.getLocation(node));\n}\n\nasync function conditionalType(node: ConditionalTypeNode, context: SchemaExtractorContext) {\n const checkType = await typeNodeToSchema(node.checkType, context);\n const extendsType = await typeNodeToSchema(node.extendsType, context);\n const trueType = await typeNodeToSchema(node.trueType, context);\n const falseType = await typeNodeToSchema(node.falseType, context);\n return new ConditionalTypeSchema(context.getLocation(node), checkType, extendsType, trueType, falseType);\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAsBA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAsBA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;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IAAxB,EAA4CC,OAA5C,EAA6E;EAC3E,OAAO,KAAIwI,mCAAJ,EAAmBxI,OAAO,CAACE,WAAR,CAAoBH,IAApB,CAAnB,CAAP;AACD;;AAED,eAAe0C,eAAf,CAA+B1C,IAA/B,EAA0DC,OAA1D,EAA2F;EACzF,MAAMyI,SAAS,GAAG,MAAM3I,gBAAgB,CAACC,IAAI,CAAC0I,SAAN,EAAiBzI,OAAjB,CAAxC;EACA,MAAM0I,WAAW,GAAG,MAAM5I,gBAAgB,CAACC,IAAI,CAAC2I,WAAN,EAAmB1I,OAAnB,CAA1C;EACA,MAAM2I,QAAQ,GAAG,MAAM7I,gBAAgB,CAACC,IAAI,CAAC4I,QAAN,EAAgB3I,OAAhB,CAAvC;EACA,MAAM4I,SAAS,GAAG,MAAM9I,gBAAgB,CAACC,IAAI,CAAC6I,SAAN,EAAiB5I,OAAjB,CAAxC;EACA,OAAO,KAAI6I,0CAAJ,EAA0B7I,OAAO,CAACE,WAAR,CAAoBH,IAApB,CAA1B,EAAqD0I,SAArD,EAAgEC,WAAhE,EAA6EC,QAA7E,EAAuFC,SAAvF,CAAP;AACD"}
1
+ {"version":3,"names":["typeNodeToSchema","node","context","location","getLocation","isKeywordType","KeywordTypeSchema","getText","kind","SyntaxKind","IntersectionType","intersectionType","UnionType","unionType","TypeReference","typeReference","TypeLiteral","typeLiteral","LiteralType","LiteralTypeSchema","FunctionType","functionType","TypeQuery","typeQuery","ArrayType","arrayType","TypeOperator","typeOperator","TupleType","tupleType","ParenthesizedType","parenthesizedType","TypePredicate","typePredicate","IndexedAccessType","indexedAccessType","TemplateLiteralTypeSpan","templateLiteralTypeSpan","TemplateLiteralType","templateLiteralType","ThisType","thisType","ConditionalType","conditionalType","ConstructorType","NamedTupleMember","OptionalType","RestType","InferType","MappedType","ImportType","ExpressionWithTypeArguments","JSDocTypeExpression","JSDocAllType","JSDocUnknownType","JSDocNonNullableType","JSDocNullableType","JSDocOptionalType","JSDocFunctionType","JSDocVariadicType","JSDocNamepathType","JSDocSignature","JSDocTypeLiteral","Error","AnyKeyword","BigIntKeyword","BooleanKeyword","IntrinsicKeyword","NeverKeyword","NumberKeyword","ObjectKeyword","StringKeyword","SymbolKeyword","UndefinedKeyword","UnknownKeyword","VoidKeyword","types","pMapSeries","type","typeSchema","TypeIntersectionSchema","TypeUnionSchema","members","member","typeElementToSchema","TypeLiteralSchema","name","typeName","resolveType","typeArguments","TypeRefSchema","args","arg","typeArgs","params","getParams","parameters","returnType","modifiers","map","modifier","doc","jsDocToDocSchema","FunctionLikeSchema","displaySig","getQuickInfoDisplayString","exprName","TypeQuerySchema","elementType","TypeArraySchema","operatorName","getOperatorName","operator","TypeOperatorSchema","KeyOfKeyword","UniqueKeyword","ReadonlyKeyword","elements","elem","TupleTypeSchema","ParenthesizedTypeSchema","parameterName","isIdentifier","undefined","hasAssertsModifier","Boolean","assertsModifier","TypePredicateSchema","objectType","indexType","IndexedAccessSchema","templateSpans","span","head","text","TemplateLiteralTypeSchema","literal","TemplateLiteralTypeSpanSchema","ThisTypeSchema","checkType","extendsType","trueType","falseType","ConditionalTypeSchema"],"sources":["type-node-to-schema.ts"],"sourcesContent":["import {\n TypeNode,\n SyntaxKind,\n KeywordTypeNode,\n FunctionTypeNode,\n TypeQueryNode,\n TypeReferenceNode,\n ArrayTypeNode,\n TypeOperatorNode,\n TupleTypeNode,\n IntersectionTypeNode,\n UnionTypeNode,\n TypeLiteralNode,\n ParenthesizedTypeNode,\n TypePredicateNode,\n isIdentifier,\n IndexedAccessTypeNode,\n TemplateLiteralTypeNode,\n TemplateLiteralTypeSpan,\n ThisTypeNode,\n ConditionalTypeNode,\n} from 'typescript';\nimport {\n SchemaNode,\n TypeRefSchema,\n TypeIntersectionSchema,\n TypeUnionSchema,\n TypeLiteralSchema,\n TypeQuerySchema,\n LiteralTypeSchema,\n KeywordTypeSchema,\n TypeArraySchema,\n TypeOperatorSchema,\n TupleTypeSchema,\n FunctionLikeSchema,\n ParenthesizedTypeSchema,\n TypePredicateSchema,\n IndexedAccessSchema,\n TemplateLiteralTypeSpanSchema,\n TemplateLiteralTypeSchema,\n ThisTypeSchema,\n Modifier,\n ConditionalTypeSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\nimport { getParams } from './get-params';\nimport { typeElementToSchema } from './type-element-to-schema';\nimport { jsDocToDocSchema } from './jsdoc-to-doc-schema';\n\n// eslint-disable-next-line complexity\nexport async function typeNodeToSchema(node: TypeNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const location = context.getLocation(node);\n if (isKeywordType(node)) {\n return new KeywordTypeSchema(location, node.getText());\n }\n switch (node.kind) {\n case SyntaxKind.IntersectionType:\n return intersectionType(node as IntersectionTypeNode, context);\n case SyntaxKind.UnionType:\n return unionType(node as UnionTypeNode, context);\n case SyntaxKind.TypeReference:\n return typeReference(node as TypeReferenceNode, context);\n case SyntaxKind.TypeLiteral:\n return typeLiteral(node as TypeLiteralNode, context);\n case SyntaxKind.LiteralType: // e.g. string/boolean\n return new LiteralTypeSchema(location, node.getText());\n case SyntaxKind.FunctionType:\n return functionType(node as FunctionTypeNode, context);\n case SyntaxKind.TypeQuery:\n return typeQuery(node as TypeQueryNode, context);\n case SyntaxKind.ArrayType:\n return arrayType(node as ArrayTypeNode, context);\n case SyntaxKind.TypeOperator:\n return typeOperator(node as TypeOperatorNode, context);\n case SyntaxKind.TupleType:\n return tupleType(node as TupleTypeNode, context);\n case SyntaxKind.ParenthesizedType:\n return parenthesizedType(node as ParenthesizedTypeNode, context);\n case SyntaxKind.TypePredicate:\n return typePredicate(node as TypePredicateNode, context);\n case SyntaxKind.IndexedAccessType:\n return indexedAccessType(node as IndexedAccessTypeNode, context);\n case SyntaxKind.TemplateLiteralTypeSpan:\n return templateLiteralTypeSpan(node as TemplateLiteralTypeSpan, context);\n case SyntaxKind.TemplateLiteralType:\n return templateLiteralType(node as TemplateLiteralTypeNode, context);\n case SyntaxKind.ThisType:\n return thisType(node as ThisTypeNode, context);\n case SyntaxKind.ConditionalType:\n return conditionalType(node as ConditionalTypeNode, context);\n case SyntaxKind.ConstructorType:\n case SyntaxKind.NamedTupleMember:\n case SyntaxKind.OptionalType:\n case SyntaxKind.RestType:\n case SyntaxKind.InferType:\n case SyntaxKind.MappedType:\n case SyntaxKind.ImportType:\n case SyntaxKind.ExpressionWithTypeArguments:\n case SyntaxKind.JSDocTypeExpression:\n case SyntaxKind.JSDocAllType:\n case SyntaxKind.JSDocUnknownType:\n case SyntaxKind.JSDocNonNullableType:\n case SyntaxKind.JSDocNullableType:\n case SyntaxKind.JSDocOptionalType:\n case SyntaxKind.JSDocFunctionType:\n case SyntaxKind.JSDocVariadicType:\n case SyntaxKind.JSDocNamepathType:\n case SyntaxKind.JSDocSignature:\n case SyntaxKind.JSDocTypeLiteral:\n throw new Error(`TypeNode ${node.kind} (probably ${SyntaxKind[node.kind]}) was not implemented yet.\ncontext: ${node.getText()}`);\n default:\n throw new Error(`Node ${node.kind} (probably ${SyntaxKind[node.kind]}) is not a TypeNode.\ncontext: ${node.getText()}`);\n }\n}\n\n/**\n * whether it's kind of `ts.KeywordTypeSyntaxKind`\n */\nfunction isKeywordType(node: TypeNode): node is KeywordTypeNode {\n switch (node.kind) {\n case SyntaxKind.AnyKeyword:\n case SyntaxKind.BigIntKeyword:\n case SyntaxKind.BooleanKeyword:\n case SyntaxKind.IntrinsicKeyword:\n case SyntaxKind.NeverKeyword:\n case SyntaxKind.NumberKeyword:\n case SyntaxKind.ObjectKeyword:\n case SyntaxKind.StringKeyword:\n case SyntaxKind.SymbolKeyword:\n case SyntaxKind.UndefinedKeyword:\n case SyntaxKind.UnknownKeyword:\n case SyntaxKind.VoidKeyword:\n return true;\n default:\n return false;\n }\n}\n\nasync function intersectionType(node: IntersectionTypeNode, context: SchemaExtractorContext) {\n const types = await pMapSeries(node.types, async (type) => {\n const typeSchema = await typeNodeToSchema(type, context);\n return typeSchema;\n });\n const location = context.getLocation(node);\n return new TypeIntersectionSchema(location, types);\n}\n\nasync function unionType(node: UnionTypeNode, context: SchemaExtractorContext) {\n const types = await pMapSeries(node.types, async (type) => {\n const typeSchema = await typeNodeToSchema(type, context);\n return typeSchema;\n });\n const location = context.getLocation(node);\n return new TypeUnionSchema(location, types);\n}\n\n/**\n * not to be confused with \"LiteralType\", which is string/boolean/null.\n * this \"TypeLiteral\" is an object with properties, such as: `{ a: string; b: number }`, similar to Interface.\n */\nasync function typeLiteral(node: TypeLiteralNode, context: SchemaExtractorContext) {\n const members = await pMapSeries(node.members, (member) => typeElementToSchema(member, context));\n const location = context.getLocation(node);\n return new TypeLiteralSchema(location, members);\n}\n\n/**\n * In the following example, `AriaButtonProps` is a type reference\n * ```ts\n * import type { AriaButtonProps } from '@react-types/button';\n * export type ButtonProps = AriaButtonProps & { a: string };\n * ```\n */\nasync function typeReference(node: TypeReferenceNode, context: SchemaExtractorContext) {\n const name = node.typeName.getText();\n const type = await context.resolveType(node, name, false);\n if (node.typeArguments && type instanceof TypeRefSchema) {\n const args = await pMapSeries(node.typeArguments, (arg) => typeNodeToSchema(arg, context));\n type.typeArgs = args;\n }\n return type;\n}\n\nasync function functionType(node: FunctionTypeNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const name = node.name?.getText() || '';\n const params = await getParams(node.parameters, context);\n const returnType = await typeNodeToSchema(node.type, context);\n const location = context.getLocation(node);\n const modifiers = node.modifiers?.map((modifier) => modifier.getText()) || [];\n const doc = await jsDocToDocSchema(node, context);\n return new FunctionLikeSchema(location, name, params, returnType, '', modifiers as Modifier[], doc);\n}\n\n/**\n * e.g. `typeof Foo`\n */\nasync function typeQuery(node: TypeQueryNode, context: SchemaExtractorContext) {\n const displaySig = await context.getQuickInfoDisplayString(node.exprName);\n const type = await context.resolveType(node.exprName, node.exprName.getText(), false);\n const location = context.getLocation(node);\n return new TypeQuerySchema(location, type, displaySig);\n}\n\nasync function arrayType(node: ArrayTypeNode, context: SchemaExtractorContext) {\n const type = await typeNodeToSchema(node.elementType, context);\n const location = context.getLocation(node);\n return new TypeArraySchema(location, type);\n}\n\n/**\n * e.g. keyof typeof Foo\n */\nasync function typeOperator(node: TypeOperatorNode, context: SchemaExtractorContext) {\n const operatorName = getOperatorName(node.operator);\n const type = await typeNodeToSchema(node.type, context);\n return new TypeOperatorSchema(context.getLocation(node), operatorName, type);\n}\n\nfunction getOperatorName(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword) {\n switch (operator) {\n case SyntaxKind.KeyOfKeyword:\n return 'keyof';\n case SyntaxKind.UniqueKeyword:\n return 'unique';\n case SyntaxKind.ReadonlyKeyword:\n return 'readonly';\n default:\n throw new Error(`getOperatorName: unable to find operator name for ${operator}`);\n }\n}\n\nasync function tupleType(node: TupleTypeNode, context: SchemaExtractorContext) {\n const elements = await pMapSeries(node.elements, async (elem) => {\n const typeSchema = await typeNodeToSchema(elem, context);\n return typeSchema;\n });\n return new TupleTypeSchema(context.getLocation(node), elements);\n}\n\nasync function parenthesizedType(node: ParenthesizedTypeNode, context: SchemaExtractorContext) {\n const type = await typeNodeToSchema(node.type, context);\n return new ParenthesizedTypeSchema(context.getLocation(node), type);\n}\n\nasync function typePredicate(node: TypePredicateNode, context: SchemaExtractorContext) {\n const parameterName = isIdentifier(node.parameterName) ? node.parameterName.getText() : 'this';\n const type = node.type ? await typeNodeToSchema(node.type, context) : undefined;\n const hasAssertsModifier = Boolean(node.assertsModifier);\n return new TypePredicateSchema(context.getLocation(node), parameterName, type, hasAssertsModifier);\n}\n\nasync function indexedAccessType(node: IndexedAccessTypeNode, context: SchemaExtractorContext) {\n const objectType = await typeNodeToSchema(node.objectType, context);\n const indexType = await typeNodeToSchema(node.indexType, context);\n return new IndexedAccessSchema(context.getLocation(node), objectType, indexType);\n}\n\nasync function templateLiteralType(node: TemplateLiteralTypeNode, context: SchemaExtractorContext) {\n const templateSpans = await pMapSeries(node.templateSpans, (span) => templateLiteralTypeSpan(span, context));\n const head = node.head.text;\n return new TemplateLiteralTypeSchema(context.getLocation(node), head, templateSpans);\n}\n\nasync function templateLiteralTypeSpan(node: TemplateLiteralTypeSpan, context: SchemaExtractorContext) {\n const type = await typeNodeToSchema(node.type, context);\n const literal = node.literal.text;\n return new TemplateLiteralTypeSpanSchema(context.getLocation(node), literal, type);\n}\n\nasync function thisType(node: ThisTypeNode, context: SchemaExtractorContext) {\n return new ThisTypeSchema(context.getLocation(node));\n}\n\nasync function conditionalType(node: ConditionalTypeNode, context: SchemaExtractorContext) {\n const checkType = await typeNodeToSchema(node.checkType, context);\n const extendsType = await typeNodeToSchema(node.extendsType, context);\n const trueType = await typeNodeToSchema(node.trueType, context);\n const falseType = await typeNodeToSchema(node.falseType, context);\n return new ConditionalTypeSchema(context.getLocation(node), checkType, extendsType, trueType, falseType);\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAsBA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAsBA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACO,eAAeA,gBAAgB,CAACC,IAAc,EAAEC,OAA+B,EAAuB;EAC3G,MAAMC,QAAQ,GAAGD,OAAO,CAACE,WAAW,CAACH,IAAI,CAAC;EAC1C,IAAII,aAAa,CAACJ,IAAI,CAAC,EAAE;IACvB,OAAO,KAAIK,sCAAiB,EAACH,QAAQ,EAAEF,IAAI,CAACM,OAAO,EAAE,CAAC;EACxD;EACA,QAAQN,IAAI,CAACO,IAAI;IACf,KAAKC,wBAAU,CAACC,gBAAgB;MAC9B,OAAOC,gBAAgB,CAACV,IAAI,EAA0BC,OAAO,CAAC;IAChE,KAAKO,wBAAU,CAACG,SAAS;MACvB,OAAOC,SAAS,C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