@teambit/typescript 0.0.1158 → 0.0.1160
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/cmds/check-types.cmd.js +10 -16
- package/dist/cmds/check-types.cmd.js.map +1 -1
- package/dist/cmds/write-tsconfig.cmd.js +10 -15
- package/dist/cmds/write-tsconfig.cmd.js.map +1 -1
- package/dist/exceptions/transformer-not-found.js +1 -1
- package/dist/exceptions/transformer-not-found.js.map +1 -1
- package/dist/export-identifier.js +4 -9
- package/dist/export-identifier.js.map +1 -1
- package/dist/{preview-1694575035715.js → preview-1694661423555.js} +2 -2
- package/dist/remove-types-task.js +7 -13
- package/dist/remove-types-task.js.map +1 -1
- package/dist/schema-extractor-context.js +7 -18
- package/dist/schema-extractor-context.js.map +1 -1
- package/dist/schema-transformer.plugin.js +5 -10
- package/dist/schema-transformer.plugin.js.map +1 -1
- package/dist/sourceFileTransformers/class.js +1 -1
- package/dist/sourceFileTransformers/class.js.map +1 -1
- package/dist/sourceFileTransformers/empty-line-encoder.js +8 -14
- package/dist/sourceFileTransformers/empty-line-encoder.js.map +1 -1
- package/dist/sourceFileTransformers/export.js +1 -4
- package/dist/sourceFileTransformers/export.js.map +1 -1
- package/dist/sourceFileTransformers/expression-statement.js +1 -1
- package/dist/sourceFileTransformers/expression-statement.js.map +1 -1
- package/dist/sourceFileTransformers/function.js +4 -5
- package/dist/sourceFileTransformers/function.js.map +1 -1
- package/dist/sourceFileTransformers/import.js +1 -4
- package/dist/sourceFileTransformers/import.js.map +1 -1
- package/dist/sourceFileTransformers/interface.js +1 -1
- package/dist/sourceFileTransformers/interface.js.map +1 -1
- package/dist/sourceFileTransformers/replaceName.js +0 -4
- package/dist/sourceFileTransformers/replaceName.js.map +1 -1
- package/dist/sourceFileTransformers/transform.js +2 -7
- package/dist/sourceFileTransformers/transform.js.map +1 -1
- package/dist/sourceFileTransformers/type-reference.js +1 -1
- package/dist/sourceFileTransformers/type-reference.js.map +1 -1
- package/dist/sourceFileTransformers/typeAlias.js +1 -1
- package/dist/sourceFileTransformers/typeAlias.js.map +1 -1
- package/dist/sourceFileTransformers/variable.js +1 -1
- package/dist/sourceFileTransformers/variable.js.map +1 -1
- package/dist/transform-source-file.spec.js +1 -3
- package/dist/transform-source-file.spec.js.map +1 -1
- package/dist/transformers/array-type.js +1 -2
- package/dist/transformers/array-type.js.map +1 -1
- package/dist/transformers/binding-element.js +1 -2
- package/dist/transformers/binding-element.js.map +1 -1
- package/dist/transformers/class-declaration.js +5 -12
- package/dist/transformers/class-declaration.js.map +1 -1
- package/dist/transformers/conditional-type.js +0 -1
- package/dist/transformers/conditional-type.js.map +1 -1
- package/dist/transformers/constructor.js +1 -2
- package/dist/transformers/constructor.js.map +1 -1
- package/dist/transformers/enum-declaration.js +1 -2
- package/dist/transformers/enum-declaration.js.map +1 -1
- package/dist/transformers/export-assignment.js +0 -1
- package/dist/transformers/export-assignment.js.map +1 -1
- package/dist/transformers/export-declaration.js +0 -2
- package/dist/transformers/export-declaration.js.map +1 -1
- package/dist/transformers/expression-statement.js +1 -2
- package/dist/transformers/expression-statement.js.map +1 -1
- package/dist/transformers/function-like.js +1 -2
- package/dist/transformers/function-like.js.map +1 -1
- package/dist/transformers/get-accessor.js +1 -2
- package/dist/transformers/get-accessor.js.map +1 -1
- package/dist/transformers/import-declaration.js +0 -1
- package/dist/transformers/import-declaration.js.map +1 -1
- package/dist/transformers/index-signature.js +1 -2
- package/dist/transformers/index-signature.js.map +1 -1
- package/dist/transformers/indexed-access-type.js +0 -1
- package/dist/transformers/indexed-access-type.js.map +1 -1
- package/dist/transformers/interface-declaration.js +5 -12
- package/dist/transformers/interface-declaration.js.map +1 -1
- package/dist/transformers/intersection-type.js +1 -2
- package/dist/transformers/intersection-type.js.map +1 -1
- package/dist/transformers/keyword-type.js +0 -1
- package/dist/transformers/keyword-type.js.map +1 -1
- package/dist/transformers/literal-type.js +1 -2
- package/dist/transformers/literal-type.js.map +1 -1
- package/dist/transformers/module-declaration.js +1 -2
- package/dist/transformers/module-declaration.js.map +1 -1
- package/dist/transformers/named-tuple.js +0 -1
- package/dist/transformers/named-tuple.js.map +1 -1
- package/dist/transformers/parameter.js +1 -2
- package/dist/transformers/parameter.js.map +1 -1
- package/dist/transformers/parenthesized-type.js +0 -1
- package/dist/transformers/parenthesized-type.js.map +1 -1
- package/dist/transformers/property-declaration.js +0 -1
- package/dist/transformers/property-declaration.js.map +1 -1
- package/dist/transformers/set-accessor.js +1 -2
- package/dist/transformers/set-accessor.js.map +1 -1
- package/dist/transformers/source-file-transformer.js +1 -3
- package/dist/transformers/source-file-transformer.js.map +1 -1
- package/dist/transformers/template-literal-type-span.js +0 -1
- package/dist/transformers/template-literal-type-span.js.map +1 -1
- package/dist/transformers/template-literal-type.js +1 -2
- package/dist/transformers/template-literal-type.js.map +1 -1
- package/dist/transformers/this-type.js +0 -1
- package/dist/transformers/this-type.js.map +1 -1
- package/dist/transformers/tuple-type.js +1 -2
- package/dist/transformers/tuple-type.js.map +1 -1
- package/dist/transformers/type-alias.js +1 -2
- package/dist/transformers/type-alias.js.map +1 -1
- package/dist/transformers/type-literal.js +1 -2
- package/dist/transformers/type-literal.js.map +1 -1
- package/dist/transformers/type-operator.js +0 -1
- package/dist/transformers/type-operator.js.map +1 -1
- package/dist/transformers/type-predicate.js +0 -1
- package/dist/transformers/type-predicate.js.map +1 -1
- package/dist/transformers/type-query.js +1 -2
- package/dist/transformers/type-query.js.map +1 -1
- package/dist/transformers/type-reference.js +1 -2
- package/dist/transformers/type-reference.js.map +1 -1
- package/dist/transformers/union-type.js +1 -2
- package/dist/transformers/union-type.js.map +1 -1
- package/dist/transformers/utils/jsdoc-to-doc-schema.js +0 -1
- package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -1
- package/dist/transformers/utils/parse-type-from-quick-info.js +0 -4
- package/dist/transformers/utils/parse-type-from-quick-info.js.map +1 -1
- package/dist/transformers/variable-declaration.js +1 -2
- package/dist/transformers/variable-declaration.js.map +1 -1
- package/dist/transformers/variable-statement.js +1 -2
- package/dist/transformers/variable-statement.js.map +1 -1
- package/dist/tsconfig-writer.js +1 -6
- package/dist/tsconfig-writer.js.map +1 -1
- package/dist/typescript.compiler.js +13 -23
- package/dist/typescript.compiler.js.map +1 -1
- package/dist/typescript.compiler.spec.js +5 -9
- package/dist/typescript.compiler.spec.js.map +1 -1
- package/dist/typescript.composition.js +1 -1
- package/dist/typescript.composition.js.map +1 -1
- package/dist/typescript.extractor.d.ts +2 -3
- package/dist/typescript.extractor.js +14 -13
- package/dist/typescript.extractor.js.map +1 -1
- package/dist/typescript.main.runtime.js +8 -16
- package/dist/typescript.main.runtime.js.map +1 -1
- package/dist/typescript.parser.js +5 -10
- package/dist/typescript.parser.js.map +1 -1
- package/dist/typescript.parser.spec.js +1 -1
- package/dist/typescript.parser.spec.js.map +1 -1
- package/package.json +19 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireWildcard","require","_semanticsEntities","_pMapSeries","_interopRequireDefault","_parseTypeFromQuickInfo","
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireWildcard","require","_semanticsEntities","_pMapSeries","_interopRequireDefault","_parseTypeFromQuickInfo","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ParameterTransformer","predicate","node","kind","ts","SyntaxKind","Parameter","getIdentifiers","transform","context","ParameterSchema","getLocation","getName","getType","Boolean","questionToken","initializer","getText","undefined","getObjectBindingNodes","param","isIdentifier","name","elements","map","elem","elementsStr","join","ArrayBindingPattern","type","computeSchema","info","getQuickInfo","parsed","parseTypeFromQuickInfo","InferenceTypeSchema","pMapSeries","TupleTypeSchema","ObjectBindingPattern","TypeLiteralSchema","Error","exports"],"sources":["parameter.ts"],"sourcesContent":["import ts, {\n BindingElement,\n isIdentifier,\n Node,\n ParameterDeclaration,\n SyntaxKind,\n ArrayBindingElement,\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 return new ParameterSchema(\n context.getLocation(node),\n this.getName(node),\n await this.getType(node, context),\n Boolean(node.questionToken),\n node.initializer ? node.initializer.getText() : undefined,\n undefined,\n await this.getObjectBindingNodes(node, context)\n );\n }\n\n 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 async getObjectBindingNodes(\n param: ParameterDeclaration,\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 info =\n elem.name.kind === SyntaxKind.ObjectBindingPattern ? undefined : await context.getQuickInfo(elem.name);\n // @todo look into extracting nested objected binding patters\n /**\n * apiNode: {\n api: {\n name,\n signature: defaultSignature,\n doc, \n location: { filePath },\n },\n },\n */\n const parsed = info ? parseTypeFromQuickInfo(info) : elem.getText();\n return new InferenceTypeSchema(context.getLocation(param), parsed, elem.name.getText());\n });\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAK,sBAAA,CAAAH,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAM,wBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,uBAAA,YAAAA,CAAA;IAAA,OAAAN,I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AMW,MAAM,GAAG,IAAAC,gDAAsB,EAACH,IAAI,CAAC;QAC3C,OAAO,KAAII,wCAAmB,EAAC1B,OAAO,CAACE,WAAW,CAACS,KAAK,CAAC,EAAEa,MAAM,EAAER,IAAI,CAACH,IAAI,CAACL,OAAO,CAAC,CAAC,CAAC;MACzF,CAAC,CAAC;MACF,OAAO,KAAIsB,sCAAiB,EAAC9B,OAAO,CAACE,WAAW,CAACS,KAAK,CAAC,EAAEG,QAAQ,CAAC;IACpE;IACA,MAAM,IAAIiB,KAAK,CAAE,oBAAmB,CAAC;EACvC;EAEA,MAAMrB,qBAAqBA,CACzBC,KAA2B,EAC3BX,OAA+B,EACI;IACnC,IAAIW,KAAK,CAACE,IAAI,CAACnB,IAAI,KAAKE,wBAAU,CAACiC,oBAAoB,EAAE,OAAOpB,SAAS;IACzE,OAAO,IAAAkB,qBAAU,EAAChB,KAAK,CAACE,IAAI,CAACC,QAAQ,EAAE,MAAOE,IAAoB,IAAK;MACrE,MAAMM,IAAI,GACRN,IAAI,CAACH,IAAI,CAACnB,IAAI,KAAKE,wBAAU,CAACiC,oBAAoB,GAAGpB,SAAS,GAAG,MAAMT,OAAO,CAACuB,YAAY,CAACP,IAAI,CAACH,IAAI,CAAC;MACxG;MACA;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACM,MAAMW,MAAM,GAAGF,IAAI,GAAG,IAAAG,gDAAsB,EAACH,IAAI,CAAC,GAAGN,IAAI,CAACR,OAAO,CAAC,CAAC;MACnE,OAAO,KAAIkB,wCAAmB,EAAC1B,OAAO,CAACE,WAAW,CAACS,KAAK,CAAC,EAAEa,MAAM,EAAER,IAAI,CAACH,IAAI,CAACL,OAAO,CAAC,CAAC,CAAC;IACzF,CAAC,CAAC;EACJ;AACF;AAACwB,OAAA,CAAAzC,oBAAA,GAAAA,oBAAA"}
|
|
@@ -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, SyntaxKind } from 'typescript';\nimport { ParenthesizedTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":"
|
|
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, SyntaxKind } from 'typescript';\nimport { ParenthesizedTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":";;;;;;AAAA,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","_parseTypeFromQuickInfo","PropertyDeclarationTransformer","predicate","node","kind","SyntaxKind","PropertyDeclaration","PropertySignature","getIdentifiers","isComputedProperty","name","ComputedPropertyName","transform","context","_info$body","getText","info","undefined","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","doc","jsDocToDocSchema","VariableLikeSchema","getLocation","exports"],"sources":["property-declaration.ts"],"sourcesContent":["import { Node, PropertyDeclaration, PropertySignature, SyntaxKind } from 'typescript';\nimport { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport { Identifier } from '../identifier';\n\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);\n const doc = await context.jsDocToDocSchema(node);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, isOptional, doc);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","_parseTypeFromQuickInfo","PropertyDeclarationTransformer","predicate","node","kind","SyntaxKind","PropertyDeclaration","PropertySignature","getIdentifiers","isComputedProperty","name","ComputedPropertyName","transform","context","_info$body","getText","info","undefined","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","isOptional","Boolean","questionToken","doc","jsDocToDocSchema","VariableLikeSchema","getLocation","exports"],"sources":["property-declaration.ts"],"sourcesContent":["import { Node, PropertyDeclaration, PropertySignature, SyntaxKind } from 'typescript';\nimport { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport { Identifier } from '../identifier';\n\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);\n const doc = await context.jsDocToDocSchema(node);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, isOptional, doc);\n }\n}\n"],"mappings":";;;;;;AAAA,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;IAAA,IAAAC,UAAA;IAC9F,MAAMJ,IAAI,GAAGP,IAAI,CAACO,IAAI,CAACK,OAAO,CAAC,CAAC;IAChC,MAAMC,IAAI,GAAG,IAAI,CAACP,kBAAkB,CAACN,IAAI,CAAC,GAAGc,SAAS,GAAG,MAAMJ,OAAO,CAACK,YAAY,CAACf,IAAI,CAACO,IAAI,CAAC;IAC9F,MAAMS,UAAU,GAAG,CAAAH,IAAI,aAAJA,IAAI,wBAAAF,UAAA,GAAJE,IAAI,CAAEI,IAAI,cAAAN,UAAA,uBAAVA,UAAA,CAAYO,aAAa,KAAIlB,IAAI,CAACY,OAAO,CAAC,CAAC;IAC9D,MAAMO,OAAO,GAAG,IAAAC,gDAAsB,EAACP,IAAI,CAAC;IAC5C,MAAMQ,IAAI,GAAG,MAAMX,OAAO,CAACY,WAAW,CAACtB,IAAI,EAAEmB,OAAO,CAAC;IACrD,MAAMI,UAAU,GAAGC,OAAO,CAACxB,IAAI,CAACyB,aAAa,CAAC;IAC9C,MAAMC,GAAG,GAAG,MAAMhB,OAAO,CAACiB,gBAAgB,CAAC3B,IAAI,CAAC;IAChD,OAAO,KAAI4B,uCAAkB,EAAClB,OAAO,CAACmB,WAAW,CAAC7B,IAAI,CAAC,EAAEO,IAAI,EAAES,UAAU,EAAEK,IAAI,EAAEE,UAAU,EAAEG,GAAG,CAAC;EACnG;AACF;AAACI,OAAA,CAAAhC,8BAAA,GAAAA,8BAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,7 @@ function _pMapSeries() {
|
|
|
27
25
|
};
|
|
28
26
|
return data;
|
|
29
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
class SetAccessorTransformer {
|
|
31
30
|
predicate(node) {
|
|
32
31
|
return node.kind === _typescript().default.SyntaxKind.SetAccessor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","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 ts, { Node, SetAccessorDeclaration } from 'typescript';\nimport { ParameterSchema, SetAccessorSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class 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":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","obj","__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 ts, { Node, SetAccessorDeclaration } from 'typescript';\nimport { ParameterSchema, SetAccessorSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class 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":";;;;;;AAAA,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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.array.iterator.js");
|
|
5
|
-
require("core-js/modules/es.promise.js");
|
|
6
3
|
Object.defineProperty(exports, "__esModule", {
|
|
7
4
|
value: true
|
|
8
5
|
});
|
|
@@ -42,6 +39,7 @@ function _exportIdentifier() {
|
|
|
42
39
|
};
|
|
43
40
|
return data;
|
|
44
41
|
}
|
|
42
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
43
|
class SourceFileTransformer {
|
|
46
44
|
predicate(node) {
|
|
47
45
|
return node.kind === _typescript().default.SyntaxKind.SourceFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_lodash","_pMapSeries","_semanticsEntities","_exportIdentifier","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","_statement$modifiers","ExportDeclaration","ExportAssignment","isExport","Boolean","modifiers","modifier","ExportKeyword","_statement$modifiers2"],"sources":["source-file-transformer.ts"],"sourcesContent":["import ts, { Node, SourceFile } from 'typescript';\nimport { flatten } from 'lodash';\nimport pMapSeries from 'p-map-series';\nimport { ModuleSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { ExportIdentifier } from '../export-identifier';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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 isExport = Boolean(\n statement.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 if (\n !(statement.kind === ts.SyntaxKind.ExportDeclaration || statement.kind === ts.SyntaxKind.ExportAssignment) &&\n !statement.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":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_lodash","_pMapSeries","_semanticsEntities","_exportIdentifier","obj","__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","_statement$modifiers","ExportDeclaration","ExportAssignment","isExport","Boolean","modifiers","modifier","ExportKeyword","_statement$modifiers2"],"sources":["source-file-transformer.ts"],"sourcesContent":["import ts, { Node, SourceFile } from 'typescript';\nimport { flatten } from 'lodash';\nimport pMapSeries from 'p-map-series';\nimport { ModuleSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { ExportIdentifier } from '../export-identifier';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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 isExport = Boolean(\n statement.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 if (\n !(statement.kind === ts.SyntaxKind.ExportDeclaration || statement.kind === ts.SyntaxKind.ExportAssignment) &&\n !statement.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":";;;;;;AAAA,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,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,mBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,kBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,kBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,iBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIjD,MAAMG,qBAAqB,CAA8B;EAC9DC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACC,UAAU;EAC/C;EAEA,MAAMC,cAAcA,CAACC,UAAsB,EAAEC,OAA+B,EAAE;IAC5E,MAAMC,OAAO,GAAG,IAAI,CAACC,WAAW,CAACH,UAAU,CAAC;IAC5C,MAAMI,S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AAC;EACJ;EAEQrC,iBAAiBA,CAAC+B,GAAe,EAAU;IACjD,OAAOA,GAAG,CAACC,UAAU,CAACX,MAAM,CAAEY,SAAS,IAAK;MAAA,IAAAS,qBAAA;MAC1C,IACE,EAAET,SAAS,CAAC3C,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAAC2C,iBAAiB,IAAIF,SAAS,CAAC3C,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAAC4C,gBAAgB,CAAC,IAC1G,GAAAM,qBAAA,GAACT,SAAS,CAACM,SAAS,cAAAG,qBAAA,eAAnBA,qBAAA,CAAqBlC,IAAI,CAAEgC,QAAQ,IAAK;QACvC,OAAOA,QAAQ,CAAClD,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACiD,aAAa;MACtD,CAAC,CAAC,GACF;QACA,OAAO,IAAI;MACb;MAEA,OAAO,KAAK;IACd,CAAC,CAAC;EACJ;AACF;AAAC5C,OAAA,CAAAV,qBAAA,GAAAA,qBAAA"}
|
|
@@ -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, SyntaxKind, TemplateLiteralTypeSpan } from 'typescript';\nimport { TemplateLiteralTypeSpanSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":"
|
|
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, SyntaxKind, TemplateLiteralTypeSpan } from 'typescript';\nimport { TemplateLiteralTypeSpanSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":";;;;;;AAAA,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"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,7 @@ function _semanticsEntities() {
|
|
|
27
25
|
};
|
|
28
26
|
return data;
|
|
29
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
class TemplateLiteralTypeTransformer {
|
|
31
30
|
predicate(node) {
|
|
32
31
|
return node.kind === _typescript().SyntaxKind.TemplateLiteralType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","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, SyntaxKind, TemplateLiteralTypeNode } from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport { TemplateLiteralTypeSchema, TemplateLiteralTypeSpanSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","obj","__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, SyntaxKind, TemplateLiteralTypeNode } from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport { TemplateLiteralTypeSchema, TemplateLiteralTypeSpanSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":";;;;;;AAAA,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;AAAuH,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAKhH,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"}
|
|
@@ -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, SyntaxKind, ThisTypeNode } from 'typescript';\nimport { ThisTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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));\n }\n}\n"],"mappings":"
|
|
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, SyntaxKind, ThisTypeNode } from 'typescript';\nimport { ThisTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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));\n }\n}\n"],"mappings":";;;;;;AAAA,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,CAAC;EACtD;AACF;AAACS,OAAA,CAAAX,mBAAA,GAAAA,mBAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,7 @@ function _semanticsEntities() {
|
|
|
27
25
|
};
|
|
28
26
|
return data;
|
|
29
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
class TupleTypeTransformer {
|
|
31
30
|
predicate(node) {
|
|
32
31
|
return node.kind === _typescript().SyntaxKind.TupleType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","TupleTypeTransformer","predicate","node","kind","SyntaxKind","TupleType","getIdentifiers","transform","context","elements","pMapSeries","elem","typeSchema","computeSchema","TupleTypeSchema","getLocation","exports"],"sources":["tuple-type.ts"],"sourcesContent":["import { Node, SyntaxKind, TupleTypeNode } from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport { TupleTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_pMapSeries","_interopRequireDefault","_semanticsEntities","obj","__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, SyntaxKind, TupleTypeNode } from 'typescript';\nimport pMapSeries from 'p-map-series';\nimport { TupleTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":";;;;;;AAAA,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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,7 @@ function _identifier() {
|
|
|
27
25
|
};
|
|
28
26
|
return data;
|
|
29
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
class TypeAliasTransformer {
|
|
31
30
|
predicate(node) {
|
|
32
31
|
return node.kind === _typescript().default.SyntaxKind.TypeAliasDeclaration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_identifier","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 ts, { Node, TypeAliasDeclaration } from 'typescript';\nimport { TypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { 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":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_identifier","obj","__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 ts, { Node, TypeAliasDeclaration } from 'typescript';\nimport { TypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { 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":";;;;;;AAAA,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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,7 @@ function _pMapSeries() {
|
|
|
27
25
|
};
|
|
28
26
|
return data;
|
|
29
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
/**
|
|
31
30
|
* not to be confused with "LiteralType", which is string/boolean/null.
|
|
32
31
|
* 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","TypeLiteralTransformer","predicate","node","kind","ts","SyntaxKind","TypeLiteral","getIdentifiers","transform","context","members","pMapSeries","member","computeSchema","location","getLocation","TypeLiteralSchema","exports"],"sources":["type-literal.ts"],"sourcesContent":["import ts, { Node, TypeLiteralNode } from 'typescript';\nimport { TypeLiteralSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\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":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","obj","__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 ts, { Node, TypeLiteralNode } from 'typescript';\nimport { TypeLiteralSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\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":";;;;;;AAAA,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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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"}
|
|
@@ -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, SyntaxKind } from 'typescript';\nimport { TypeOperatorSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":"
|
|
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, SyntaxKind } from 'typescript';\nimport { TypeOperatorSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":";;;;;;AAAA,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,CAAE,qDAAoDR,QAAS,EAAC,CAAC;IACpF;EACF;AACF;AAACS,OAAA,CAAApB,uBAAA,GAAAA,uBAAA"}
|
|
@@ -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 { isIdentifier, Node, SyntaxKind, TypePredicateNode } from 'typescript';\nimport { TypePredicateSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":"
|
|
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 { isIdentifier, Node, SyntaxKind, TypePredicateNode } from 'typescript';\nimport { TypePredicateSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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":";;;;;;AAAA,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"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -20,6 +18,7 @@ function _semanticsEntities() {
|
|
|
20
18
|
};
|
|
21
19
|
return data;
|
|
22
20
|
}
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
22
|
/**
|
|
24
23
|
* e.g. `typeof Foo`
|
|
25
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","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 ts, { Node, TypeQueryNode } from 'typescript';\nimport { TypeQuerySchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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(), false);\n const location = context.getLocation(node);\n return new TypeQuerySchema(location, type, displaySig);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","obj","__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 ts, { Node, TypeQueryNode } from 'typescript';\nimport { TypeQuerySchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { 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(), false);\n const location = context.getLocation(node);\n return new TypeQuerySchema(location, type, displaySig);\n }\n}\n"],"mappings":";;;;;;AAAA,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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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,EAAE,KAAK,CAAC;IACrF,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"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,7 @@ function _pMapSeries() {
|
|
|
27
25
|
};
|
|
28
26
|
return data;
|
|
29
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
/**
|
|
31
30
|
* In the following example, `AriaButtonProps` is a type reference
|
|
32
31
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","TypeReferenceTransformer","predicate","node","kind","ts","SyntaxKind","TypeReference","getIdentifiers","transform","context","name","typeName","getText","type","resolveType","typeArguments","TypeRefSchema","args","pMapSeries","arg","computeSchema","typeArgs","exports"],"sources":["type-reference.ts"],"sourcesContent":["import ts, { Node, TypeReferenceNode } from 'typescript';\nimport { TypeRefSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\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 const type = await context.resolveType(node, name, false);\n if (node.typeArguments && type instanceof TypeRefSchema) {\n const args = await pMapSeries(node.typeArguments, (arg) => context.computeSchema(arg));\n type.typeArgs = args;\n }\n return type;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","obj","__esModule","default","TypeReferenceTransformer","predicate","node","kind","ts","SyntaxKind","TypeReference","getIdentifiers","transform","context","name","typeName","getText","type","resolveType","typeArguments","TypeRefSchema","args","pMapSeries","arg","computeSchema","typeArgs","exports"],"sources":["type-reference.ts"],"sourcesContent":["import ts, { Node, TypeReferenceNode } from 'typescript';\nimport { TypeRefSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\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 const type = await context.resolveType(node, name, false);\n if (node.typeArguments && type instanceof TypeRefSchema) {\n const args = await pMapSeries(node.typeArguments, (arg) => context.computeSchema(arg));\n type.typeArgs = args;\n }\n return type;\n }\n}\n"],"mappings":";;;;;;AAAA,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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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,MAAMC,IAAI,GAAG,MAAMJ,OAAO,CAACK,WAAW,CAACZ,IAAI,EAAEQ,IAAI,EAAE,KAAK,CAAC;IACzD,IAAIR,IAAI,CAACa,aAAa,IAAIF,IAAI,YAAYG,kCAAa,EAAE;MACvD,MAAMC,IAAI,GAAG,MAAM,IAAAC,qBAAU,EAAChB,IAAI,CAACa,aAAa,EAAGI,GAAG,IAAKV,OAAO,CAACW,aAAa,CAACD,GAAG,CAAC,CAAC;MACtFN,IAAI,CAACQ,QAAQ,GAAGJ,IAAI;IACtB;IACA,OAAOJ,IAAI;EACb;AACF;AAACS,OAAA,CAAAtB,wBAAA,GAAAA,wBAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.promise.js");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,7 @@ function _pMapSeries() {
|
|
|
27
25
|
};
|
|
28
26
|
return data;
|
|
29
27
|
}
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
29
|
class UnionTypeTransformer {
|
|
31
30
|
predicate(node) {
|
|
32
31
|
return node.kind === _typescript().default.SyntaxKind.UnionType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","UnionTypeTransformer","predicate","node","kind","ts","SyntaxKind","UnionType","getIdentifiers","transform","context","types","pMapSeries","type","typeSchema","computeSchema","location","getLocation","TypeUnionSchema","exports"],"sources":["union-type.ts"],"sourcesContent":["import ts, { Node, UnionTypeNode } from 'typescript';\nimport { TypeUnionSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class UnionTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.UnionType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: UnionTypeNode, context: SchemaExtractorContext) {\n const types = await pMapSeries(node.types, async (type) => {\n const typeSchema = context.computeSchema(type);\n return typeSchema;\n });\n const location = context.getLocation(node);\n return new TypeUnionSchema(location, types);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","obj","__esModule","default","UnionTypeTransformer","predicate","node","kind","ts","SyntaxKind","UnionType","getIdentifiers","transform","context","types","pMapSeries","type","typeSchema","computeSchema","location","getLocation","TypeUnionSchema","exports"],"sources":["union-type.ts"],"sourcesContent":["import ts, { Node, UnionTypeNode } from 'typescript';\nimport { TypeUnionSchema } from '@teambit/semantics.entities.semantic-schema';\nimport pMapSeries from 'p-map-series';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class UnionTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.UnionType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: UnionTypeNode, context: SchemaExtractorContext) {\n const types = await pMapSeries(node.types, async (type) => {\n const typeSchema = context.computeSchema(type);\n return typeSchema;\n });\n const location = context.getLocation(node);\n return new TypeUnionSchema(location, types);\n }\n}\n"],"mappings":";;;;;;AAAA,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,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAK/B,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,KAAK,GAAG,MAAM,IAAAC,qBAAU,EAACT,IAAI,CAACQ,KAAK,EAAE,MAAOE,IAAI,IAAK;MACzD,MAAMC,UAAU,GAAGJ,OAAO,CAACK,aAAa,CAACF,IAAI,CAAC;MAC9C,OAAOC,UAAU;IACnB,CAAC,CAAC;IACF,MAAME,QAAQ,GAAGN,OAAO,CAACO,WAAW,CAACd,IAAI,CAAC;IAC1C,OAAO,KAAIe,oCAAe,EAACF,QAAQ,EAAEL,KAAK,CAAC;EAC7C;AACF;AAACQ,OAAA,CAAAlB,oBAAA,GAAAA,oBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","tagParser","tag","context","formatter","kind","SyntaxKind","JSDocReturnTag","returnTag","JSDocPropertyTag","propertyLikeTag","JSDocParameterTag","JSDocAugmentsTag","simpleTag","TagName","augments","JSDocAuthorTag","author","JSDocClassTag","class","JSDocCallbackTag","callback","JSDocPublicTag","public","JSDocPrivateTag","private","JSDocProtectedTag","protected","JSDocReadonlyTag","readonly","JSDocOverrideTag","override","JSDocDeprecatedTag","deprecated","JSDocSeeTag","see","JSDocEnumTag","enum","JSDocThisTag","this","JSDocTypeTag","type","JSDocTemplateTag","template","JSDocTypedefTag","typedef","JSDocImplementsTag","implements","tagName","getText","getSourceFile","comment","getTextOfJSDocComment","formattedComment","formatSnippet","TagSchema","getLocation","e","_tag$typeExpression","_tag$typeExpression2","typeExpression","computeSchema","undefined","ReturnTagSchema","_tag$typeExpression3","_tag$typeExpression4","PropertyLikeTagSchema","name"],"sources":["jsdoc-to-doc-schema.ts"],"sourcesContent":["/* eslint-disable no-fallthrough */\nimport {\n getTextOfJSDocComment,\n JSDocParameterTag,\n JSDocPropertyLikeTag,\n JSDocPropertyTag,\n JSDocReturnTag,\n JSDocTag,\n SyntaxKind,\n} from 'typescript';\nimport {\n PropertyLikeTagSchema,\n ReturnTagSchema,\n TagName,\n TagSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { Formatter } from '@teambit/formatter';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\n\nexport async function tagParser(\n tag: JSDocTag,\n context: SchemaExtractorContext,\n formatter?: Formatter\n): Promise<TagSchema> {\n // for some reason, in some cases, if `tag.getSourceFile()` is not provided to the `getText()`, it throws \"Cannot read property 'text' of undefined\"\n switch (tag.kind) {\n case SyntaxKind.JSDocReturnTag:\n return returnTag(tag as JSDocReturnTag, context);\n case SyntaxKind.JSDocPropertyTag:\n return propertyLikeTag(tag as JSDocPropertyTag, context);\n case SyntaxKind.JSDocParameterTag:\n return propertyLikeTag(tag as JSDocParameterTag, context);\n case SyntaxKind.JSDocAugmentsTag:\n return simpleTag(tag, TagName.augments, context);\n case SyntaxKind.JSDocAuthorTag:\n return simpleTag(tag, TagName.author, context);\n case SyntaxKind.JSDocClassTag:\n return simpleTag(tag, TagName.class, context);\n case SyntaxKind.JSDocCallbackTag:\n return simpleTag(tag, TagName.callback, context);\n case SyntaxKind.JSDocPublicTag:\n return simpleTag(tag, TagName.public, context);\n case SyntaxKind.JSDocPrivateTag:\n return simpleTag(tag, TagName.private, context);\n case SyntaxKind.JSDocProtectedTag:\n return simpleTag(tag, TagName.protected, context);\n case SyntaxKind.JSDocReadonlyTag:\n return simpleTag(tag, TagName.readonly, context);\n case SyntaxKind.JSDocOverrideTag:\n return simpleTag(tag, TagName.override, context);\n case SyntaxKind.JSDocDeprecatedTag:\n return simpleTag(tag, TagName.deprecated, context);\n case SyntaxKind.JSDocSeeTag:\n return simpleTag(tag, TagName.see, context);\n case SyntaxKind.JSDocEnumTag:\n return simpleTag(tag, TagName.enum, context);\n case SyntaxKind.JSDocThisTag:\n return simpleTag(tag, TagName.this, context);\n case SyntaxKind.JSDocTypeTag:\n return simpleTag(tag, TagName.type, context);\n case SyntaxKind.JSDocTemplateTag:\n return simpleTag(tag, TagName.template, context);\n case SyntaxKind.JSDocTypedefTag:\n return simpleTag(tag, TagName.typedef, context);\n case SyntaxKind.JSDocImplementsTag:\n return simpleTag(tag, TagName.implements, context);\n default: {\n const tagName: TagName | string = tag.tagName.getText(tag.getSourceFile());\n if (tagName === 'example') {\n const comment = getTextOfJSDocComment(tag.comment);\n if (!formatter) return simpleTag(tag, tagName, context);\n try {\n const formattedComment = comment && (await formatter.formatSnippet(comment));\n return new TagSchema(context.getLocation(tag), tagName, formattedComment);\n } catch (e) {\n return simpleTag(tag, tagName, context);\n }\n }\n return simpleTag(tag, tagName, context);\n }\n }\n}\n\nfunction simpleTag(tag: JSDocTag, tagName: TagName | string, context: SchemaExtractorContext): TagSchema {\n return new TagSchema(context.getLocation(tag), tagName, getTextOfJSDocComment(tag.comment));\n}\n\nasync function returnTag(tag: JSDocReturnTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new ReturnTagSchema(context.getLocation(tag), getTextOfJSDocComment(tag.comment), type);\n}\n\nasync function propertyLikeTag(tag: JSDocPropertyLikeTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new PropertyLikeTagSchema(\n context.getLocation(tag),\n tag.name.getText(),\n getTextOfJSDocComment(tag.comment),\n type\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","tagParser","tag","context","formatter","kind","SyntaxKind","JSDocReturnTag","returnTag","JSDocPropertyTag","propertyLikeTag","JSDocParameterTag","JSDocAugmentsTag","simpleTag","TagName","augments","JSDocAuthorTag","author","JSDocClassTag","class","JSDocCallbackTag","callback","JSDocPublicTag","public","JSDocPrivateTag","private","JSDocProtectedTag","protected","JSDocReadonlyTag","readonly","JSDocOverrideTag","override","JSDocDeprecatedTag","deprecated","JSDocSeeTag","see","JSDocEnumTag","enum","JSDocThisTag","this","JSDocTypeTag","type","JSDocTemplateTag","template","JSDocTypedefTag","typedef","JSDocImplementsTag","implements","tagName","getText","getSourceFile","comment","getTextOfJSDocComment","formattedComment","formatSnippet","TagSchema","getLocation","e","_tag$typeExpression","_tag$typeExpression2","typeExpression","computeSchema","undefined","ReturnTagSchema","_tag$typeExpression3","_tag$typeExpression4","PropertyLikeTagSchema","name"],"sources":["jsdoc-to-doc-schema.ts"],"sourcesContent":["/* eslint-disable no-fallthrough */\nimport {\n getTextOfJSDocComment,\n JSDocParameterTag,\n JSDocPropertyLikeTag,\n JSDocPropertyTag,\n JSDocReturnTag,\n JSDocTag,\n SyntaxKind,\n} from 'typescript';\nimport {\n PropertyLikeTagSchema,\n ReturnTagSchema,\n TagName,\n TagSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport { Formatter } from '@teambit/formatter';\nimport { SchemaExtractorContext } from '../../schema-extractor-context';\n\nexport async function tagParser(\n tag: JSDocTag,\n context: SchemaExtractorContext,\n formatter?: Formatter\n): Promise<TagSchema> {\n // for some reason, in some cases, if `tag.getSourceFile()` is not provided to the `getText()`, it throws \"Cannot read property 'text' of undefined\"\n switch (tag.kind) {\n case SyntaxKind.JSDocReturnTag:\n return returnTag(tag as JSDocReturnTag, context);\n case SyntaxKind.JSDocPropertyTag:\n return propertyLikeTag(tag as JSDocPropertyTag, context);\n case SyntaxKind.JSDocParameterTag:\n return propertyLikeTag(tag as JSDocParameterTag, context);\n case SyntaxKind.JSDocAugmentsTag:\n return simpleTag(tag, TagName.augments, context);\n case SyntaxKind.JSDocAuthorTag:\n return simpleTag(tag, TagName.author, context);\n case SyntaxKind.JSDocClassTag:\n return simpleTag(tag, TagName.class, context);\n case SyntaxKind.JSDocCallbackTag:\n return simpleTag(tag, TagName.callback, context);\n case SyntaxKind.JSDocPublicTag:\n return simpleTag(tag, TagName.public, context);\n case SyntaxKind.JSDocPrivateTag:\n return simpleTag(tag, TagName.private, context);\n case SyntaxKind.JSDocProtectedTag:\n return simpleTag(tag, TagName.protected, context);\n case SyntaxKind.JSDocReadonlyTag:\n return simpleTag(tag, TagName.readonly, context);\n case SyntaxKind.JSDocOverrideTag:\n return simpleTag(tag, TagName.override, context);\n case SyntaxKind.JSDocDeprecatedTag:\n return simpleTag(tag, TagName.deprecated, context);\n case SyntaxKind.JSDocSeeTag:\n return simpleTag(tag, TagName.see, context);\n case SyntaxKind.JSDocEnumTag:\n return simpleTag(tag, TagName.enum, context);\n case SyntaxKind.JSDocThisTag:\n return simpleTag(tag, TagName.this, context);\n case SyntaxKind.JSDocTypeTag:\n return simpleTag(tag, TagName.type, context);\n case SyntaxKind.JSDocTemplateTag:\n return simpleTag(tag, TagName.template, context);\n case SyntaxKind.JSDocTypedefTag:\n return simpleTag(tag, TagName.typedef, context);\n case SyntaxKind.JSDocImplementsTag:\n return simpleTag(tag, TagName.implements, context);\n default: {\n const tagName: TagName | string = tag.tagName.getText(tag.getSourceFile());\n if (tagName === 'example') {\n const comment = getTextOfJSDocComment(tag.comment);\n if (!formatter) return simpleTag(tag, tagName, context);\n try {\n const formattedComment = comment && (await formatter.formatSnippet(comment));\n return new TagSchema(context.getLocation(tag), tagName, formattedComment);\n } catch (e) {\n return simpleTag(tag, tagName, context);\n }\n }\n return simpleTag(tag, tagName, context);\n }\n }\n}\n\nfunction simpleTag(tag: JSDocTag, tagName: TagName | string, context: SchemaExtractorContext): TagSchema {\n return new TagSchema(context.getLocation(tag), tagName, getTextOfJSDocComment(tag.comment));\n}\n\nasync function returnTag(tag: JSDocReturnTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new ReturnTagSchema(context.getLocation(tag), getTextOfJSDocComment(tag.comment), type);\n}\n\nasync function propertyLikeTag(tag: JSDocPropertyLikeTag, context: SchemaExtractorContext) {\n const type = tag.typeExpression?.type ? await context.computeSchema(tag.typeExpression?.type) : undefined;\n return new PropertyLikeTagSchema(\n context.getLocation(tag),\n tag.name.getText(),\n getTextOfJSDocComment(tag.comment),\n 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;AASA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAVA;;AAmBO,eAAeG,SAASA,CAC7BC,GAAa,EACbC,OAA+B,EAC/BC,SAAqB,EACD;EACpB;EACA,QAAQF,GAAG,C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;AAChG;AAEA,eAAe/B,eAAeA,CAACR,GAAyB,EAAEC,OAA+B,EAAE;EAAA,IAAA6D,oBAAA,EAAAC,oBAAA;EACzF,MAAMxB,IAAI,GAAG,CAAAuB,oBAAA,GAAA9D,GAAG,CAAC0D,cAAc,cAAAI,oBAAA,eAAlBA,oBAAA,CAAoBvB,IAAI,GAAG,MAAMtC,OAAO,CAAC0D,aAAa,EAAAI,oBAAA,GAAC/D,GAAG,CAAC0D,cAAc,cAAAK,oBAAA,uBAAlBA,oBAAA,CAAoBxB,IAAI,CAAC,GAAGqB,SAAS;EACzG,OAAO,KAAII,0CAAqB,EAC9B/D,OAAO,CAACqD,WAAW,CAACtD,GAAG,CAAC,EACxBA,GAAG,CAACiE,IAAI,CAAClB,OAAO,CAAC,CAAC,EAClB,IAAAG,mCAAqB,EAAClD,GAAG,CAACiD,OAAO,CAAC,EAClCV,IACF,CAAC;AACH"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
5
|
-
require("core-js/modules/es.string.replace.js");
|
|
6
|
-
require("core-js/modules/es.string.trim.js");
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|