@teambit/typescript 1.0.667 → 1.0.668
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmds/check-types.cmd.ts +5 -4
- package/dist/cmds/check-types.cmd.d.ts +5 -5
- package/dist/cmds/check-types.cmd.js.map +1 -1
- package/dist/exceptions/transformer-not-found.d.ts +3 -3
- package/dist/exceptions/transformer-not-found.js.map +1 -1
- package/dist/extractor-options.d.ts +1 -1
- package/dist/extractor-options.js.map +1 -1
- package/dist/identifier-list.d.ts +1 -1
- package/dist/identifier-list.js.map +1 -1
- package/dist/{preview-1753809186996.js → preview-1753833698619.js} +2 -2
- package/dist/remove-types-task.d.ts +1 -1
- package/dist/remove-types-task.js.map +1 -1
- package/dist/schema-extractor-context.d.ts +10 -8
- package/dist/schema-extractor-context.js.map +1 -1
- package/dist/schema-transformer.d.ts +4 -4
- package/dist/schema-transformer.js.map +1 -1
- package/dist/schema-transformer.plugin.d.ts +2 -2
- package/dist/schema-transformer.plugin.js.map +1 -1
- package/dist/sourceFileTransformers/export.d.ts +1 -1
- package/dist/sourceFileTransformers/export.js.map +1 -1
- package/dist/sourceFileTransformers/expression-statement.d.ts +1 -1
- package/dist/sourceFileTransformers/expression-statement.js.map +1 -1
- package/dist/sourceFileTransformers/function.d.ts +1 -1
- package/dist/sourceFileTransformers/function.js.map +1 -1
- package/dist/sourceFileTransformers/import.d.ts +1 -1
- package/dist/sourceFileTransformers/import.js.map +1 -1
- package/dist/sourceFileTransformers/index.d.ts +1 -1
- package/dist/sourceFileTransformers/index.js.map +1 -1
- package/dist/sourceFileTransformers/transform.d.ts +1 -1
- package/dist/sourceFileTransformers/transform.js.map +1 -1
- package/dist/transformers/array-literal-expression.d.ts +4 -4
- package/dist/transformers/array-literal-expression.js.map +1 -1
- package/dist/transformers/array-type.d.ts +4 -4
- package/dist/transformers/array-type.js.map +1 -1
- package/dist/transformers/binding-element.d.ts +3 -3
- package/dist/transformers/binding-element.js.map +1 -1
- package/dist/transformers/class-declaration.d.ts +3 -3
- package/dist/transformers/class-declaration.js.map +1 -1
- package/dist/transformers/conditional-type.d.ts +4 -4
- package/dist/transformers/conditional-type.js.map +1 -1
- package/dist/transformers/constructor.d.ts +4 -4
- package/dist/transformers/constructor.js.map +1 -1
- package/dist/transformers/decorator.d.ts +4 -4
- package/dist/transformers/decorator.js.map +1 -1
- package/dist/transformers/enum-declaration.d.ts +3 -3
- package/dist/transformers/enum-declaration.js.map +1 -1
- package/dist/transformers/export-assignment.d.ts +4 -4
- package/dist/transformers/export-assignment.js.map +1 -1
- package/dist/transformers/export-declaration.d.ts +4 -4
- package/dist/transformers/export-declaration.js.map +1 -1
- package/dist/transformers/expression-statement.d.ts +4 -4
- package/dist/transformers/expression-statement.js.map +1 -1
- package/dist/transformers/function-like.d.ts +4 -4
- package/dist/transformers/function-like.js.map +1 -1
- package/dist/transformers/get-accessor.d.ts +4 -4
- package/dist/transformers/get-accessor.js.map +1 -1
- package/dist/transformers/import-declaration.d.ts +3 -3
- package/dist/transformers/import-declaration.js.map +1 -1
- package/dist/transformers/index-signature.d.ts +4 -4
- package/dist/transformers/index-signature.js.map +1 -1
- package/dist/transformers/indexed-access-type.d.ts +4 -4
- package/dist/transformers/indexed-access-type.js.map +1 -1
- package/dist/transformers/interface-declaration.d.ts +3 -3
- package/dist/transformers/interface-declaration.js.map +1 -1
- package/dist/transformers/intersection-type.d.ts +4 -4
- package/dist/transformers/intersection-type.js.map +1 -1
- package/dist/transformers/keyword-type.d.ts +4 -4
- package/dist/transformers/keyword-type.js.map +1 -1
- package/dist/transformers/literal-type.d.ts +4 -4
- package/dist/transformers/literal-type.js.map +1 -1
- package/dist/transformers/literal-value.d.ts +5 -4
- package/dist/transformers/literal-value.js.map +1 -1
- package/dist/transformers/module-declaration.d.ts +4 -4
- package/dist/transformers/module-declaration.js.map +1 -1
- package/dist/transformers/named-tuple.d.ts +4 -4
- package/dist/transformers/named-tuple.js.map +1 -1
- package/dist/transformers/object-literal-expression.d.ts +2 -2
- package/dist/transformers/object-literal-expression.js.map +1 -1
- package/dist/transformers/parameter.d.ts +6 -5
- package/dist/transformers/parameter.js.map +1 -1
- package/dist/transformers/parenthesized-type.d.ts +4 -4
- package/dist/transformers/parenthesized-type.js.map +1 -1
- package/dist/transformers/property-assignment.d.ts +4 -4
- package/dist/transformers/property-assignment.js.map +1 -1
- package/dist/transformers/property-declaration.d.ts +4 -4
- package/dist/transformers/property-declaration.js.map +1 -1
- package/dist/transformers/set-accessor.d.ts +4 -4
- package/dist/transformers/set-accessor.js.map +1 -1
- package/dist/transformers/source-file-transformer.d.ts +4 -4
- package/dist/transformers/source-file-transformer.js.map +1 -1
- package/dist/transformers/template-literal-type-span.d.ts +4 -4
- package/dist/transformers/template-literal-type-span.js.map +1 -1
- package/dist/transformers/template-literal-type.d.ts +4 -4
- package/dist/transformers/template-literal-type.js.map +1 -1
- package/dist/transformers/this-type.d.ts +4 -4
- package/dist/transformers/this-type.js.map +1 -1
- package/dist/transformers/tuple-type.d.ts +4 -4
- package/dist/transformers/tuple-type.js.map +1 -1
- package/dist/transformers/type-alias.d.ts +3 -3
- package/dist/transformers/type-alias.js.map +1 -1
- package/dist/transformers/type-literal.d.ts +4 -4
- package/dist/transformers/type-literal.js.map +1 -1
- package/dist/transformers/type-operator.d.ts +5 -4
- package/dist/transformers/type-operator.js.map +1 -1
- package/dist/transformers/type-predicate.d.ts +4 -4
- package/dist/transformers/type-predicate.js.map +1 -1
- package/dist/transformers/type-query.d.ts +4 -4
- package/dist/transformers/type-query.js.map +1 -1
- package/dist/transformers/type-reference.d.ts +4 -4
- package/dist/transformers/type-reference.js.map +1 -1
- package/dist/transformers/union-type.d.ts +4 -4
- package/dist/transformers/union-type.js.map +1 -1
- package/dist/transformers/utils/jsdoc-to-doc-schema.d.ts +3 -3
- package/dist/transformers/utils/jsdoc-to-doc-schema.js.map +1 -1
- package/dist/transformers/variable-declaration.d.ts +4 -4
- package/dist/transformers/variable-declaration.js.map +1 -1
- package/dist/transformers/variable-statement.d.ts +4 -4
- package/dist/transformers/variable-statement.js.map +1 -1
- package/dist/typescript.extractor.d.ts +15 -14
- package/dist/typescript.extractor.js.map +1 -1
- package/dist/typescript.main.runtime.d.ts +16 -15
- package/dist/typescript.main.runtime.js.map +1 -1
- package/dist/typescript.parser.d.ts +4 -3
- package/dist/typescript.parser.js.map +1 -1
- package/exceptions/transformer-not-found.ts +4 -3
- package/package.json +19 -19
- package/sourceFileTransformers/export.ts +1 -1
- package/sourceFileTransformers/expression-statement.ts +1 -1
- package/sourceFileTransformers/function.ts +1 -1
- package/sourceFileTransformers/import.ts +1 -1
- package/sourceFileTransformers/index.ts +1 -1
- package/sourceFileTransformers/transform.ts +1 -1
- package/transformers/array-literal-expression.ts +6 -8
- package/transformers/array-type.ts +5 -4
- package/transformers/binding-element.ts +4 -3
- package/transformers/class-declaration.ts +4 -3
- package/transformers/conditional-type.ts +5 -4
- package/transformers/constructor.ts +7 -10
- package/transformers/decorator.ts +6 -4
- package/transformers/enum-declaration.ts +4 -3
- package/transformers/export-assignment.ts +6 -4
- package/transformers/export-declaration.ts +5 -5
- package/transformers/expression-statement.ts +5 -4
- package/transformers/function-like.ts +6 -4
- package/transformers/get-accessor.ts +5 -4
- package/transformers/import-declaration.ts +4 -3
- package/transformers/index-signature.ts +7 -5
- package/transformers/indexed-access-type.ts +5 -4
- package/transformers/interface-declaration.ts +5 -3
- package/transformers/intersection-type.ts +5 -4
- package/transformers/keyword-type.ts +5 -4
- package/transformers/literal-type.ts +5 -4
- package/transformers/literal-value.ts +6 -4
- package/transformers/module-declaration.ts +5 -4
- package/transformers/named-tuple.ts +5 -4
- package/transformers/object-literal-expression.ts +3 -2
- package/transformers/parameter.ts +6 -13
- package/transformers/parenthesized-type.ts +5 -4
- package/transformers/property-assignment.ts +5 -4
- package/transformers/property-declaration.ts +5 -4
- package/transformers/set-accessor.ts +7 -5
- package/transformers/source-file-transformer.ts +5 -4
- package/transformers/template-literal-type-span.ts +5 -4
- package/transformers/template-literal-type.ts +7 -5
- package/transformers/this-type.ts +5 -4
- package/transformers/tuple-type.ts +5 -4
- package/transformers/type-alias.ts +4 -3
- package/transformers/type-literal.ts +5 -4
- package/transformers/type-operator.ts +5 -4
- package/transformers/type-predicate.ts +5 -4
- package/transformers/type-query.ts +5 -4
- package/transformers/type-reference.ts +5 -4
- package/transformers/union-type.ts +5 -4
- package/transformers/utils/jsdoc-to-doc-schema.ts +4 -11
- package/transformers/variable-declaration.ts +5 -5
- package/transformers/variable-statement.ts +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_semanticsEntities","data","require","_fsExtra","_typescript","_interopRequireDefault","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","TypeScriptParser","getExports","sourceFile","staticProperties","parseStaticProperties","exportModels","statements","forEach","statement","ts","isExportAssignment","isExportDeclaration","exportClause","isNamedExports","elements","element","name","escapedText","toString","push","Export","get","isNamespaceExport","statementModifiers","canHaveModifiers","getModifiers","undefined","some","modifier","kind","SyntaxKind","ExportKeyword","isVariableStatement","child","declarationList","declarations","isIdentifier","isFunctionDeclaration","isClassDeclaration","withoutEmpty","filter","exportModel","parseModule","modulePath","content","ast","createSourceFile","readFileSync","ScriptTarget","Latest","moduleExports","exportStaticProperties","Map","isExpressionStatement","isBinaryExpression","expression","operatorToken","EqualsToken","isPropertyAccessExpression","left","targetName","text","propertyName","has","set","existingProperties","isStringLiteral","right","isNumericLiteral","UndefinedKeyword","NullKeyword","TrueKeyword","FalseKeyword","err","logger","error","constructor","exports"],"sources":["typescript.parser.ts"],"sourcesContent":["import { Parser } from '@teambit/schema';\nimport { Export, StaticProperties } from '@teambit/semantics.entities.semantic-schema';\nimport { Logger } from '@teambit/logger';\nimport { readFileSync } from 'fs-extra';\nimport ts from 'typescript';\n\nexport class TypeScriptParser implements Parser {\n public extension = /^.*\\.(js|jsx|ts|tsx)$/;\n\n getExports(sourceFile: ts.SourceFile): Export[] {\n const staticProperties = this.parseStaticProperties(sourceFile);\n const exportModels: Export[] = [];\n\n sourceFile.statements.forEach((statement) => {\n // export default\n if (ts.isExportAssignment(statement)) {\n // export default\n }\n\n // export declarations or re-exports\n if (ts.isExportDeclaration(statement)) {\n if (statement.exportClause) {\n if (ts.isNamedExports(statement.exportClause)) {\n statement.exportClause.elements.forEach((element) => {\n const name = element.name.escapedText.toString();\n if (name !== 'default') {\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n });\n }\n if (ts.isNamespaceExport(statement.exportClause)) {\n const name = statement.exportClause.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n }\n }\n\n // export modifiers\n // - variable statement\n // - function statement\n // - class statement\n const statementModifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined;\n if (statementModifiers) {\n statementModifiers.some((modifier) => {\n if (modifier.kind === ts.SyntaxKind.ExportKeyword) {\n if (ts.isVariableStatement(statement)) {\n const child = statement.declarationList.declarations[0];\n if (ts.isIdentifier(child.name)) {\n const name = child.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n } else if (ts.isFunctionDeclaration(statement)) {\n if (statement.name) {\n const name = statement.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n } else if (ts.isClassDeclaration(statement)) {\n if (statement.name) {\n const name = statement.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n }\n return true;\n }\n return false;\n });\n }\n });\n\n const withoutEmpty = exportModels.filter((exportModel) => exportModel !== undefined);\n // @ts-ignore\n return withoutEmpty;\n }\n\n parseModule(modulePath: string, content?: string) {\n const ast = ts.createSourceFile(modulePath, content ?? readFileSync(modulePath, 'utf8'), ts.ScriptTarget.Latest);\n\n const moduleExports = this.getExports(ast);\n return moduleExports;\n }\n\n parseStaticProperties(sourceFile: ts.SourceFile) {\n // TODO - should we also parse staticProperties inside classes / objects?\n\n const exportStaticProperties = new Map<string, StaticProperties>();\n\n sourceFile.statements.forEach((statement) => {\n try {\n if (!ts.isExpressionStatement(statement)) return;\n if (!ts.isBinaryExpression(statement.expression)) return;\n if (statement.expression.operatorToken.kind !== ts.SyntaxKind.EqualsToken) return;\n if (!ts.isPropertyAccessExpression(statement.expression.left)) return;\n if (!ts.isIdentifier(statement.expression.left.expression)) return;\n\n const targetName = statement.expression.left.expression.text;\n const propertyName = statement.expression.left.name.text;\n\n if (!exportStaticProperties.has(targetName)) exportStaticProperties.set(targetName, new Map());\n\n const existingProperties = exportStaticProperties.get(targetName);\n\n if (ts.isStringLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, statement.expression.right.text);\n } else if (ts.isNumericLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, +statement.expression.right.text);\n } else if (statement.expression.right.kind === ts.SyntaxKind.UndefinedKeyword) {\n existingProperties?.set(propertyName, undefined);\n } else if (statement.expression.right.kind === ts.SyntaxKind.NullKeyword) {\n existingProperties?.set(propertyName, null);\n } else if (statement.expression.right.kind === ts.SyntaxKind.TrueKeyword) {\n existingProperties?.set(propertyName, true);\n } else if (statement.expression.right.kind === ts.SyntaxKind.FalseKeyword) {\n existingProperties?.set(propertyName, false);\n }\n } catch (err) {\n this.logger?.error('failed parsing static properties', err);\n }\n });\n\n return exportStaticProperties;\n }\n\n constructor(private logger?: Logger | undefined) {}\n}\n"],"mappings":";;;;;;AACA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;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;IACF,CAAC,CAAC;IAEF,OAAOtB,sBAAsB;EAC/B;EAEAyB,WAAWA,CAASF,MAA2B,EAAE;IAAA,KAA7BA,MAA2B,GAA3BA,MAA2B;IAAA5F,eAAA,oBAnH5B,uBAAuB;EAmHQ;AACpD;AAAC+F,OAAA,CAAA7E,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_semanticsEntities","data","require","_fsExtra","_typescript","_interopRequireDefault","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","TypeScriptParser","getExports","sourceFile","staticProperties","parseStaticProperties","exportModels","statements","forEach","statement","ts","isExportAssignment","isExportDeclaration","exportClause","isNamedExports","elements","element","name","escapedText","toString","push","Export","get","isNamespaceExport","statementModifiers","canHaveModifiers","getModifiers","undefined","some","modifier","kind","SyntaxKind","ExportKeyword","isVariableStatement","child","declarationList","declarations","isIdentifier","isFunctionDeclaration","isClassDeclaration","withoutEmpty","filter","exportModel","parseModule","modulePath","content","ast","createSourceFile","readFileSync","ScriptTarget","Latest","moduleExports","exportStaticProperties","Map","isExpressionStatement","isBinaryExpression","expression","operatorToken","EqualsToken","isPropertyAccessExpression","left","targetName","text","propertyName","has","set","existingProperties","isStringLiteral","right","isNumericLiteral","UndefinedKeyword","NullKeyword","TrueKeyword","FalseKeyword","err","logger","error","constructor","exports"],"sources":["typescript.parser.ts"],"sourcesContent":["import type { Parser } from '@teambit/schema';\nimport type { StaticProperties } from '@teambit/semantics.entities.semantic-schema';\nimport { Export } from '@teambit/semantics.entities.semantic-schema';\nimport type { Logger } from '@teambit/logger';\nimport { readFileSync } from 'fs-extra';\nimport ts from 'typescript';\n\nexport class TypeScriptParser implements Parser {\n public extension = /^.*\\.(js|jsx|ts|tsx)$/;\n\n getExports(sourceFile: ts.SourceFile): Export[] {\n const staticProperties = this.parseStaticProperties(sourceFile);\n const exportModels: Export[] = [];\n\n sourceFile.statements.forEach((statement) => {\n // export default\n if (ts.isExportAssignment(statement)) {\n // export default\n }\n\n // export declarations or re-exports\n if (ts.isExportDeclaration(statement)) {\n if (statement.exportClause) {\n if (ts.isNamedExports(statement.exportClause)) {\n statement.exportClause.elements.forEach((element) => {\n const name = element.name.escapedText.toString();\n if (name !== 'default') {\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n });\n }\n if (ts.isNamespaceExport(statement.exportClause)) {\n const name = statement.exportClause.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n }\n }\n\n // export modifiers\n // - variable statement\n // - function statement\n // - class statement\n const statementModifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined;\n if (statementModifiers) {\n statementModifiers.some((modifier) => {\n if (modifier.kind === ts.SyntaxKind.ExportKeyword) {\n if (ts.isVariableStatement(statement)) {\n const child = statement.declarationList.declarations[0];\n if (ts.isIdentifier(child.name)) {\n const name = child.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n } else if (ts.isFunctionDeclaration(statement)) {\n if (statement.name) {\n const name = statement.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n } else if (ts.isClassDeclaration(statement)) {\n if (statement.name) {\n const name = statement.name.escapedText.toString();\n exportModels.push(new Export(name, staticProperties.get(name)));\n }\n }\n return true;\n }\n return false;\n });\n }\n });\n\n const withoutEmpty = exportModels.filter((exportModel) => exportModel !== undefined);\n // @ts-ignore\n return withoutEmpty;\n }\n\n parseModule(modulePath: string, content?: string) {\n const ast = ts.createSourceFile(modulePath, content ?? readFileSync(modulePath, 'utf8'), ts.ScriptTarget.Latest);\n\n const moduleExports = this.getExports(ast);\n return moduleExports;\n }\n\n parseStaticProperties(sourceFile: ts.SourceFile) {\n // TODO - should we also parse staticProperties inside classes / objects?\n\n const exportStaticProperties = new Map<string, StaticProperties>();\n\n sourceFile.statements.forEach((statement) => {\n try {\n if (!ts.isExpressionStatement(statement)) return;\n if (!ts.isBinaryExpression(statement.expression)) return;\n if (statement.expression.operatorToken.kind !== ts.SyntaxKind.EqualsToken) return;\n if (!ts.isPropertyAccessExpression(statement.expression.left)) return;\n if (!ts.isIdentifier(statement.expression.left.expression)) return;\n\n const targetName = statement.expression.left.expression.text;\n const propertyName = statement.expression.left.name.text;\n\n if (!exportStaticProperties.has(targetName)) exportStaticProperties.set(targetName, new Map());\n\n const existingProperties = exportStaticProperties.get(targetName);\n\n if (ts.isStringLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, statement.expression.right.text);\n } else if (ts.isNumericLiteral(statement.expression.right)) {\n existingProperties?.set(propertyName, +statement.expression.right.text);\n } else if (statement.expression.right.kind === ts.SyntaxKind.UndefinedKeyword) {\n existingProperties?.set(propertyName, undefined);\n } else if (statement.expression.right.kind === ts.SyntaxKind.NullKeyword) {\n existingProperties?.set(propertyName, null);\n } else if (statement.expression.right.kind === ts.SyntaxKind.TrueKeyword) {\n existingProperties?.set(propertyName, true);\n } else if (statement.expression.right.kind === ts.SyntaxKind.FalseKeyword) {\n existingProperties?.set(propertyName, false);\n }\n } catch (err) {\n this.logger?.error('failed parsing static properties', err);\n }\n });\n\n return exportStaticProperties;\n }\n\n constructor(private logger?: Logger | undefined) {}\n}\n"],"mappings":";;;;;;AAEA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAH,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4B,SAAAI,uBAAAC,CAA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,GAA3BA,MAA2B;IAAA5F,eAAA,oBAnH5B,uBAAuB;EAmHQ;AACpD;AAAC+F,OAAA,CAAA7E,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import type { Node } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import type { Component } from '@teambit/component';
|
|
4
|
+
import type { Location } from '@teambit/semantics.entities.semantic-schema';
|
|
4
5
|
|
|
5
6
|
export class TransformerNotFound extends Error {
|
|
6
7
|
constructor(
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/typescript",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.668",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/typescript/typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.typescript",
|
|
8
8
|
"name": "typescript",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.668"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -16,28 +16,28 @@
|
|
|
16
16
|
"get-tsconfig": "4.2.0",
|
|
17
17
|
"fs-extra": "10.0.0",
|
|
18
18
|
"chalk": "4.1.2",
|
|
19
|
-
"@teambit/typescript.modules.ts-config-mutator": "0.0.85",
|
|
20
19
|
"@teambit/typescript.typescript-compiler": "2.0.58",
|
|
21
|
-
"@teambit/component.sources": "0.0.109",
|
|
22
20
|
"@teambit/legacy.utils": "0.0.22",
|
|
23
21
|
"@teambit/semantics.entities.semantic-schema": "0.0.89",
|
|
24
|
-
"@teambit/ts-server": "0.0.65",
|
|
25
22
|
"@teambit/harmony": "0.4.7",
|
|
26
23
|
"@teambit/legacy.constants": "0.0.13",
|
|
27
|
-
"@teambit/compiler": "1.0.
|
|
28
|
-
"@teambit/
|
|
29
|
-
"@teambit/
|
|
30
|
-
"@teambit/
|
|
31
|
-
"@teambit/
|
|
32
|
-
"@teambit/
|
|
33
|
-
"@teambit/
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/
|
|
36
|
-
"@teambit/
|
|
37
|
-
"@teambit/
|
|
38
|
-
"@teambit/
|
|
39
|
-
"@teambit/
|
|
40
|
-
"@teambit/
|
|
24
|
+
"@teambit/compiler": "1.0.668",
|
|
25
|
+
"@teambit/typescript.modules.ts-config-mutator": "0.0.86",
|
|
26
|
+
"@teambit/builder": "1.0.668",
|
|
27
|
+
"@teambit/component.sources": "0.0.110",
|
|
28
|
+
"@teambit/component": "1.0.668",
|
|
29
|
+
"@teambit/dependency-resolver": "1.0.668",
|
|
30
|
+
"@teambit/formatter": "1.0.668",
|
|
31
|
+
"@teambit/ts-server": "0.0.66",
|
|
32
|
+
"@teambit/aspect-loader": "1.0.668",
|
|
33
|
+
"@teambit/envs": "1.0.668",
|
|
34
|
+
"@teambit/logger": "0.0.1338",
|
|
35
|
+
"@teambit/schema": "1.0.668",
|
|
36
|
+
"@teambit/scope": "1.0.668",
|
|
37
|
+
"@teambit/workspace": "1.0.668",
|
|
38
|
+
"@teambit/cli": "0.0.1245",
|
|
39
|
+
"@teambit/pkg": "1.0.668",
|
|
40
|
+
"@teambit/watcher": "1.0.668"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/lodash": "4.14.165",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { SourceFileTransformer } from './index';
|
|
2
|
+
import type { SourceFileTransformer } from './index';
|
|
3
3
|
import { replaceName } from './replaceName';
|
|
4
4
|
|
|
5
5
|
export const expressionStatementTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { SourceFileTransformer } from './index';
|
|
2
|
+
import type { SourceFileTransformer } from './index';
|
|
3
3
|
import { replaceName } from './replaceName';
|
|
4
4
|
|
|
5
5
|
export const functionNamesTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
SchemaNode,
|
|
4
|
-
UnImplementedSchema,
|
|
5
|
-
} from '@teambit/semantics.entities.semantic-schema';
|
|
1
|
+
import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
|
|
2
|
+
import { ArrayLiteralExpressionSchema, UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
6
3
|
import pMapSeries from 'p-map-series';
|
|
7
|
-
import
|
|
4
|
+
import type { ArrayLiteralExpression, Node } from 'typescript';
|
|
5
|
+
import ts from 'typescript';
|
|
8
6
|
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
9
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
10
|
-
import { Identifier } from '../identifier';
|
|
7
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
8
|
+
import type { Identifier } from '../identifier';
|
|
11
9
|
|
|
12
10
|
export class ArrayLiteralExpressionTransformer implements SchemaTransformer {
|
|
13
11
|
predicate(node: Node): boolean {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ArrayTypeNode, Node } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { TypeArraySchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
export class ArrayTypeTransformer implements SchemaTransformer {
|
|
8
9
|
predicate(node: Node) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { BindingElement, Node } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
6
|
import { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';
|
|
6
7
|
import { Identifier } from '../identifier';
|
|
7
8
|
|
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
UnresolvedSchema,
|
|
6
6
|
ExpressionWithTypeArgumentsSchema,
|
|
7
7
|
} from '@teambit/semantics.entities.semantic-schema';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
8
|
+
import type { Node, ClassDeclaration } from 'typescript';
|
|
9
|
+
import ts from 'typescript';
|
|
10
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
11
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
11
12
|
import { Identifier } from '../identifier';
|
|
12
13
|
|
|
13
14
|
export class ClassDeclarationTransformer implements SchemaTransformer {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Node,
|
|
1
|
+
import type { Node, ConditionalTypeNode } from 'typescript';
|
|
2
|
+
import { SyntaxKind } from 'typescript';
|
|
2
3
|
import { ConditionalTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
export class ConditionalTypeTransformer implements SchemaTransformer {
|
|
8
9
|
predicate(node: Node) {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ThisTypeSchema,
|
|
6
|
-
Modifier,
|
|
7
|
-
} from '@teambit/semantics.entities.semantic-schema';
|
|
1
|
+
import type { Node, ConstructorDeclaration } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import type { ParameterSchema, Modifier } from '@teambit/semantics.entities.semantic-schema';
|
|
4
|
+
import { ConstructorSchema, ThisTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
8
5
|
import pMapSeries from 'p-map-series';
|
|
9
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
10
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
11
|
-
import { Identifier } from '../identifier';
|
|
6
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
7
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
8
|
+
import type { Identifier } from '../identifier';
|
|
12
9
|
|
|
13
10
|
export class ConstructorTransformer implements SchemaTransformer {
|
|
14
11
|
predicate(node: Node) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
|
|
2
|
+
import { DecoratorSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
+
import type { Decorator, Node } from 'typescript';
|
|
4
|
+
import ts from 'typescript';
|
|
3
5
|
import pMapSeries from 'p-map-series';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
6
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
7
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
6
8
|
import { Identifier } from '../identifier';
|
|
7
9
|
|
|
8
10
|
export class DecoratorTransformer implements SchemaTransformer {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Node, EnumDeclaration } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { EnumMemberSchema, EnumSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
4
|
import pMapSeries from 'p-map-series';
|
|
4
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
5
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
6
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
7
|
import { Identifier } from '../identifier';
|
|
7
8
|
|
|
8
9
|
export class EnumDeclarationTransformer implements SchemaTransformer {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
|
|
2
|
+
import { ExportSchema, TypeRefSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
+
import type { Node, ExportAssignment as ExportAssignmentNode } from 'typescript';
|
|
4
|
+
import { SyntaxKind } from 'typescript';
|
|
3
5
|
import { ExportIdentifier } from '../export-identifier';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
6
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
7
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* This is either an export = or an export default declaration.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
|
|
1
2
|
import {
|
|
2
|
-
SchemaNode,
|
|
3
3
|
ModuleSchema,
|
|
4
4
|
UnresolvedSchema,
|
|
5
5
|
UnImplementedSchema,
|
|
6
6
|
ExportSchema,
|
|
7
7
|
} from '@teambit/semantics.entities.semantic-schema';
|
|
8
|
-
import
|
|
8
|
+
import type {
|
|
9
9
|
Node,
|
|
10
|
-
SyntaxKind,
|
|
11
10
|
ExportDeclaration as ExportDeclarationNode,
|
|
12
11
|
NamedExports,
|
|
13
12
|
NamespaceExport,
|
|
14
13
|
ExportSpecifier,
|
|
15
14
|
} from 'typescript';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import ts, { SyntaxKind } from 'typescript';
|
|
16
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
17
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
18
18
|
import { ExportIdentifier } from '../export-identifier';
|
|
19
19
|
|
|
20
20
|
export class ExportDeclarationTransformer implements SchemaTransformer {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Node, ExpressionStatement } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
export class ExpressionStatementTransformer implements SchemaTransformer {
|
|
8
9
|
predicate(node: Node) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { ParameterSchema, SchemaNode, Modifier } from '@teambit/semantics.entities.semantic-schema';
|
|
2
|
+
import { FunctionLikeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
+
import type { Node, SignatureDeclaration } from 'typescript';
|
|
4
|
+
import ts from 'typescript';
|
|
3
5
|
import pMapSeries from 'p-map-series';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
6
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
7
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
6
8
|
import { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';
|
|
7
9
|
import { Identifier } from '../identifier';
|
|
8
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Node, GetAccessorDeclaration } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { GetAccessorSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
6
|
import { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';
|
|
6
|
-
import { Identifier } from '../identifier';
|
|
7
|
+
import type { Identifier } from '../identifier';
|
|
7
8
|
|
|
8
9
|
export class GetAccessorTransformer implements SchemaTransformer {
|
|
9
10
|
predicate(node: Node) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ImportDeclaration, Node
|
|
1
|
+
import type { ImportDeclaration, Node } from 'typescript';
|
|
2
|
+
import { SyntaxKind } from 'typescript';
|
|
2
3
|
import { UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
6
|
import { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
export class ImportDeclarationTransformer implements SchemaTransformer {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { Node, IndexSignatureDeclaration } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import type { ParameterSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
4
|
+
import { IndexSignatureSchema, UnresolvedSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
5
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
6
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
7
|
+
import type { Identifier } from '../identifier';
|
|
6
8
|
|
|
7
9
|
export class IndexSignatureTransformer implements SchemaTransformer {
|
|
8
10
|
predicate(node: Node) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IndexedAccessTypeNode, Node
|
|
1
|
+
import type { IndexedAccessTypeNode, Node } from 'typescript';
|
|
2
|
+
import { SyntaxKind } from 'typescript';
|
|
2
3
|
import { IndexedAccessSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
export class IndexedAccessTypeTransformer implements SchemaTransformer {
|
|
8
9
|
predicate(node: Node) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Node, InterfaceDeclaration } from 'typescript';
|
|
2
|
+
import type ts from 'typescript';
|
|
3
|
+
import { SyntaxKind } from 'typescript';
|
|
2
4
|
import pMapSeries from 'p-map-series';
|
|
3
5
|
import {
|
|
4
6
|
ExpressionWithTypeArgumentsSchema,
|
|
5
7
|
InterfaceSchema,
|
|
6
8
|
UnresolvedSchema,
|
|
7
9
|
} from '@teambit/semantics.entities.semantic-schema';
|
|
8
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
9
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
10
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
11
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
10
12
|
import { Identifier } from '../identifier';
|
|
11
13
|
|
|
12
14
|
export class InterfaceDeclarationTransformer implements SchemaTransformer {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Node, IntersectionTypeNode } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { TypeIntersectionSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
4
|
import pMapSeries from 'p-map-series';
|
|
4
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
5
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
-
import { Identifier } from '../identifier';
|
|
5
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
6
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
7
|
+
import type { Identifier } from '../identifier';
|
|
7
8
|
|
|
8
9
|
export class IntersectionTypeTransformer implements SchemaTransformer {
|
|
9
10
|
predicate(node: Node) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Node
|
|
1
|
+
import type { Node } from 'typescript';
|
|
2
|
+
import { SyntaxKind } from 'typescript';
|
|
2
3
|
import { KeywordTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* whether it's kind of `ts.KeywordTypeSyntaxKind`
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { LiteralTypeNode, Node } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { LiteralTypeSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* e.g. string/boolean
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
|
|
2
|
+
import { LiteralValueSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
+
import type { Node, StringLiteral } from 'typescript';
|
|
4
|
+
import ts from 'typescript';
|
|
3
5
|
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
4
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
6
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
7
|
+
import type { Identifier } from '../identifier';
|
|
6
8
|
|
|
7
9
|
export type LiteralValueNode =
|
|
8
10
|
| StringLiteral
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Node, ModuleDeclaration } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import { UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
export class ModuleDeclarationTransformer implements SchemaTransformer {
|
|
8
9
|
predicate(node: Node) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Node,
|
|
1
|
+
import type { Node, NamedTupleMember } from 'typescript';
|
|
2
|
+
import { SyntaxKind } from 'typescript';
|
|
2
3
|
import { NamedTupleSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
3
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
4
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { Identifier } from '../identifier';
|
|
4
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
5
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
6
|
+
import type { Identifier } from '../identifier';
|
|
6
7
|
|
|
7
8
|
export class NamedTupleTransformer implements SchemaTransformer {
|
|
8
9
|
predicate(node: Node) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Node, ObjectLiteralExpression } from 'typescript';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
import pMapSeries from 'p-map-series';
|
|
3
4
|
import { ObjectLiteralExpressionSchema, UnImplementedSchema } from '@teambit/semantics.entities.semantic-schema';
|
|
4
5
|
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
5
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
6
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
6
7
|
|
|
7
8
|
export class ObjectLiteralExpressionTransformer implements SchemaTransformer {
|
|
8
9
|
predicate(node: Node) {
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Node,
|
|
5
|
-
ParameterDeclaration,
|
|
6
|
-
SyntaxKind,
|
|
7
|
-
ArrayBindingElement,
|
|
8
|
-
isComputedPropertyName,
|
|
9
|
-
} from 'typescript';
|
|
1
|
+
import type { BindingElement, Node, ParameterDeclaration, ArrayBindingElement } from 'typescript';
|
|
2
|
+
import ts, { isIdentifier, SyntaxKind, isComputedPropertyName } from 'typescript';
|
|
3
|
+
import type { SchemaNode } from '@teambit/semantics.entities.semantic-schema';
|
|
10
4
|
import {
|
|
11
5
|
InferenceTypeSchema,
|
|
12
6
|
ParameterSchema,
|
|
13
|
-
SchemaNode,
|
|
14
7
|
TupleTypeSchema,
|
|
15
8
|
TypeLiteralSchema,
|
|
16
9
|
} from '@teambit/semantics.entities.semantic-schema';
|
|
17
10
|
import pMapSeries from 'p-map-series';
|
|
18
|
-
import { SchemaTransformer } from '../schema-transformer';
|
|
19
|
-
import { SchemaExtractorContext } from '../schema-extractor-context';
|
|
11
|
+
import type { SchemaTransformer } from '../schema-transformer';
|
|
12
|
+
import type { SchemaExtractorContext } from '../schema-extractor-context';
|
|
20
13
|
import { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';
|
|
21
|
-
import { Identifier } from '../identifier';
|
|
14
|
+
import type { Identifier } from '../identifier';
|
|
22
15
|
|
|
23
16
|
export class ParameterTransformer implements SchemaTransformer {
|
|
24
17
|
predicate(node: Node) {
|