@teambit/typescript 0.0.753 → 0.0.756
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.
- package/dist/transformers/binding-element.d.ts +2 -2
- package/dist/transformers/binding-element.js +1 -1
- package/dist/transformers/binding-element.js.map +1 -1
- package/dist/transformers/utils/class-element-to-schema.js +1 -1
- package/dist/transformers/utils/class-element-to-schema.js.map +1 -1
- package/dist/transformers/utils/type-element-to-schema.js +1 -1
- package/dist/transformers/utils/type-element-to-schema.js.map +1 -1
- package/dist/transformers/variable-declaration.js +1 -1
- package/dist/transformers/variable-declaration.js.map +1 -1
- package/package-tar/teambit-typescript-0.0.756.tgz +0 -0
- package/package.json +16 -16
- package/{preview-1654572446572.js → preview-1654745302834.js} +2 -2
- package/transformers/binding-element.ts +2 -2
- package/transformers/utils/class-element-to-schema.ts +2 -2
- package/transformers/utils/type-element-to-schema.ts +2 -2
- package/transformers/variable-declaration.ts +7 -2
- package/package-tar/teambit-typescript-0.0.753.tgz +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BindingElement, Node } from 'typescript';
|
|
2
|
-
import {
|
|
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
5
|
import { ExportIdentifier } from '../export-identifier';
|
|
@@ -13,5 +13,5 @@ import { ExportIdentifier } from '../export-identifier';
|
|
|
13
13
|
export declare class BindingElementTransformer implements SchemaTransformer {
|
|
14
14
|
predicate(node: Node): boolean;
|
|
15
15
|
getIdentifiers(node: BindingElement): Promise<ExportIdentifier[]>;
|
|
16
|
-
transform(node: BindingElement, context: SchemaExtractorContext): Promise<
|
|
16
|
+
transform(node: BindingElement, context: SchemaExtractorContext): Promise<VariableLikeSchema>;
|
|
17
17
|
}
|
|
@@ -73,7 +73,7 @@ class BindingElementTransformer {
|
|
|
73
73
|
const displaySig = (info === null || info === void 0 ? void 0 : (_info$body = info.body) === null || _info$body === void 0 ? void 0 : _info$body.displayString) || '';
|
|
74
74
|
const typeStr = (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(info);
|
|
75
75
|
const type = await context.resolveType(node, typeStr);
|
|
76
|
-
return new (_semanticsEntities().
|
|
76
|
+
return new (_semanticsEntities().VariableLikeSchema)(context.getLocation(node), name, displaySig, type, false);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
}
|
|
@@ -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","
|
|
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","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 return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, false);\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,yBAAN,CAA6D;EAClEC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcC,cAAnC;EACD;;EAEmB,MAAdC,cAAc,CAACL,IAAD,EAAuB;IACzC,OAAO,CAAC,KAAIM,oCAAJ,EAAqBN,IAAI,CAACO,IAAL,CAAUC,OAAV,EAArB,EAA0CR,IAAI,CAACS,aAAL,GAAqBC,QAA/D,CAAD,CAAP;EACD;;EAEc,MAATC,SAAS,CAACX,IAAD,EAAuBY,OAAvB,EAAwD;IAAA;;IACrE,MAAML,IAAI,GAAGP,IAAI,CAACO,IAAL,CAAUC,OAAV,EAAb;IACA,MAAMK,IAAI,GAAG,MAAMD,OAAO,CAACE,YAAR,CAAqBd,IAAI,CAACO,IAA1B,CAAnB;IACA,MAAMQ,UAAU,GAAG,CAAAF,IAAI,SAAJ,IAAAA,IAAI,WAAJ,0BAAAA,IAAI,CAAEG,IAAN,0DAAYC,aAAZ,KAA6B,EAAhD;IACA,MAAMC,OAAO,GAAG,IAAAC,gDAAA,EAAuBN,IAAvB,CAAhB;IACA,MAAMO,IAAI,GAAG,MAAMR,OAAO,CAACS,WAAR,CAAoBrB,IAApB,EAA0BkB,OAA1B,CAAnB;IACA,OAAO,KAAII,uCAAJ,EAAuBV,OAAO,CAACW,WAAR,CAAoBvB,IAApB,CAAvB,EAAkDO,IAAlD,EAAwDQ,UAAxD,EAAoEK,IAApE,EAA0E,KAA1E,CAAP;EACD;;AAhBiE"}
|
|
@@ -113,7 +113,7 @@ async function propertyDeclaration(node, context) {
|
|
|
113
113
|
const typeStr = (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(info);
|
|
114
114
|
const type = await context.resolveType(node, typeStr);
|
|
115
115
|
const isOptional = Boolean(node.questionToken);
|
|
116
|
-
return new (_semanticsEntities().
|
|
116
|
+
return new (_semanticsEntities().VariableLikeSchema)(context.getLocation(node), name, displaySig || '', type, isOptional);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
async function methodDeclaration(node, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classElementToSchema","node","context","kind","SyntaxKind","Constructor","constructor","PropertyDeclaration","propertyDeclaration","MethodDeclaration","methodDeclaration","GetAccessor","getAccessor","SetAccessor","setAccessor","IndexSignature","indexSignature","ClassStaticBlockDeclaration","SemicolonClassElement","Error","args","getParams","parameters","ConstructorSchema","getLocation","name","getText","info","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","
|
|
1
|
+
{"version":3,"names":["classElementToSchema","node","context","kind","SyntaxKind","Constructor","constructor","PropertyDeclaration","propertyDeclaration","MethodDeclaration","methodDeclaration","GetAccessor","getAccessor","SetAccessor","setAccessor","IndexSignature","indexSignature","ClassStaticBlockDeclaration","SemicolonClassElement","Error","args","getParams","parameters","ConstructorSchema","getLocation","name","getText","info","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","VariableLikeSchema","toFunctionLikeSchema"],"sources":["class-element-to-schema.ts"],"sourcesContent":["import {\n ClassElement,\n ConstructorDeclaration,\n GetAccessorDeclaration,\n IndexSignatureDeclaration,\n MethodDeclaration,\n PropertyDeclaration,\n SetAccessorDeclaration,\n SyntaxKind,\n} from 'typescript';\nimport { ConstructorSchema, SchemaNode, VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\nimport { getParams } from './get-params';\nimport { getAccessor, indexSignature, setAccessor } from './type-element-to-schema';\nimport { parseTypeFromQuickInfo } from './parse-type-from-quick-info';\nimport { toFunctionLikeSchema } from './to-function-like-schema';\n\nexport async function classElementToSchema(\n node: ClassElement,\n context: SchemaExtractorContext\n): Promise<SchemaNode | null> {\n switch (node.kind) {\n case SyntaxKind.Constructor:\n return constructor(node as ConstructorDeclaration, context);\n case SyntaxKind.PropertyDeclaration:\n return propertyDeclaration(node as PropertyDeclaration, context);\n case SyntaxKind.MethodDeclaration:\n return methodDeclaration(node as MethodDeclaration, context);\n case SyntaxKind.GetAccessor:\n return getAccessor(node as GetAccessorDeclaration, context);\n case SyntaxKind.SetAccessor:\n return setAccessor(node as SetAccessorDeclaration, context);\n case SyntaxKind.IndexSignature:\n return indexSignature(node as IndexSignatureDeclaration, context);\n case SyntaxKind.ClassStaticBlockDeclaration: // not sure what is it, but the name sounds like not something we need\n case SyntaxKind.SemicolonClassElement: // seems to be just a semicolon\n return null;\n default:\n // should never be here unless typescript added new class elements\n throw new Error(`unrecognized ClassElement type. got ${node.kind}`);\n }\n}\n\nasync function constructor(node: ConstructorDeclaration, context: SchemaExtractorContext) {\n const args = await getParams(node.parameters, context);\n return new ConstructorSchema(context.getLocation(node), args);\n}\n\nasync function propertyDeclaration(node: PropertyDeclaration, 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 isOptional = Boolean(node.questionToken);\n\n return new VariableLikeSchema(context.getLocation(node), name, displaySig || '', type, isOptional);\n}\n\nasync function methodDeclaration(node: MethodDeclaration, context: SchemaExtractorContext) {\n return toFunctionLikeSchema(node, context);\n}\n"],"mappings":";;;;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EAAUpB,IAAI,CAACqB,UAAf,EAA2BpB,OAA3B,CAAnB;EACA,OAAO,KAAIqB,sCAAJ,EAAsBrB,OAAO,CAACsB,WAAR,CAAoBvB,IAApB,CAAtB,EAAiDmB,IAAjD,CAAP;AACD;;AAED,eAAeZ,mBAAf,CAAmCP,IAAnC,EAA8DC,OAA9D,EAA+F;EAAA;;EAC7F,MAAMuB,IAAI,GAAGxB,IAAI,CAACwB,IAAL,CAAUC,OAAV,EAAb;EACA,MAAMC,IAAI,GAAG,MAAMzB,OAAO,CAAC0B,YAAR,CAAqB3B,IAAI,CAACwB,IAA1B,CAAnB;EACA,MAAMI,UAAU,GAAGF,IAAH,aAAGA,IAAH,qCAAGA,IAAI,CAAEG,IAAT,+CAAG,WAAYC,aAA/B;EACA,MAAMC,OAAO,GAAG,IAAAC,gDAAA,EAAuBN,IAAvB,CAAhB;EACA,MAAMO,IAAI,GAAG,MAAMhC,OAAO,CAACiC,WAAR,CAAoBlC,IAApB,EAA0B+B,OAA1B,CAAnB;EACA,MAAMI,UAAU,GAAGC,OAAO,CAACpC,IAAI,CAACqC,aAAN,CAA1B;EAEA,OAAO,KAAIC,uCAAJ,EAAuBrC,OAAO,CAACsB,WAAR,CAAoBvB,IAApB,CAAvB,EAAkDwB,IAAlD,EAAwDI,UAAU,IAAI,EAAtE,EAA0EK,IAA1E,EAAgFE,UAAhF,CAAP;AACD;;AAED,eAAe1B,iBAAf,CAAiCT,IAAjC,EAA0DC,OAA1D,EAA2F;EACzF,OAAO,IAAAsC,4CAAA,EAAqBvC,IAArB,EAA2BC,OAA3B,CAAP;AACD"}
|
|
@@ -107,7 +107,7 @@ async function propertySignature(node, context) {
|
|
|
107
107
|
const typeStr = (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(info);
|
|
108
108
|
const type = await context.resolveType(node, typeStr);
|
|
109
109
|
const isOptional = Boolean(node.questionToken);
|
|
110
|
-
return new (_semanticsEntities().
|
|
110
|
+
return new (_semanticsEntities().VariableLikeSchema)(context.getLocation(node), name, displaySig, type, isOptional);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
async function indexSignature(node, context) {
|
|
@@ -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","
|
|
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","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';\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 return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, isOptional);\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: CallSignatureDe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AR,CAAqBvB,IAAI,CAACkB,IAA1B,CAAnB;EACA,MAAMM,UAAU,GAAG,CAAAJ,IAAI,SAAJ,IAAAA,IAAI,WAAJ,2BAAAA,IAAI,CAAEK,IAAN,4DAAYC,aAAZ,KAA6B,EAAhD;EACA,MAAMC,OAAO,GAAG,IAAAC,gDAAA,EAAuBR,IAAvB,CAAhB;EACA,MAAMS,IAAI,GAAG,MAAM5B,OAAO,CAAC6B,WAAR,CAAoB9B,IAApB,EAA0B2B,OAA1B,CAAnB;EACA,OAAO,KAAIc,sCAAJ,EAAsBxC,OAAO,CAACkC,WAAR,CAAoBnC,IAApB,CAAtB,EAAiDA,IAAI,CAACkB,IAAL,CAAUC,OAAV,EAAjD,EAAsEU,IAAtE,EAA4EL,UAA5E,CAAP;AACD;;AAEM,eAAeR,WAAf,CAA2BhB,IAA3B,EAAyDC,OAAzD,EAA0F;EAC/F,MAAMmC,MAAM,GAAG,MAAM,IAAAC,sBAAA,EAAUrC,IAAI,CAACsC,UAAf,EAA2BrC,OAA3B,CAArB;EACA,MAAMuB,UAAU,GAAG,MAAMvB,OAAO,CAACyC,yBAAR,CAAkC1C,IAAI,CAACkB,IAAvC,CAAzB;EACA,OAAO,KAAIyB,sCAAJ,EAAsB1C,OAAO,CAACkC,WAAR,CAAoBnC,IAApB,CAAtB,EAAiDA,IAAI,CAACkB,IAAL,CAAUC,OAAV,EAAjD,EAAsEiB,MAAM,CAAC,CAAD,CAA5E,EAAiFZ,UAAjF,CAAP;AACD;;AAED,eAAehB,aAAf,CAA6BR,IAA7B,EAA6DC,OAA7D,EAA8F;EAC5F,OAAO,IAAAI,4CAAA,EAAqBL,IAArB,EAA2BC,OAA3B,CAAP;AACD"}
|
|
@@ -103,7 +103,7 @@ class VariableDeclaration {
|
|
|
103
103
|
|
|
104
104
|
const typeStr = (0, _parseTypeFromQuickInfo().parseTypeFromQuickInfo)(info);
|
|
105
105
|
const type = await context.resolveType(varDec, typeStr);
|
|
106
|
-
return new (_semanticsEntities().
|
|
106
|
+
return new (_semanticsEntities().VariableLikeSchema)(location, name, displaySig, type, false);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VariableDeclaration","predicate","node","kind","ts","SyntaxKind","getName","name","getText","getIdentifiers","ExportIdentifier","getSourceFile","fileName","transform","varDec","context","info","getQuickInfo","displaySig","body","displayString","location","getLocation","initializer","ArrowFunction","args","getParams","parameters","typeStr","parseReturnTypeFromQuickInfo","returnType","resolveType","modifiers","map","modifier","doc","jsDocToDocSchema","FunctionLikeSchema","parseTypeFromQuickInfo","type","
|
|
1
|
+
{"version":3,"names":["VariableDeclaration","predicate","node","kind","ts","SyntaxKind","getName","name","getText","getIdentifiers","ExportIdentifier","getSourceFile","fileName","transform","varDec","context","info","getQuickInfo","displaySig","body","displayString","location","getLocation","initializer","ArrowFunction","args","getParams","parameters","typeStr","parseReturnTypeFromQuickInfo","returnType","resolveType","modifiers","map","modifier","doc","jsDocToDocSchema","FunctionLikeSchema","parseTypeFromQuickInfo","type","VariableLikeSchema"],"sources":["variable-declaration.ts"],"sourcesContent":["import {\n SchemaNode,\n VariableLikeSchema,\n FunctionLikeSchema,\n Modifier,\n} from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, VariableDeclaration as VariableDeclarationNode, ArrowFunction } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { ExportIdentifier } from '../export-identifier';\nimport { getParams } from './utils/get-params';\nimport { parseReturnTypeFromQuickInfo, parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport { jsDocToDocSchema } from './utils/jsdoc-to-doc-schema';\n\nexport class VariableDeclaration implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.VariableDeclaration;\n }\n\n getName(node: VariableDeclarationNode) {\n return node.name.getText();\n }\n\n async getIdentifiers(node: VariableDeclarationNode) {\n return [new ExportIdentifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(varDec: VariableDeclarationNode, context: SchemaExtractorContext): Promise<SchemaNode> {\n const name = this.getName(varDec);\n const info = await context.getQuickInfo(varDec.name);\n const displaySig = info?.body?.displayString || '';\n const location = context.getLocation(varDec);\n if (varDec.initializer?.kind === ts.SyntaxKind.ArrowFunction) {\n const args = await getParams((varDec.initializer as ArrowFunction).parameters, context);\n const typeStr = parseReturnTypeFromQuickInfo(info);\n const returnType = await context.resolveType(varDec, typeStr);\n const modifiers = varDec.modifiers?.map((modifier) => modifier.getText()) || [];\n const doc = await jsDocToDocSchema(varDec, context);\n return new FunctionLikeSchema(location, name, args, returnType, displaySig, modifiers as Modifier[], doc);\n }\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(varDec, typeStr);\n return new VariableLikeSchema(location, name, displaySig, type, false);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,mBAAN,CAAuD;EAC5DC,SAAS,CAACC,IAAD,EAAa;IACpB,OAAOA,IAAI,CAACC,IAAL,KAAcC,qBAAA,CAAGC,UAAH,CAAcL,mBAAnC;EACD;;EAEDM,OAAO,CAACJ,IAAD,EAAgC;IACrC,OAAOA,IAAI,CAACK,IAAL,CAAUC,OAAV,EAAP;EACD;;EAEmB,MAAdC,cAAc,CAACP,IAAD,EAAgC;IAClD,OAAO,CAAC,KAAIQ,oCAAJ,EAAqBR,IAAI,CAACK,IAAL,CAAUC,OAAV,EAArB,EAA0CN,IAAI,CAACS,aAAL,GAAqBC,Q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,MAAMuB,IAAI,GAAG,MAAMxB,OAAO,CAACgB,WAAR,CAAoBjB,MAApB,EAA4Bc,OAA5B,CAAnB;IACA,OAAO,KAAIY,uCAAJ,EAAuBnB,QAAvB,EAAiCd,IAAjC,EAAuCW,UAAvC,EAAmDqB,IAAnD,EAAyD,KAAzD,CAAP;EACD;;AA7B2D"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.756",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/typescript/typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.typescript",
|
|
8
8
|
"name": "typescript",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.756"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -18,21 +18,21 @@
|
|
|
18
18
|
"@babel/runtime": "7.12.18",
|
|
19
19
|
"core-js": "^3.0.0",
|
|
20
20
|
"@teambit/harmony": "0.3.3",
|
|
21
|
-
"@teambit/compiler": "0.0.
|
|
21
|
+
"@teambit/compiler": "0.0.756",
|
|
22
22
|
"@teambit/typescript.modules.ts-config-mutator": "0.0.68",
|
|
23
|
-
"@teambit/component": "0.0.
|
|
24
|
-
"@teambit/dependency-resolver": "0.0.
|
|
25
|
-
"@teambit/semantics.entities.semantic-schema": "0.0.
|
|
23
|
+
"@teambit/component": "0.0.756",
|
|
24
|
+
"@teambit/dependency-resolver": "0.0.756",
|
|
25
|
+
"@teambit/semantics.entities.semantic-schema": "0.0.19",
|
|
26
26
|
"@teambit/ts-server": "0.0.32",
|
|
27
|
-
"@teambit/aspect-loader": "0.0.
|
|
27
|
+
"@teambit/aspect-loader": "0.0.756",
|
|
28
28
|
"@teambit/bit-error": "0.0.394",
|
|
29
|
-
"@teambit/builder": "0.0.
|
|
30
|
-
"@teambit/isolator": "0.0.
|
|
31
|
-
"@teambit/logger": "0.0.
|
|
32
|
-
"@teambit/schema": "0.0.
|
|
33
|
-
"@teambit/workspace": "0.0.
|
|
34
|
-
"@teambit/cli": "0.0.
|
|
35
|
-
"@teambit/pkg": "0.0.
|
|
29
|
+
"@teambit/builder": "0.0.756",
|
|
30
|
+
"@teambit/isolator": "0.0.756",
|
|
31
|
+
"@teambit/logger": "0.0.592",
|
|
32
|
+
"@teambit/schema": "0.0.756",
|
|
33
|
+
"@teambit/workspace": "0.0.756",
|
|
34
|
+
"@teambit/cli": "0.0.499",
|
|
35
|
+
"@teambit/pkg": "0.0.756"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/lodash": "4.14.165",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@teambit/typescript.aspect-docs.typescript": "0.0.138"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@teambit/legacy": "1.0.
|
|
51
|
+
"@teambit/legacy": "1.0.279",
|
|
52
52
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
53
53
|
"react": "^16.8.0 || ^17.0.0"
|
|
54
54
|
},
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"react": "-"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@teambit/legacy": "1.0.
|
|
79
|
+
"@teambit/legacy": "1.0.279",
|
|
80
80
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
81
81
|
"react": "^16.8.0 || ^17.0.0"
|
|
82
82
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.
|
|
2
|
-
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.
|
|
1
|
+
export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.756/dist/typescript.composition.js')]
|
|
2
|
+
export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.756/dist/typescript.docs.mdx')]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts, { BindingElement, Node } from 'typescript';
|
|
2
|
-
import {
|
|
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
5
|
import { ExportIdentifier } from '../export-identifier';
|
|
@@ -27,6 +27,6 @@ export class BindingElementTransformer implements SchemaTransformer {
|
|
|
27
27
|
const displaySig = info?.body?.displayString || '';
|
|
28
28
|
const typeStr = parseTypeFromQuickInfo(info);
|
|
29
29
|
const type = await context.resolveType(node, typeStr);
|
|
30
|
-
return new
|
|
30
|
+
return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, false);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
SetAccessorDeclaration,
|
|
9
9
|
SyntaxKind,
|
|
10
10
|
} from 'typescript';
|
|
11
|
-
import { ConstructorSchema, SchemaNode,
|
|
11
|
+
import { ConstructorSchema, SchemaNode, VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
12
12
|
import { SchemaExtractorContext } from '../../schema-extractor-context';
|
|
13
13
|
import { getParams } from './get-params';
|
|
14
14
|
import { getAccessor, indexSignature, setAccessor } from './type-element-to-schema';
|
|
@@ -54,7 +54,7 @@ async function propertyDeclaration(node: PropertyDeclaration, context: SchemaExt
|
|
|
54
54
|
const type = await context.resolveType(node, typeStr);
|
|
55
55
|
const isOptional = Boolean(node.questionToken);
|
|
56
56
|
|
|
57
|
-
return new
|
|
57
|
+
return new VariableLikeSchema(context.getLocation(node), name, displaySig || '', type, isOptional);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
async function methodDeclaration(node: MethodDeclaration, context: SchemaExtractorContext) {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
IndexSignatureSchema,
|
|
15
15
|
SchemaNode,
|
|
16
16
|
SetAccessorSchema,
|
|
17
|
-
|
|
17
|
+
VariableLikeSchema,
|
|
18
18
|
} from '@teambit/semantics.entities.semantic-schema';
|
|
19
19
|
import { toFunctionLikeSchema } from './to-function-like-schema';
|
|
20
20
|
import { SchemaExtractorContext } from '../../schema-extractor-context';
|
|
@@ -50,7 +50,7 @@ async function propertySignature(node: ts.PropertySignature, context: SchemaExtr
|
|
|
50
50
|
const typeStr = parseTypeFromQuickInfo(info);
|
|
51
51
|
const type = await context.resolveType(node, typeStr);
|
|
52
52
|
const isOptional = Boolean(node.questionToken);
|
|
53
|
-
return new
|
|
53
|
+
return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, isOptional);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export async function indexSignature(node: IndexSignatureDeclaration, context: SchemaExtractorContext) {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
SchemaNode,
|
|
3
|
+
VariableLikeSchema,
|
|
4
|
+
FunctionLikeSchema,
|
|
5
|
+
Modifier,
|
|
6
|
+
} from '@teambit/semantics.entities.semantic-schema';
|
|
2
7
|
import ts, { Node, VariableDeclaration as VariableDeclarationNode, ArrowFunction } from 'typescript';
|
|
3
8
|
import { SchemaTransformer } from '../schema-transformer';
|
|
4
9
|
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
@@ -35,6 +40,6 @@ export class VariableDeclaration implements SchemaTransformer {
|
|
|
35
40
|
}
|
|
36
41
|
const typeStr = parseTypeFromQuickInfo(info);
|
|
37
42
|
const type = await context.resolveType(varDec, typeStr);
|
|
38
|
-
return new
|
|
43
|
+
return new VariableLikeSchema(location, name, displaySig, type, false);
|
|
39
44
|
}
|
|
40
45
|
}
|
|
Binary file
|