@teambit/typescript 1.0.667 → 1.0.669
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/cmds/check-types.cmd.ts +5 -4
- package/dist/cmds/check-types.cmd.d.ts +4 -4
- package/dist/cmds/check-types.cmd.js.map +1 -1
- package/dist/exceptions/transformer-not-found.d.ts +3 -3
- package/dist/exceptions/transformer-not-found.js.map +1 -1
- package/dist/extractor-options.d.ts +1 -1
- package/dist/extractor-options.js.map +1 -1
- package/dist/identifier-list.d.ts +1 -1
- package/dist/identifier-list.js.map +1 -1
- package/dist/{preview-1753809186996.js → preview-1753848836384.js} +2 -2
- package/dist/remove-types-task.d.ts +1 -1
- package/dist/remove-types-task.js.map +1 -1
- package/dist/schema-extractor-context.d.ts +10 -8
- package/dist/schema-extractor-context.js.map +1 -1
- package/dist/schema-transformer.d.ts +4 -4
- package/dist/schema-transformer.js.map +1 -1
- package/dist/schema-transformer.plugin.d.ts +2 -2
- package/dist/schema-transformer.plugin.js.map +1 -1
- package/dist/sourceFileTransformers/export.d.ts +1 -1
- package/dist/sourceFileTransformers/export.js.map +1 -1
- package/dist/sourceFileTransformers/expression-statement.d.ts +1 -1
- package/dist/sourceFileTransformers/expression-statement.js.map +1 -1
- package/dist/sourceFileTransformers/function.d.ts +1 -1
- package/dist/sourceFileTransformers/function.js.map +1 -1
- package/dist/sourceFileTransformers/import.d.ts +1 -1
- package/dist/sourceFileTransformers/import.js.map +1 -1
- package/dist/sourceFileTransformers/index.d.ts +1 -1
- package/dist/sourceFileTransformers/index.js.map +1 -1
- package/dist/sourceFileTransformers/transform.d.ts +1 -1
- package/dist/sourceFileTransformers/transform.js.map +1 -1
- package/dist/transformers/array-literal-expression.d.ts +4 -4
- package/dist/transformers/array-literal-expression.js.map +1 -1
- package/dist/transformers/array-type.d.ts +4 -4
- package/dist/transformers/array-type.js.map +1 -1
- package/dist/transformers/binding-element.d.ts +3 -3
- package/dist/transformers/binding-element.js.map +1 -1
- package/dist/transformers/class-declaration.d.ts +3 -3
- package/dist/transformers/class-declaration.js.map +1 -1
- package/dist/transformers/conditional-type.d.ts +4 -4
- package/dist/transformers/conditional-type.js.map +1 -1
- package/dist/transformers/constructor.d.ts +4 -4
- package/dist/transformers/constructor.js.map +1 -1
- package/dist/transformers/decorator.d.ts +4 -4
- package/dist/transformers/decorator.js.map +1 -1
- package/dist/transformers/enum-declaration.d.ts +3 -3
- package/dist/transformers/enum-declaration.js.map +1 -1
- package/dist/transformers/export-assignment.d.ts +4 -4
- package/dist/transformers/export-assignment.js.map +1 -1
- package/dist/transformers/export-declaration.d.ts +4 -4
- package/dist/transformers/export-declaration.js.map +1 -1
- package/dist/transformers/expression-statement.d.ts +4 -4
- package/dist/transformers/expression-statement.js.map +1 -1
- package/dist/transformers/function-like.d.ts +4 -4
- package/dist/transformers/function-like.js.map +1 -1
- package/dist/transformers/get-accessor.d.ts +4 -4
- package/dist/transformers/get-accessor.js.map +1 -1
- package/dist/transformers/import-declaration.d.ts +3 -3
- package/dist/transformers/import-declaration.js.map +1 -1
- package/dist/transformers/index-signature.d.ts +4 -4
- package/dist/transformers/index-signature.js.map +1 -1
- package/dist/transformers/indexed-access-type.d.ts +4 -4
- package/dist/transformers/indexed-access-type.js.map +1 -1
- package/dist/transformers/interface-declaration.d.ts +3 -3
- package/dist/transformers/interface-declaration.js.map +1 -1
- package/dist/transformers/intersection-type.d.ts +4 -4
- package/dist/transformers/intersection-type.js.map +1 -1
- package/dist/transformers/keyword-type.d.ts +4 -4
- package/dist/transformers/keyword-type.js.map +1 -1
- package/dist/transformers/literal-type.d.ts +4 -4
- package/dist/transformers/literal-type.js.map +1 -1
- package/dist/transformers/literal-value.d.ts +5 -4
- package/dist/transformers/literal-value.js.map +1 -1
- package/dist/transformers/module-declaration.d.ts +4 -4
- package/dist/transformers/module-declaration.js.map +1 -1
- package/dist/transformers/named-tuple.d.ts +4 -4
- package/dist/transformers/named-tuple.js.map +1 -1
- package/dist/transformers/object-literal-expression.d.ts +2 -2
- package/dist/transformers/object-literal-expression.js.map +1 -1
- package/dist/transformers/parameter.d.ts +6 -5
- package/dist/transformers/parameter.js.map +1 -1
- package/dist/transformers/parenthesized-type.d.ts +4 -4
- package/dist/transformers/parenthesized-type.js.map +1 -1
- package/dist/transformers/property-assignment.d.ts +4 -4
- package/dist/transformers/property-assignment.js.map +1 -1
- package/dist/transformers/property-declaration.d.ts +4 -4
- package/dist/transformers/property-declaration.js.map +1 -1
- package/dist/transformers/set-accessor.d.ts +4 -4
- package/dist/transformers/set-accessor.js.map +1 -1
- package/dist/transformers/source-file-transformer.d.ts +4 -4
- package/dist/transformers/source-file-transformer.js.map +1 -1
- package/dist/transformers/template-literal-type-span.d.ts +4 -4
- package/dist/transformers/template-literal-type-span.js.map +1 -1
- package/dist/transformers/template-literal-type.d.ts +4 -4
- package/dist/transformers/template-literal-type.js.map +1 -1
- package/dist/transformers/this-type.d.ts +4 -4
- package/dist/transformers/this-type.js.map +1 -1
- package/dist/transformers/tuple-type.d.ts +4 -4
- package/dist/transformers/tuple-type.js.map +1 -1
- package/dist/transformers/type-alias.d.ts +3 -3
- package/dist/transformers/type-alias.js.map +1 -1
- package/dist/transformers/type-literal.d.ts +4 -4
- package/dist/transformers/type-literal.js.map +1 -1
- package/dist/transformers/type-operator.d.ts +5 -4
- package/dist/transformers/type-operator.js.map +1 -1
- package/dist/transformers/type-predicate.d.ts +4 -4
- package/dist/transformers/type-predicate.js.map +1 -1
- package/dist/transformers/type-query.d.ts +4 -4
- package/dist/transformers/type-query.js.map +1 -1
- package/dist/transformers/type-reference.d.ts +4 -4
- package/dist/transformers/type-reference.js.map +1 -1
- package/dist/transformers/union-type.d.ts +4 -4
- package/dist/transformers/union-type.js.map +1 -1
- package/dist/transformers/utils/jsdoc-to-doc-schema.d.ts +3 -3
- package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -1
- package/dist/transformers/variable-declaration.d.ts +4 -4
- package/dist/transformers/variable-declaration.js.map +1 -1
- package/dist/transformers/variable-statement.d.ts +4 -4
- package/dist/transformers/variable-statement.js.map +1 -1
- package/dist/typescript.extractor.d.ts +15 -14
- package/dist/typescript.extractor.js.map +1 -1
- package/dist/typescript.main.runtime.d.ts +16 -15
- package/dist/typescript.main.runtime.js.map +1 -1
- package/dist/typescript.parser.d.ts +4 -3
- package/dist/typescript.parser.js.map +1 -1
- package/exceptions/transformer-not-found.ts +4 -3
- package/package.json +19 -19
- package/sourceFileTransformers/export.ts +1 -1
- package/sourceFileTransformers/expression-statement.ts +1 -1
- package/sourceFileTransformers/function.ts +1 -1
- package/sourceFileTransformers/import.ts +1 -1
- package/sourceFileTransformers/index.ts +1 -1
- package/sourceFileTransformers/transform.ts +1 -1
- package/transformers/array-literal-expression.ts +6 -8
- package/transformers/array-type.ts +5 -4
- package/transformers/binding-element.ts +4 -3
- package/transformers/class-declaration.ts +4 -3
- package/transformers/conditional-type.ts +5 -4
- package/transformers/constructor.ts +7 -10
- package/transformers/decorator.ts +6 -4
- package/transformers/enum-declaration.ts +4 -3
- package/transformers/export-assignment.ts +6 -4
- package/transformers/export-declaration.ts +5 -5
- package/transformers/expression-statement.ts +5 -4
- package/transformers/function-like.ts +6 -4
- package/transformers/get-accessor.ts +5 -4
- package/transformers/import-declaration.ts +4 -3
- package/transformers/index-signature.ts +7 -5
- package/transformers/indexed-access-type.ts +5 -4
- package/transformers/interface-declaration.ts +5 -3
- package/transformers/intersection-type.ts +5 -4
- package/transformers/keyword-type.ts +5 -4
- package/transformers/literal-type.ts +5 -4
- package/transformers/literal-value.ts +6 -4
- package/transformers/module-declaration.ts +5 -4
- package/transformers/named-tuple.ts +5 -4
- package/transformers/object-literal-expression.ts +3 -2
- package/transformers/parameter.ts +6 -13
- package/transformers/parenthesized-type.ts +5 -4
- package/transformers/property-assignment.ts +5 -4
- package/transformers/property-declaration.ts +5 -4
- package/transformers/set-accessor.ts +7 -5
- package/transformers/source-file-transformer.ts +5 -4
- package/transformers/template-literal-type-span.ts +5 -4
- package/transformers/template-literal-type.ts +7 -5
- package/transformers/this-type.ts +5 -4
- package/transformers/tuple-type.ts +5 -4
- package/transformers/type-alias.ts +4 -3
- package/transformers/type-literal.ts +5 -4
- package/transformers/type-operator.ts +5 -4
- package/transformers/type-predicate.ts +5 -4
- package/transformers/type-query.ts +5 -4
- package/transformers/type-reference.ts +5 -4
- package/transformers/union-type.ts +5 -4
- package/transformers/utils/jsdoc-to-doc-schema.ts +4 -11
- package/transformers/variable-declaration.ts +5 -5
- package/transformers/variable-statement.ts +6 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Node, ParameterDeclaration } from 'typescript';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { Node, ParameterDeclaration } from 'typescript';
|
|
2
|
+
import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
+
import { ParameterSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
export declare class ParameterTransformer implements SchemaTransformer {
|
|
7
8
|
predicate(node: Node): boolean;
|
|
8
9
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireWildcard","require","_semanticsEntities","_pMapSeries","_interopRequireDefault","_parseTypeFromQuickInfo","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ParameterTransformer","predicate","node","kind","ts","SyntaxKind","Parameter","getIdentifiers","transform","context","type","getType","ParameterSchema","getLocation","getName","Boolean","questionToken","initializer","getText","undefined","getObjectBindingNodes","dotDotDotToken","param","isIdentifier","name","elements","map","elem","elementsStr","join","ArrayBindingPattern","computeSchema","info","getQuickInfo","parsed","parseTypeFromQuickInfo","InferenceTypeSchema","pMapSeries","TupleTypeSchema","ObjectBindingPattern","TypeLiteralSchema","Error","paramType","existing","findNode","trim","__schema","defaultValue","alias","propertyName","isComputedPropertyName","expression","exports"],"sources":["parameter.ts"],"sourcesContent":["import ts, {\n BindingElement,\n isIdentifier,\n Node,\n ParameterDeclaration,\n SyntaxKind,\n ArrayBindingElement,\n isComputedPropertyName,\n} from 'typescript';\nimport {\n InferenceTypeSchema,\n ParameterSchema,\n SchemaNode,\n TupleTypeSchema,\n TypeLiteralSchema,\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 { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport { Identifier } from '../identifier';\n\nexport class ParameterTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.Parameter;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ParameterDeclaration, context: SchemaExtractorContext) {\n const type = await this.getType(node, context);\n return new ParameterSchema(\n context.getLocation(node),\n ParameterTransformer.getName(node),\n type,\n Boolean(node.questionToken) || Boolean(node.initializer),\n node.initializer ? node.initializer.getText() : undefined,\n undefined,\n await ParameterTransformer.getObjectBindingNodes(node, type, context),\n Boolean(node.dotDotDotToken)\n );\n }\n\n static getName(param: ParameterDeclaration): string {\n if (isIdentifier(param.name)) {\n return param.name.getText();\n }\n // it's binding pattern, either an array or an object\n const elements = param.name.elements.map((elem) => elem.getText());\n const elementsStr = elements.join(', ');\n if (param.name.kind === SyntaxKind.ArrayBindingPattern) {\n return `[ ${elementsStr} ]`;\n }\n // it's an object binding\n return `{ ${elementsStr} }`;\n }\n\n async getType(param: ParameterDeclaration, context: SchemaExtractorContext): Promise<SchemaNode> {\n if (param.type) {\n return context.computeSchema(param.type);\n }\n\n if (isIdentifier(param.name)) {\n const info = await context.getQuickInfo(param.name);\n const parsed = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(context.getLocation(param), parsed);\n }\n // it's binding pattern, either an array or an object\n if (param.name.kind === SyntaxKind.ArrayBindingPattern) {\n const elements = await pMapSeries(param.name.elements, async (elem: ArrayBindingElement) => {\n const info = await context.getQuickInfo(elem);\n const parsed = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(context.getLocation(param), parsed);\n });\n return new TupleTypeSchema(context.getLocation(param), elements);\n }\n if (param.name.kind === SyntaxKind.ObjectBindingPattern) {\n const elements = await pMapSeries(param.name.elements, async (elem: BindingElement) => {\n const info = await context.getQuickInfo(elem.name);\n const parsed = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(context.getLocation(param), parsed, elem.name.getText());\n });\n return new TypeLiteralSchema(context.getLocation(param), elements);\n }\n throw new Error(`unknown param type`);\n }\n\n static async getObjectBindingNodes(\n param: ParameterDeclaration,\n paramType: SchemaNode,\n context: SchemaExtractorContext\n ): Promise<SchemaNode[] | undefined> {\n if (param.name.kind !== SyntaxKind.ObjectBindingPattern) return undefined;\n return pMapSeries(param.name.elements, async (elem: BindingElement) => {\n const existing = paramType.findNode?.((node) => {\n return node.name === elem.name.getText().trim();\n });\n if (existing && existing.__schema !== 'InferenceTypeSchema') {\n return existing;\n }\n const info = await context.getQuickInfo(elem.name);\n const parsed = info ? parseTypeFromQuickInfo(info) : elem.getText();\n const defaultValue = elem.initializer ? elem.initializer.getText() : undefined;\n const alias =\n elem.propertyName && isComputedPropertyName(elem.propertyName)\n ? elem.propertyName?.expression.getText()\n : undefined;\n\n const name = elem.name.getText();\n return new InferenceTypeSchema(\n context.getLocation(elem.name),\n parsed,\n name,\n defaultValue,\n Boolean(elem.dotDotDotToken),\n alias\n );\n });\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,O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AAIF,QAAQ,IAAIA,QAAQ,CAACG,QAAQ,KAAK,qBAAqB,EAAE;QAC3D,OAAOH,QAAQ;MACjB;MACA,MAAMX,IAAI,GAAG,MAAMvB,OAAO,CAACwB,YAAY,CAACN,IAAI,CAACH,IAAI,CAAC;MAClD,MAAMU,MAAM,GAAGF,IAAI,GAAG,IAAAG,gDAAsB,EAACH,IAAI,CAAC,GAAGL,IAAI,CAACT,OAAO,CAAC,CAAC;MACnE,MAAM6B,YAAY,GAAGpB,IAAI,CAACV,WAAW,GAAGU,IAAI,CAACV,WAAW,CAACC,OAAO,CAAC,CAAC,GAAGC,SAAS;MAC9E,MAAM6B,KAAK,GACTrB,IAAI,CAACsB,YAAY,IAAI,IAAAC,oCAAsB,EAACvB,IAAI,CAACsB,YAAY,CAAC,GAC1DtB,IAAI,CAACsB,YAAY,EAAEE,UAAU,CAACjC,OAAO,CAAC,CAAC,GACvCC,SAAS;MAEf,MAAMK,IAAI,GAAGG,IAAI,CAACH,IAAI,CAACN,OAAO,CAAC,CAAC;MAChC,OAAO,KAAIkB,wCAAmB,EAC5B3B,OAAO,CAACI,WAAW,CAACc,IAAI,CAACH,IAAI,CAAC,EAC9BU,MAAM,EACNV,IAAI,EACJuB,YAAY,EACZhC,OAAO,CAACY,IAAI,CAACN,cAAc,CAAC,EAC5B2B,KACF,CAAC;IACH,CAAC,CAAC;EACJ;AACF;AAACI,OAAA,CAAApD,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireWildcard","require","_semanticsEntities","_pMapSeries","_interopRequireDefault","_parseTypeFromQuickInfo","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ParameterTransformer","predicate","node","kind","ts","SyntaxKind","Parameter","getIdentifiers","transform","context","type","getType","ParameterSchema","getLocation","getName","Boolean","questionToken","initializer","getText","undefined","getObjectBindingNodes","dotDotDotToken","param","isIdentifier","name","elements","map","elem","elementsStr","join","ArrayBindingPattern","computeSchema","info","getQuickInfo","parsed","parseTypeFromQuickInfo","InferenceTypeSchema","pMapSeries","TupleTypeSchema","ObjectBindingPattern","TypeLiteralSchema","Error","paramType","existing","findNode","trim","__schema","defaultValue","alias","propertyName","isComputedPropertyName","expression","exports"],"sources":["parameter.ts"],"sourcesContent":["import type { BindingElement, Node, ParameterDeclaration, ArrayBindingElement } from 'typescript';\nimport ts, { isIdentifier, SyntaxKind, isComputedPropertyName } from 'typescript';\nimport type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';\nimport {\n InferenceTypeSchema,\n ParameterSchema,\n TupleTypeSchema,\n TypeLiteralSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport type { Identifier } from '../identifier';\n\nexport class ParameterTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.Parameter;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ParameterDeclaration, context: SchemaExtractorContext) {\n const type = await this.getType(node, context);\n return new ParameterSchema(\n context.getLocation(node),\n ParameterTransformer.getName(node),\n type,\n Boolean(node.questionToken) || Boolean(node.initializer),\n node.initializer ? node.initializer.getText() : undefined,\n undefined,\n await ParameterTransformer.getObjectBindingNodes(node, type, context),\n Boolean(node.dotDotDotToken)\n );\n }\n\n static getName(param: ParameterDeclaration): string {\n if (isIdentifier(param.name)) {\n return param.name.getText();\n }\n // it's binding pattern, either an array or an object\n const elements = param.name.elements.map((elem) => elem.getText());\n const elementsStr = elements.join(', ');\n if (param.name.kind === SyntaxKind.ArrayBindingPattern) {\n return `[ ${elementsStr} ]`;\n }\n // it's an object binding\n return `{ ${elementsStr} }`;\n }\n\n async getType(param: ParameterDeclaration, context: SchemaExtractorContext): Promise<SchemaNode> {\n if (param.type) {\n return context.computeSchema(param.type);\n }\n\n if (isIdentifier(param.name)) {\n const info = await context.getQuickInfo(param.name);\n const parsed = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(context.getLocation(param), parsed);\n }\n // it's binding pattern, either an array or an object\n if (param.name.kind === SyntaxKind.ArrayBindingPattern) {\n const elements = await pMapSeries(param.name.elements, async (elem: ArrayBindingElement) => {\n const info = await context.getQuickInfo(elem);\n const parsed = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(context.getLocation(param), parsed);\n });\n return new TupleTypeSchema(context.getLocation(param), elements);\n }\n if (param.name.kind === SyntaxKind.ObjectBindingPattern) {\n const elements = await pMapSeries(param.name.elements, async (elem: BindingElement) => {\n const info = await context.getQuickInfo(elem.name);\n const parsed = parseTypeFromQuickInfo(info);\n return new InferenceTypeSchema(context.getLocation(param), parsed, elem.name.getText());\n });\n return new TypeLiteralSchema(context.getLocation(param), elements);\n }\n throw new Error(`unknown param type`);\n }\n\n static async getObjectBindingNodes(\n param: ParameterDeclaration,\n paramType: SchemaNode,\n context: SchemaExtractorContext\n ): Promise<SchemaNode[] | undefined> {\n if (param.name.kind !== SyntaxKind.ObjectBindingPattern) return undefined;\n return pMapSeries(param.name.elements, async (elem: BindingElement) => {\n const existing = paramType.findNode?.((node) => {\n return node.name === elem.name.getText().trim();\n });\n if (existing && existing.__schema !== 'InferenceTypeSchema') {\n return existing;\n }\n const info = await context.getQuickInfo(elem.name);\n const parsed = info ? parseTypeFromQuickInfo(info) : elem.getText();\n const defaultValue = elem.initializer ? elem.initializer.getText() : undefined;\n const alias =\n elem.propertyName && isComputedPropertyName(elem.propertyName)\n ? elem.propertyName?.expression.getText()\n : undefined;\n\n const name = elem.name.getText();\n return new InferenceTypeSchema(\n context.getLocation(elem.name),\n parsed,\n name,\n defaultValue,\n Boolean(elem.dotDotDotToken),\n alias\n );\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA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H,IAAI,CAACN,OAAO,CAAC,CAAC,CAAC2B,IAAI,CAAC,CAAC;MACjD,CAAC,CAAC;MACF,IAAIF,QAAQ,IAAIA,QAAQ,CAACG,QAAQ,KAAK,qBAAqB,EAAE;QAC3D,OAAOH,QAAQ;MACjB;MACA,MAAMX,IAAI,GAAG,MAAMvB,OAAO,CAACwB,YAAY,CAACN,IAAI,CAACH,IAAI,CAAC;MAClD,MAAMU,MAAM,GAAGF,IAAI,GAAG,IAAAG,gDAAsB,EAACH,IAAI,CAAC,GAAGL,IAAI,CAACT,OAAO,CAAC,CAAC;MACnE,MAAM6B,YAAY,GAAGpB,IAAI,CAACV,WAAW,GAAGU,IAAI,CAACV,WAAW,CAACC,OAAO,CAAC,CAAC,GAAGC,SAAS;MAC9E,MAAM6B,KAAK,GACTrB,IAAI,CAACsB,YAAY,IAAI,IAAAC,oCAAsB,EAACvB,IAAI,CAACsB,YAAY,CAAC,GAC1DtB,IAAI,CAACsB,YAAY,EAAEE,UAAU,CAACjC,OAAO,CAAC,CAAC,GACvCC,SAAS;MAEf,MAAMK,IAAI,GAAGG,IAAI,CAACH,IAAI,CAACN,OAAO,CAAC,CAAC;MAChC,OAAO,KAAIkB,wCAAmB,EAC5B3B,OAAO,CAACI,WAAW,CAACc,IAAI,CAACH,IAAI,CAAC,EAC9BU,MAAM,EACNV,IAAI,EACJuB,YAAY,EACZhC,OAAO,CAACY,IAAI,CAACN,cAAc,CAAC,EAC5B2B,KACF,CAAC;IACH,CAAC,CAAC;EACJ;AACF;AAACI,OAAA,CAAApD,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, ParenthesizedTypeNode } from 'typescript';
|
|
1
|
+
import type { Node, ParenthesizedTypeNode } from 'typescript';
|
|
2
2
|
import { ParenthesizedTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class ParenthesizedTypeTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","ParenthesizedTypeTransformer","predicate","node","kind","SyntaxKind","ParenthesizedType","getIdentifiers","transform","context","type","computeSchema","ParenthesizedTypeSchema","getLocation","exports"],"sources":["parenthesized-type.ts"],"sourcesContent":["import { Node, ParenthesizedTypeNode
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","ParenthesizedTypeTransformer","predicate","node","kind","SyntaxKind","ParenthesizedType","getIdentifiers","transform","context","type","computeSchema","ParenthesizedTypeSchema","getLocation","exports"],"sources":["parenthesized-type.ts"],"sourcesContent":["import type { Node, ParenthesizedTypeNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport { ParenthesizedTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class ParenthesizedTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ParenthesizedType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ParenthesizedTypeNode, context: SchemaExtractorContext) {\n const type = await context.computeSchema(node.type);\n return new ParenthesizedTypeSchema(context.getLocation(node), type);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKO,MAAMG,4BAA4B,CAA8B;EACrEC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,iBAAiB;EACnD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAA2B,EAAEM,OAA+B,EAAE;IAC5E,MAAMC,IAAI,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACR,IAAI,CAACO,IAAI,CAAC;IACnD,OAAO,KAAIE,4CAAuB,EAACH,OAAO,CAACI,WAAW,CAACV,IAAI,CAAC,EAAEO,IAAI,CAAC;EACrE;AACF;AAACI,OAAA,CAAAb,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Node, PropertyAssignment } from 'typescript';
|
|
2
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { Identifier } from '../identifier';
|
|
1
|
+
import type { Node, PropertyAssignment } from 'typescript';
|
|
2
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { Identifier } from '../identifier';
|
|
5
5
|
export declare class PropertyAssignmentTransformer implements SchemaTransformer {
|
|
6
6
|
predicate(node: Node): boolean;
|
|
7
7
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_semanticsEntities","data","require","_typescript","_interopRequireDefault","e","__esModule","default","PropertyAssignmentTransformer","predicate","node","kind","ts","SyntaxKind","PropertyAssignment","getIdentifiers","transform","context","name","getText","value","computeSchema","initializer","location","getLocation","docs","jsDocToDocSchema","PropertyAssignmentSchema","exports"],"sources":["property-assignment.ts"],"sourcesContent":["import { PropertyAssignmentSchema } from '@teambit/semantics.entities.semantic-schema';\nimport
|
|
1
|
+
{"version":3,"names":["_semanticsEntities","data","require","_typescript","_interopRequireDefault","e","__esModule","default","PropertyAssignmentTransformer","predicate","node","kind","ts","SyntaxKind","PropertyAssignment","getIdentifiers","transform","context","name","getText","value","computeSchema","initializer","location","getLocation","docs","jsDocToDocSchema","PropertyAssignmentSchema","exports"],"sources":["property-assignment.ts"],"sourcesContent":["import { PropertyAssignmentSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { Node, PropertyAssignment } from 'typescript';\nimport ts from 'typescript';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { Identifier } from '../identifier';\n\nexport class PropertyAssignmentTransformer implements SchemaTransformer {\n predicate(node: Node): boolean {\n return node.kind === ts.SyntaxKind.PropertyAssignment;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: PropertyAssignment, context: SchemaExtractorContext): Promise<any> {\n const name = node.name.getText();\n const value = await context.computeSchema(node.initializer);\n const location = context.getLocation(node);\n const docs = await context.jsDocToDocSchema(node);\n return new PropertyAssignmentSchema(name, value, location, docs);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4B,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKrB,MAAMG,6BAA6B,CAA8B;EACtEC,SAASA,CAACC,IAAU,EAAW;IAC7B,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,kBAAkB;EACvD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACN,IAAwB,EAAEO,OAA+B,EAAgB;IACvF,MAAMC,IAAI,GAAGR,IAAI,CAACQ,IAAI,CAACC,OAAO,CAAC,CAAC;IAChC,MAAMC,KAAK,GAAG,MAAMH,OAAO,CAACI,aAAa,CAACX,IAAI,CAACY,WAAW,CAAC;IAC3D,MAAMC,QAAQ,GAAGN,OAAO,CAACO,WAAW,CAACd,IAAI,CAAC;IAC1C,MAAMe,IAAI,GAAG,MAAMR,OAAO,CAACS,gBAAgB,CAAChB,IAAI,CAAC;IACjD,OAAO,KAAIiB,6CAAwB,EAACT,IAAI,EAAEE,KAAK,EAAEG,QAAQ,EAAEE,IAAI,CAAC;EAClE;AACF;AAACG,OAAA,CAAApB,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, PropertyDeclaration, PropertySignature } from 'typescript';
|
|
1
|
+
import type { Node, PropertyDeclaration, PropertySignature } from 'typescript';
|
|
2
2
|
import { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class PropertyDeclarationTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","_parseTypeFromQuickInfo","PropertyDeclarationTransformer","predicate","node","kind","SyntaxKind","PropertyDeclaration","PropertySignature","getIdentifiers","isComputedProperty","name","ComputedPropertyName","transform","context","getText","info","undefined","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","isPropertyDeclaration","initializer","doc","jsDocToDocSchema","defaultValue","VariableLikeSchema","getLocation","exports"],"sources":["property-declaration.ts"],"sourcesContent":["import { Node, PropertyDeclaration, PropertySignature
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","_parseTypeFromQuickInfo","PropertyDeclarationTransformer","predicate","node","kind","SyntaxKind","PropertyDeclaration","PropertySignature","getIdentifiers","isComputedProperty","name","ComputedPropertyName","transform","context","getText","info","undefined","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","isPropertyDeclaration","initializer","doc","jsDocToDocSchema","defaultValue","VariableLikeSchema","getLocation","exports"],"sources":["property-declaration.ts"],"sourcesContent":["import type { Node, PropertyDeclaration, PropertySignature } from 'typescript';\nimport { SyntaxKind, isPropertyDeclaration } from 'typescript';\nimport { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport type { Identifier } from '../identifier';\n\nexport class PropertyDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n // [computedName]: string\n private isComputedProperty(node: PropertyDeclaration | PropertySignature) {\n return node.name.kind === SyntaxKind.ComputedPropertyName;\n }\n\n // @todo - handle arrow function objects\n async transform(node: PropertyDeclaration | PropertySignature, context: SchemaExtractorContext) {\n const name = node.name.getText();\n const info = this.isComputedProperty(node) ? undefined : await context.getQuickInfo(node.name);\n const displaySig = info?.body?.displayString || node.getText();\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(node, typeStr);\n const isOptional = Boolean(node.questionToken) || (isPropertyDeclaration(node) && Boolean(node.initializer));\n const doc = await context.jsDocToDocSchema(node);\n const defaultValue = isPropertyDeclaration(node) ? node.initializer?.getText() : undefined;\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, isOptional, doc, defaultValue);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAG,wBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,uBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAMI,8BAA8B,CAA8B;EACvEC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,mBAAmB,IAAIH,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACE,iBAAiB;EACnG;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;;EAEA;EACQC,kBAAkBA,CAACN,IAA6C,EAAE;IACxE,OAAOA,IAAI,CAACO,IAAI,CAACN,IAAI,KAAKC,wBAAU,CAACM,oBAAoB;EAC3D;;EAEA;EACA,MAAMC,SAASA,CAACT,IAA6C,EAAEU,OAA+B,EAAE;IAC9F,MAAMH,IAAI,GAAGP,IAAI,CAACO,IAAI,CAACI,OAAO,CAAC,CAAC;IAChC,MAAMC,IAAI,GAAG,IAAI,CAACN,kBAAkB,CAACN,IAAI,CAAC,GAAGa,SAAS,GAAG,MAAMH,OAAO,CAACI,YAAY,CAACd,IAAI,CAACO,IAAI,CAAC;IAC9F,MAAMQ,UAAU,GAAGH,IAAI,EAAEI,IAAI,EAAEC,aAAa,IAAIjB,IAAI,CAACW,OAAO,CAAC,CAAC;IAC9D,MAAMO,OAAO,GAAG,IAAAC,gDAAsB,EAACP,IAAI,CAAC;IAC5C,MAAMQ,IAAI,GAAG,MAAMV,OAAO,CAACW,WAAW,CAACrB,IAAI,EAAEkB,OAAO,CAAC;IACrD,MAAMI,UAAU,GAAGC,OAAO,CAACvB,IAAI,CAACwB,aAAa,CAAC,IAAK,IAAAC,mCAAqB,EAACzB,IAAI,CAAC,IAAIuB,OAAO,CAACvB,IAAI,CAAC0B,WAAW,CAAE;IAC5G,MAAMC,GAAG,GAAG,MAAMjB,OAAO,CAACkB,gBAAgB,CAAC5B,IAAI,CAAC;IAChD,MAAM6B,YAAY,GAAG,IAAAJ,mCAAqB,EAACzB,IAAI,CAAC,GAAGA,IAAI,CAAC0B,WAAW,EAAEf,OAAO,CAAC,CAAC,GAAGE,SAAS;IAC1F,OAAO,KAAIiB,uCAAkB,EAACpB,OAAO,CAACqB,WAAW,CAAC/B,IAAI,CAAC,EAAEO,IAAI,EAAEQ,UAAU,EAAEK,IAAI,EAAEE,UAAU,EAAEK,GAAG,EAAEE,YAAY,CAAC;EACjH;AACF;AAACG,OAAA,CAAAlC,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, SetAccessorDeclaration } from 'typescript';
|
|
1
|
+
import type { Node, SetAccessorDeclaration } from 'typescript';
|
|
2
2
|
import { SetAccessorSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class SetAccessorTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","e","__esModule","default","SetAccessorTransformer","predicate","node","kind","ts","SyntaxKind","SetAccessor","getIdentifiers","transform","context","params","pMapSeries","parameters","param","computeSchema","displaySig","getQuickInfoDisplayString","name","SetAccessorSchema","getLocation","getText","exports"],"sources":["set-accessor.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","e","__esModule","default","SetAccessorTransformer","predicate","node","kind","ts","SyntaxKind","SetAccessor","getIdentifiers","transform","context","params","pMapSeries","parameters","param","computeSchema","displaySig","getQuickInfoDisplayString","name","SetAccessorSchema","getLocation","getText","exports"],"sources":["set-accessor.ts"],"sourcesContent":["import type { Node, SetAccessorDeclaration } from 'typescript';\nimport ts from 'typescript';\nimport type { ParameterSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SetAccessorSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class SetAccessorTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.SetAccessor;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: SetAccessorDeclaration, context: SchemaExtractorContext) {\n const params = (await pMapSeries(node.parameters, async (param) =>\n context.computeSchema(param)\n )) as ParameterSchema[];\n\n const displaySig = await context.getQuickInfoDisplayString(node.name);\n return new SetAccessorSchema(context.getLocation(node), node.name.getText(), params[0], displaySig);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK/B,MAAMG,sBAAsB,CAA8B;EAC/DC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,WAAW;EAChD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACN,IAA4B,EAAEO,OAA+B,EAAE;IAC7E,MAAMC,MAAM,GAAI,MAAM,IAAAC,qBAAU,EAACT,IAAI,CAACU,UAAU,EAAE,MAAOC,KAAK,IAC5DJ,OAAO,CAACK,aAAa,CAACD,KAAK,CAC7B,CAAuB;IAEvB,MAAME,UAAU,GAAG,MAAMN,OAAO,CAACO,yBAAyB,CAACd,IAAI,CAACe,IAAI,CAAC;IACrE,OAAO,KAAIC,sCAAiB,EAACT,OAAO,CAACU,WAAW,CAACjB,IAAI,CAAC,EAAEA,IAAI,CAACe,IAAI,CAACG,OAAO,CAAC,CAAC,EAAEV,MAAM,CAAC,CAAC,CAAC,EAAEK,UAAU,CAAC;EACrG;AACF;AAACM,OAAA,CAAArB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, SourceFile } from 'typescript';
|
|
1
|
+
import type { Node, SourceFile } from 'typescript';
|
|
2
2
|
import { ModuleSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class SourceFileTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(sourceFile: SourceFile, context: SchemaExtractorContext): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_lodash","_pMapSeries","_semanticsEntities","_exportIdentifier","e","__esModule","default","SourceFileTransformer","predicate","node","kind","ts","SyntaxKind","SourceFile","getIdentifiers","sourceFile","context","exports","listExports","internals","listInternalNodes","exportIdentifiers","flatten","pMapSeries","reduce","acc","current","item","find","exportIdentifier","isEqual","push","ExportIdentifier","id","filePath","aliasId","sourceFilePath","internalIdentifiers","internalIdentifier","identifiers","transform","filter","internal","ImportDeclaration","exportDeclarations","exportNode","computeSchema","internalDeclarations","internalNode","ModuleSchema","getLocation","ast","statements","statement","ExportDeclaration","ExportAssignment","modifiers","canHaveModifiers","getModifiers","undefined","isExport","Boolean","modifier","ExportKeyword"],"sources":["source-file-transformer.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_lodash","_pMapSeries","_semanticsEntities","_exportIdentifier","e","__esModule","default","SourceFileTransformer","predicate","node","kind","ts","SyntaxKind","SourceFile","getIdentifiers","sourceFile","context","exports","listExports","internals","listInternalNodes","exportIdentifiers","flatten","pMapSeries","reduce","acc","current","item","find","exportIdentifier","isEqual","push","ExportIdentifier","id","filePath","aliasId","sourceFilePath","internalIdentifiers","internalIdentifier","identifiers","transform","filter","internal","ImportDeclaration","exportDeclarations","exportNode","computeSchema","internalDeclarations","internalNode","ModuleSchema","getLocation","ast","statements","statement","ExportDeclaration","ExportAssignment","modifiers","canHaveModifiers","getModifiers","undefined","isExport","Boolean","modifier","ExportKeyword"],"sources":["source-file-transformer.ts"],"sourcesContent":["import type { Node, SourceFile } from 'typescript';\nimport ts from 'typescript';\nimport { flatten } from 'lodash';\nimport pMapSeries from 'p-map-series';\nimport { ModuleSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport { ExportIdentifier } from '../export-identifier';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class SourceFileTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.SourceFile;\n }\n\n async getIdentifiers(sourceFile: SourceFile, context: SchemaExtractorContext) {\n const exports = this.listExports(sourceFile);\n const internals = this.listInternalNodes(sourceFile);\n\n // change to pMap series\n const exportIdentifiers = flatten(\n await pMapSeries(exports, (node) => {\n return context.getIdentifiers(node);\n })\n ).reduce<ExportIdentifier[]>((acc, current) => {\n const item = acc.find((exportIdentifier) => exportIdentifier.isEqual(current));\n if (!item) acc.push(new ExportIdentifier(current.id, current.filePath, current.aliasId, current.sourceFilePath));\n return acc;\n }, []);\n\n const internalIdentifiers = flatten(\n await pMapSeries(internals, (node) => {\n return context.getIdentifiers(node);\n })\n ).reduce<Identifier[]>((acc, current) => {\n const item = acc.find((internalIdentifier) => internalIdentifier.isEqual(current));\n if (!item) acc.push(current);\n return acc;\n }, []);\n\n const identifiers = [...exportIdentifiers, ...internalIdentifiers];\n\n return identifiers;\n }\n\n async transform(node: SourceFile, context: SchemaExtractorContext) {\n const exports = this.listExports(node);\n const internals = this.listInternalNodes(node).filter(\n (internal) => internal.kind !== ts.SyntaxKind.ImportDeclaration\n );\n\n const exportDeclarations = await pMapSeries(exports, (exportNode) => {\n return context.computeSchema(exportNode);\n });\n\n const internalDeclarations = await pMapSeries(internals, (internalNode) => {\n return context.computeSchema(internalNode);\n });\n\n return new ModuleSchema(context.getLocation(node), exportDeclarations, internalDeclarations);\n }\n\n /**\n * list all exports of a source file.\n */\n private listExports(ast: SourceFile): Node[] {\n return ast.statements.filter((statement) => {\n if (statement.kind === ts.SyntaxKind.ExportDeclaration || statement.kind === ts.SyntaxKind.ExportAssignment)\n return true;\n const modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined;\n const isExport = Boolean(\n modifiers?.find((modifier) => {\n return modifier.kind === ts.SyntaxKind.ExportKeyword;\n })\n );\n return isExport;\n });\n }\n\n private listInternalNodes(ast: SourceFile): Node[] {\n return ast.statements.filter((statement) => {\n const modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined;\n if (\n !(statement.kind === ts.SyntaxKind.ExportDeclaration || statement.kind === ts.SyntaxKind.ExportAssignment) &&\n !modifiers?.find((modifier) => {\n return modifier.kind === ts.SyntaxKind.ExportKeyword;\n })\n ) {\n return true;\n }\n\n return false;\n });\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,G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I,CAAEkC,QAAQ,IAAK;QAC7B,OAAOA,QAAQ,CAACpD,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACmD,aAAa;MACtD,CAAC,CAAC,EACF;QACA,OAAO,IAAI;MACb;MAEA,OAAO,KAAK;IACd,CAAC,CAAC;EACJ;AACF;AAAC9C,OAAA,CAAAV,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, TemplateLiteralTypeSpan } from 'typescript';
|
|
1
|
+
import type { Node, TemplateLiteralTypeSpan } from 'typescript';
|
|
2
2
|
import { TemplateLiteralTypeSpanSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class TemplateLiteralTypeSpanTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","TemplateLiteralTypeSpanTransformer","predicate","node","kind","SyntaxKind","TemplateLiteralTypeSpan","getIdentifiers","transform","context","type","computeSchema","literal","text","TemplateLiteralTypeSpanSchema","getLocation","exports"],"sources":["template-literal-type-span.ts"],"sourcesContent":["import { Node,
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","TemplateLiteralTypeSpanTransformer","predicate","node","kind","SyntaxKind","TemplateLiteralTypeSpan","getIdentifiers","transform","context","type","computeSchema","literal","text","TemplateLiteralTypeSpanSchema","getLocation","exports"],"sources":["template-literal-type-span.ts"],"sourcesContent":["import type { Node, TemplateLiteralTypeSpan } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport { TemplateLiteralTypeSpanSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class TemplateLiteralTypeSpanTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.TemplateLiteralTypeSpan;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TemplateLiteralTypeSpan, context: SchemaExtractorContext) {\n const type = await context.computeSchema(node.type);\n const literal = node.literal.text;\n return new TemplateLiteralTypeSpanSchema(context.getLocation(node), literal, type);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKO,MAAMG,kCAAkC,CAA8B;EAC3EC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,uBAAuB;EACzD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAA6B,EAAEM,OAA+B,EAAE;IAC9E,MAAMC,IAAI,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACR,IAAI,CAACO,IAAI,CAAC;IACnD,MAAME,OAAO,GAAGT,IAAI,CAACS,OAAO,CAACC,IAAI;IACjC,OAAO,KAAIC,kDAA6B,EAACL,OAAO,CAACM,WAAW,CAACZ,IAAI,CAAC,EAAES,OAAO,EAAEF,IAAI,CAAC;EACpF;AACF;AAACM,OAAA,CAAAf,kCAAA,GAAAA,kCAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, TemplateLiteralTypeNode } from 'typescript';
|
|
1
|
+
import type { Node, TemplateLiteralTypeNode } from 'typescript';
|
|
2
2
|
import { TemplateLiteralTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class TemplateLiteralTypeTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","e","__esModule","default","TemplateLiteralTypeTransformer","predicate","node","kind","SyntaxKind","TemplateLiteralType","getIdentifiers","transform","context","templateSpans","pMapSeries","span","computeSchema","head","text","TemplateLiteralTypeSchema","getLocation","exports"],"sources":["template-literal-type.ts"],"sourcesContent":["import { Node,
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","e","__esModule","default","TemplateLiteralTypeTransformer","predicate","node","kind","SyntaxKind","TemplateLiteralType","getIdentifiers","transform","context","templateSpans","pMapSeries","span","computeSchema","head","text","TemplateLiteralTypeSchema","getLocation","exports"],"sources":["template-literal-type.ts"],"sourcesContent":["import type { Node, TemplateLiteralTypeNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport type { TemplateLiteralTypeSpanSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { TemplateLiteralTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class TemplateLiteralTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.TemplateLiteralType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TemplateLiteralTypeNode, context: SchemaExtractorContext) {\n const templateSpans = (await pMapSeries(node.templateSpans, (span) =>\n context.computeSchema(span)\n )) as TemplateLiteralTypeSpanSchema[];\n const head = node.head.text;\n return new TemplateLiteralTypeSchema(context.getLocation(node), head, templateSpans);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,mBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwF,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKjF,MAAMG,8BAA8B,CAA8B;EACvEC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,mBAAmB;EACrD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAA6B,EAAEM,OAA+B,EAAE;IAC9E,MAAMC,aAAa,GAAI,MAAM,IAAAC,qBAAU,EAACR,IAAI,CAACO,aAAa,EAAGE,IAAI,IAC/DH,OAAO,CAACI,aAAa,CAACD,IAAI,CAC5B,CAAqC;IACrC,MAAME,IAAI,GAAGX,IAAI,CAACW,IAAI,CAACC,IAAI;IAC3B,OAAO,KAAIC,8CAAyB,EAACP,OAAO,CAACQ,WAAW,CAACd,IAAI,CAAC,EAAEW,IAAI,EAAEJ,aAAa,CAAC;EACtF;AACF;AAACQ,OAAA,CAAAjB,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, ThisTypeNode } from 'typescript';
|
|
1
|
+
import type { Node, ThisTypeNode } from 'typescript';
|
|
2
2
|
import { ThisTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class ThisTypeTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","ThisTypeTransformer","predicate","node","kind","SyntaxKind","ThisType","getIdentifiers","transform","context","ThisTypeSchema","getLocation","exports"],"sources":["this-type.ts"],"sourcesContent":["import { Node,
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","ThisTypeTransformer","predicate","node","kind","SyntaxKind","ThisType","getIdentifiers","transform","context","ThisTypeSchema","getLocation","exports"],"sources":["this-type.ts"],"sourcesContent":["import type { Node, ThisTypeNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport { ThisTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class ThisTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ThisType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ThisTypeNode, context: SchemaExtractorContext) {\n return new ThisTypeSchema(context.getLocation(node), 'this');\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKO,MAAMG,mBAAmB,CAA8B;EAC5DC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,QAAQ;EAC1C;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAAkB,EAAEM,OAA+B,EAAE;IACnE,OAAO,KAAIC,mCAAc,EAACD,OAAO,CAACE,WAAW,CAACR,IAAI,CAAC,EAAE,MAAM,CAAC;EAC9D;AACF;AAACS,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, TupleTypeNode } from 'typescript';
|
|
1
|
+
import type { Node, TupleTypeNode } from 'typescript';
|
|
2
2
|
import { TupleTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class TupleTypeTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","e","__esModule","default","TupleTypeTransformer","predicate","node","kind","SyntaxKind","TupleType","getIdentifiers","transform","context","elements","pMapSeries","elem","typeSchema","computeSchema","TupleTypeSchema","getLocation","exports"],"sources":["tuple-type.ts"],"sourcesContent":["import { Node,
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","e","__esModule","default","TupleTypeTransformer","predicate","node","kind","SyntaxKind","TupleType","getIdentifiers","transform","context","elements","pMapSeries","elem","typeSchema","computeSchema","TupleTypeSchema","getLocation","exports"],"sources":["tuple-type.ts"],"sourcesContent":["import type { Node, TupleTypeNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport { TupleTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class TupleTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.TupleType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TupleTypeNode, context: SchemaExtractorContext) {\n const elements = await pMapSeries(node.elements, async (elem) => {\n const typeSchema = await context.computeSchema(elem);\n return typeSchema;\n });\n return new TupleTypeSchema(context.getLocation(node), elements);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,mBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8E,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKvE,MAAMG,oBAAoB,CAA8B;EAC7DC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,SAAS;EAC3C;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAAmB,EAAEM,OAA+B,EAAE;IACpE,MAAMC,QAAQ,GAAG,MAAM,IAAAC,qBAAU,EAACR,IAAI,CAACO,QAAQ,EAAE,MAAOE,IAAI,IAAK;MAC/D,MAAMC,UAAU,GAAG,MAAMJ,OAAO,CAACK,aAAa,CAACF,IAAI,CAAC;MACpD,OAAOC,UAAU;IACnB,CAAC,CAAC;IACF,OAAO,KAAIE,oCAAe,EAACN,OAAO,CAACO,WAAW,CAACb,IAAI,CAAC,EAAEO,QAAQ,CAAC;EACjE;AACF;AAACO,OAAA,CAAAhB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Node, TypeAliasDeclaration } from 'typescript';
|
|
1
|
+
import type { Node, TypeAliasDeclaration } from 'typescript';
|
|
2
2
|
import { TypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
5
|
import { Identifier } from '../identifier';
|
|
6
6
|
export declare class TypeAliasTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_identifier","e","__esModule","default","TypeAliasTransformer","predicate","node","kind","ts","SyntaxKind","TypeAliasDeclaration","getIdentifiers","Identifier","name","getText","getSourceFile","fileName","getName","transform","typeAlias","context","type","computeSchema","displaySig","getQuickInfoDisplayString","doc","jsDocToDocSchema","TypeSchema","getLocation","exports"],"sources":["type-alias.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_identifier","e","__esModule","default","TypeAliasTransformer","predicate","node","kind","ts","SyntaxKind","TypeAliasDeclaration","getIdentifiers","Identifier","name","getText","getSourceFile","fileName","getName","transform","typeAlias","context","type","computeSchema","displaySig","getQuickInfoDisplayString","doc","jsDocToDocSchema","TypeSchema","getLocation","exports"],"sources":["type-alias.ts"],"sourcesContent":["import type { Node, TypeAliasDeclaration } from 'typescript';\nimport ts from 'typescript';\nimport { TypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class TypeAliasTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.TypeAliasDeclaration;\n }\n\n async getIdentifiers(node: TypeAliasDeclaration) {\n return [new Identifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n private getName(node: TypeAliasDeclaration): string {\n return node.name.getText();\n }\n\n async transform(typeAlias: TypeAliasDeclaration, context: SchemaExtractorContext) {\n const type = await context.computeSchema(typeAlias.type);\n const displaySig = await context.getQuickInfoDisplayString(typeAlias.name);\n const doc = await context.jsDocToDocSchema(typeAlias);\n return new TypeSchema(context.getLocation(typeAlias), this.getName(typeAlias), type, displaySig, doc);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2C,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,MAAMG,oBAAoB,CAA8B;EAC7DC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,oBAAoB;EACzD;EAEA,MAAMC,cAAcA,CAACL,IAA0B,EAAE;IAC/C,OAAO,CAAC,KAAIM,wBAAU,EAACN,IAAI,CAACO,IAAI,CAACC,OAAO,CAAC,CAAC,EAAER,IAAI,CAACS,aAAa,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC7E;EAEQC,OAAOA,CAACX,IAA0B,EAAU;IAClD,OAAOA,IAAI,CAACO,IAAI,CAACC,OAAO,CAAC,CAAC;EAC5B;EAEA,MAAMI,SAASA,CAACC,SAA+B,EAAEC,OAA+B,EAAE;IAChF,MAAMC,IAAI,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACH,SAAS,CAACE,IAAI,CAAC;IACxD,MAAME,UAAU,GAAG,MAAMH,OAAO,CAACI,yBAAyB,CAACL,SAAS,CAACN,IAAI,CAAC;IAC1E,MAAMY,GAAG,GAAG,MAAML,OAAO,CAACM,gBAAgB,CAACP,SAAS,CAAC;IACrD,OAAO,KAAIQ,+BAAU,EAACP,OAAO,CAACQ,WAAW,CAACT,SAAS,CAAC,EAAE,IAAI,CAACF,OAAO,CAACE,SAAS,CAAC,EAAEE,IAAI,EAAEE,UAAU,EAAEE,GAAG,CAAC;EACvG;AACF;AAACI,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, TypeLiteralNode } from 'typescript';
|
|
1
|
+
import type { Node, TypeLiteralNode } from 'typescript';
|
|
2
2
|
import { TypeLiteralSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
/**
|
|
7
7
|
* not to be confused with "LiteralType", which is string/boolean/null.
|
|
8
8
|
* this "TypeLiteral" is an object with properties, such as: `{ a: string; b: number }`, similar to Interface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","e","__esModule","default","TypeLiteralTransformer","predicate","node","kind","ts","SyntaxKind","TypeLiteral","getIdentifiers","transform","context","members","pMapSeries","member","computeSchema","location","getLocation","TypeLiteralSchema","exports"],"sources":["type-literal.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","e","__esModule","default","TypeLiteralTransformer","predicate","node","kind","ts","SyntaxKind","TypeLiteral","getIdentifiers","transform","context","members","pMapSeries","member","computeSchema","location","getLocation","TypeLiteralSchema","exports"],"sources":["type-literal.ts"],"sourcesContent":["import type { Node, TypeLiteralNode } from 'typescript';\nimport ts from 'typescript';\nimport { TypeLiteralSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\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 */\nexport class TypeLiteralTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.TypeLiteral;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TypeLiteralNode, context: SchemaExtractorContext) {\n const members = await pMapSeries(node.members, (member) => context.computeSchema(member));\n const location = context.getLocation(node);\n return new TypeLiteralSchema(location, members);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKtC;AACA;AACA;AACA;AACO,MAAMG,sBAAsB,CAA8B;EAC/DC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,WAAW;EAChD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACN,IAAqB,EAAEO,OAA+B,EAAE;IACtE,MAAMC,OAAO,GAAG,MAAM,IAAAC,qBAAU,EAACT,IAAI,CAACQ,OAAO,EAAGE,MAAM,IAAKH,OAAO,CAACI,aAAa,CAACD,MAAM,CAAC,CAAC;IACzF,MAAME,QAAQ,GAAGL,OAAO,CAACM,WAAW,CAACb,IAAI,CAAC;IAC1C,OAAO,KAAIc,sCAAiB,EAACF,QAAQ,EAAEJ,OAAO,CAAC;EACjD;AACF;AAACO,OAAA,CAAAjB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Node, TypeOperatorNode
|
|
1
|
+
import type { Node, TypeOperatorNode } from 'typescript';
|
|
2
|
+
import { SyntaxKind } from 'typescript';
|
|
2
3
|
import { TypeOperatorSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
/**
|
|
7
8
|
* e.g. keyof typeof Foo
|
|
8
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","TypeOperatorTransformer","predicate","node","kind","SyntaxKind","TypeOperator","getIdentifiers","transform","context","operatorName","getOperatorName","operator","type","computeSchema","TypeOperatorSchema","getLocation","KeyOfKeyword","UniqueKeyword","ReadonlyKeyword","Error","exports"],"sources":["type-operator.ts"],"sourcesContent":["import { Node, TypeOperatorNode
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","TypeOperatorTransformer","predicate","node","kind","SyntaxKind","TypeOperator","getIdentifiers","transform","context","operatorName","getOperatorName","operator","type","computeSchema","TypeOperatorSchema","getLocation","KeyOfKeyword","UniqueKeyword","ReadonlyKeyword","Error","exports"],"sources":["type-operator.ts"],"sourcesContent":["import type { Node, TypeOperatorNode } from 'typescript';\nimport { SyntaxKind } from 'typescript';\nimport { TypeOperatorSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\n/**\n * e.g. keyof typeof Foo\n */\nexport class TypeOperatorTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.TypeOperator;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TypeOperatorNode, context: SchemaExtractorContext) {\n const operatorName = this.getOperatorName(node.operator);\n const type = await context.computeSchema(node.type);\n return new TypeOperatorSchema(context.getLocation(node), operatorName, type);\n }\n\n 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}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKA;AACA;AACA;AACO,MAAMG,uBAAuB,CAA8B;EAChEC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,YAAY;EAC9C;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAAsB,EAAEM,OAA+B,EAAE;IACvE,MAAMC,YAAY,GAAG,IAAI,CAACC,eAAe,CAACR,IAAI,CAACS,QAAQ,CAAC;IACxD,MAAMC,IAAI,GAAG,MAAMJ,OAAO,CAACK,aAAa,CAACX,IAAI,CAACU,IAAI,CAAC;IACnD,OAAO,KAAIE,uCAAkB,EAACN,OAAO,CAACO,WAAW,CAACb,IAAI,CAAC,EAAEO,YAAY,EAAEG,IAAI,CAAC;EAC9E;EAEAF,eAAeA,CAACC,QAAyF,EAAE;IACzG,QAAQA,QAAQ;MACd,KAAKP,wBAAU,CAACY,YAAY;QAC1B,OAAO,OAAO;MAChB,KAAKZ,wBAAU,CAACa,aAAa;QAC3B,OAAO,QAAQ;MACjB,KAAKb,wBAAU,CAACc,eAAe;QAC7B,OAAO,UAAU;MACnB;QACE,MAAM,IAAIC,KAAK,CAAC,qDAAqDR,QAAQ,EAAE,CAAC;IACpF;EACF;AACF;AAACS,OAAA,CAAApB,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, TypePredicateNode } from 'typescript';
|
|
1
|
+
import type { Node, TypePredicateNode } from 'typescript';
|
|
2
2
|
import { TypePredicateSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class TypePredicateTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","TypePredicateTransformer","predicate","node","kind","SyntaxKind","TypePredicate","getIdentifiers","transform","context","parameterName","isIdentifier","getText","type","computeSchema","undefined","hasAssertsModifier","Boolean","assertsModifier","TypePredicateSchema","getLocation","exports"],"sources":["type-predicate.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","TypePredicateTransformer","predicate","node","kind","SyntaxKind","TypePredicate","getIdentifiers","transform","context","parameterName","isIdentifier","getText","type","computeSchema","undefined","hasAssertsModifier","Boolean","assertsModifier","TypePredicateSchema","getLocation","exports"],"sources":["type-predicate.ts"],"sourcesContent":["import type { Node, TypePredicateNode } from 'typescript';\nimport { isIdentifier, SyntaxKind } from 'typescript';\nimport { TypePredicateSchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\nexport class TypePredicateTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.TypePredicate;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TypePredicateNode, context: SchemaExtractorContext) {\n const parameterName = isIdentifier(node.parameterName) ? node.parameterName.getText() : 'this';\n const type = node.type ? await context.computeSchema(node.type) : undefined;\n const hasAssertsModifier = Boolean(node.assertsModifier);\n return new TypePredicateSchema(context.getLocation(node), parameterName, type, hasAssertsModifier);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAKO,MAAMG,wBAAwB,CAA8B;EACjEC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,aAAa;EAC/C;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAAuB,EAAEM,OAA+B,EAAE;IACxE,MAAMC,aAAa,GAAG,IAAAC,0BAAY,EAACR,IAAI,CAACO,aAAa,CAAC,GAAGP,IAAI,CAACO,aAAa,CAACE,OAAO,CAAC,CAAC,GAAG,MAAM;IAC9F,MAAMC,IAAI,GAAGV,IAAI,CAACU,IAAI,GAAG,MAAMJ,OAAO,CAACK,aAAa,CAACX,IAAI,CAACU,IAAI,CAAC,GAAGE,SAAS;IAC3E,MAAMC,kBAAkB,GAAGC,OAAO,CAACd,IAAI,CAACe,eAAe,CAAC;IACxD,OAAO,KAAIC,wCAAmB,EAACV,OAAO,CAACW,WAAW,CAACjB,IAAI,CAAC,EAAEO,aAAa,EAAEG,IAAI,EAAEG,kBAAkB,CAAC;EACpG;AACF;AAACK,OAAA,CAAApB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, TypeQueryNode } from 'typescript';
|
|
1
|
+
import type { Node, TypeQueryNode } from 'typescript';
|
|
2
2
|
import { TypeQuerySchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
/**
|
|
7
7
|
* e.g. `typeof Foo`
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","e","__esModule","default","TypeQueryTransformer","predicate","node","kind","ts","SyntaxKind","TypeQuery","getIdentifiers","transform","context","displaySig","getQuickInfoDisplayString","exprName","type","resolveType","getText","location","getLocation","TypeQuerySchema","exports"],"sources":["type-query.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","e","__esModule","default","TypeQueryTransformer","predicate","node","kind","ts","SyntaxKind","TypeQuery","getIdentifiers","transform","context","displaySig","getQuickInfoDisplayString","exprName","type","resolveType","getText","location","getLocation","TypeQuerySchema","exports"],"sources":["type-query.ts"],"sourcesContent":["import type { Node, TypeQueryNode } from 'typescript';\nimport ts from 'typescript';\nimport { TypeQuerySchema } from '@teambit/semantics.entities.semantic-schema';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\n\n/**\n * e.g. `typeof Foo`\n */\nexport class TypeQueryTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.TypeQuery;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TypeQueryNode, context: SchemaExtractorContext) {\n const displaySig = await context.getQuickInfoDisplayString(node.exprName);\n const type = await context.resolveType(node.exprName, node.exprName.getText());\n const location = context.getLocation(node);\n return new TypeQuerySchema(location, type, displaySig);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8E,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAK9E;AACA;AACA;AACO,MAAMG,oBAAoB,CAA8B;EAC7DC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,SAAS;EAC9C;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACN,IAAmB,EAAEO,OAA+B,EAAE;IACpE,MAAMC,UAAU,GAAG,MAAMD,OAAO,CAACE,yBAAyB,CAACT,IAAI,CAACU,QAAQ,CAAC;IACzE,MAAMC,IAAI,GAAG,MAAMJ,OAAO,CAACK,WAAW,CAACZ,IAAI,CAACU,QAAQ,EAAEV,IAAI,CAACU,QAAQ,CAACG,OAAO,CAAC,CAAC,CAAC;IAC9E,MAAMC,QAAQ,GAAGP,OAAO,CAACQ,WAAW,CAACf,IAAI,CAAC;IAC1C,OAAO,KAAIgB,oCAAe,EAACF,QAAQ,EAAEH,IAAI,EAAEH,UAAU,CAAC;EACxD;AACF;AAACS,OAAA,CAAAnB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, TypeReferenceNode } from 'typescript';
|
|
1
|
+
import type { Node, TypeReferenceNode } from 'typescript';
|
|
2
2
|
import { TypeRefSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
/**
|
|
7
7
|
* In the following example, `AriaButtonProps` is a type reference
|
|
8
8
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","e","__esModule","default","TypeReferenceTransformer","predicate","node","kind","ts","SyntaxKind","TypeReference","getIdentifiers","transform","context","name","typeName","getText","type","resolveType","TypeRefSchema","getLocation","typeArguments","args","pMapSeries","arg","computeSchema","withTypeArgs","exports"],"sources":["type-reference.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","e","__esModule","default","TypeReferenceTransformer","predicate","node","kind","ts","SyntaxKind","TypeReference","getIdentifiers","transform","context","name","typeName","getText","type","resolveType","TypeRefSchema","getLocation","typeArguments","args","pMapSeries","arg","computeSchema","withTypeArgs","exports"],"sources":["type-reference.ts"],"sourcesContent":["import type { Node, TypeReferenceNode } from 'typescript';\nimport ts from 'typescript';\nimport { TypeRefSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport type { SchemaTransformer } from '../schema-transformer';\nimport type { SchemaExtractorContext } from '../schema-extractor-context';\nimport type { Identifier } from '../identifier';\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 */\nexport class TypeReferenceTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.TypeReference;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: TypeReferenceNode, context: SchemaExtractorContext) {\n const name = node.typeName.getText();\n let type = await context.resolveType(node, name);\n if (!(type instanceof TypeRefSchema)) {\n type = new TypeRefSchema(context.getLocation(node), name);\n }\n if (node.typeArguments && type instanceof TypeRefSchema) {\n const args = await pMapSeries(node.typeArguments, (arg) => context.computeSchema(arg));\n type.withTypeArgs(args);\n }\n return type;\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKtC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,wBAAwB,CAA8B;EACjEC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,aAAa;EAClD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACN,IAAuB,EAAEO,OAA+B,EAAE;IACxE,MAAMC,IAAI,GAAGR,IAAI,CAACS,QAAQ,CAACC,OAAO,CAAC,CAAC;IACpC,IAAIC,IAAI,GAAG,MAAMJ,OAAO,CAACK,WAAW,CAACZ,IAAI,EAAEQ,IAAI,CAAC;IAChD,IAAI,EAAEG,IAAI,YAAYE,kCAAa,CAAC,EAAE;MACpCF,IAAI,GAAG,KAAIE,kCAAa,EAACN,OAAO,CAACO,WAAW,CAACd,IAAI,CAAC,EAAEQ,IAAI,CAAC;IAC3D;IACA,IAAIR,IAAI,CAACe,aAAa,IAAIJ,IAAI,YAAYE,kCAAa,EAAE;MACvD,MAAMG,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAACjB,IAAI,CAACe,aAAa,EAAGG,GAAG,IAAKX,OAAO,CAACY,aAAa,CAACD,GAAG,CAAC,CAAC;MACtFP,IAAI,CAACS,YAAY,CAACJ,IAAI,CAAC;IACzB;IACA,OAAOL,IAAI;EACb;AACF;AAACU,OAAA,CAAAvB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Node, UnionTypeNode } from 'typescript';
|
|
1
|
+
import type { Node, UnionTypeNode } from 'typescript';
|
|
2
2
|
import { TypeUnionSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
3
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
4
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { Identifier } from '../identifier';
|
|
6
6
|
export declare class UnionTypeTransformer implements SchemaTransformer {
|
|
7
7
|
predicate(node: Node): boolean;
|
|
8
8
|
getIdentifiers(): Promise<Identifier[]>;
|