@teambit/typescript 0.0.1157 → 0.0.1159
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-1694488626516.js → preview-1694624356552.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.js +5 -11
- 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,9 +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.regexp.exec.js");
|
|
6
|
-
require("core-js/modules/es.string.replace.js");
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
@@ -15,6 +11,7 @@ function _typescript() {
|
|
|
15
11
|
};
|
|
16
12
|
return data;
|
|
17
13
|
}
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
15
|
const importTransformer = mapping => {
|
|
19
16
|
return context => {
|
|
20
17
|
const visit = node => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","importTransformer","mapping","context","visit","node","ts","isImportDeclaration","_node$importClause","moduleSpecifier","getText","slice","oldName","newName","Object","entries","includes","replace","importClause","namedBindings","isNamedImports","transformedBindings","elements","map","element","originalName","propertyName","text","name","aliasName","startsWith","endsWith","factory","updateImportSpecifier","createIdentifier","undefined","updatedImportClause","updateImportClause","isTypeOnly","createNamedImports","updateImportDeclaration","decorators","modifiers","createStringLiteral","isImportEqualsDeclaration","moduleReference","updatedImportEqualsDeclaration","updateImportEqualsDeclaration","createExternalModuleReference","isCallExpression","isIdentifier","expression","firstArg","arguments","isStringLiteral","updatedArg","updateCallExpression","typeArguments","visitEachChild","visitNode","exports"],"sources":["import.ts"],"sourcesContent":["import ts from 'typescript';\nimport { SourceFileTransformer } from '.';\n\nexport const importTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {\n return (context) => {\n const visit: ts.Visitor = (node) => {\n if (ts.isImportDeclaration(node)) {\n let moduleSpecifier = node.moduleSpecifier.getText().slice(1, -1);\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (moduleSpecifier.includes(oldName)) {\n moduleSpecifier = moduleSpecifier.replace(oldName, newName);\n }\n }\n\n if (node.importClause?.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {\n const transformedBindings = node.importClause.namedBindings.elements.map((element) => {\n let originalName = element.propertyName ? element.propertyName.text : element.name.text;\n const aliasName = element.name.text;\n\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (originalName.startsWith(oldName) || originalName.endsWith(oldName)) {\n originalName = originalName.replace(oldName, newName);\n }\n }\n\n return ts.factory.updateImportSpecifier(\n element,\n false,\n element.propertyName ? ts.factory.createIdentifier(originalName) : undefined,\n ts.factory.createIdentifier(aliasName)\n );\n });\n\n const updatedImportClause = ts.factory.updateImportClause(\n node.importClause,\n node.importClause.isTypeOnly,\n node.importClause.name,\n ts.factory.createNamedImports(transformedBindings)\n );\n\n return ts.factory.updateImportDeclaration(\n node,\n node.decorators,\n node.modifiers,\n updatedImportClause,\n ts.factory.createStringLiteral(moduleSpecifier),\n undefined\n );\n }\n\n return ts.factory.updateImportDeclaration(\n node,\n node.decorators,\n node.modifiers,\n node.importClause,\n ts.factory.createStringLiteral(moduleSpecifier),\n undefined\n );\n }\n if (ts.isImportEqualsDeclaration(node)) {\n let moduleSpecifier = node.moduleReference.getText().slice(1, -1);\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (moduleSpecifier.includes(oldName)) {\n moduleSpecifier = moduleSpecifier.replace(oldName, newName);\n }\n }\n\n const updatedImportEqualsDeclaration = ts.factory.updateImportEqualsDeclaration(\n node,\n node.decorators,\n node.modifiers,\n node.isTypeOnly,\n node.name,\n ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(moduleSpecifier))\n );\n\n return updatedImportEqualsDeclaration;\n }\n\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'require') {\n const [firstArg] = node.arguments;\n\n if (ts.isStringLiteral(firstArg)) {\n let moduleSpecifier = firstArg.text;\n\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (moduleSpecifier.includes(oldName)) {\n moduleSpecifier = moduleSpecifier.replace(oldName, newName);\n }\n }\n\n const updatedArg = ts.factory.createStringLiteral(moduleSpecifier);\n return ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [\n updatedArg,\n ...node.arguments.slice(1),\n ]);\n }\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return (node) => ts.visitNode(node, visit);\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","obj","__esModule","default","importTransformer","mapping","context","visit","node","ts","isImportDeclaration","_node$importClause","moduleSpecifier","getText","slice","oldName","newName","Object","entries","includes","replace","importClause","namedBindings","isNamedImports","transformedBindings","elements","map","element","originalName","propertyName","text","name","aliasName","startsWith","endsWith","factory","updateImportSpecifier","createIdentifier","undefined","updatedImportClause","updateImportClause","isTypeOnly","createNamedImports","updateImportDeclaration","decorators","modifiers","createStringLiteral","isImportEqualsDeclaration","moduleReference","updatedImportEqualsDeclaration","updateImportEqualsDeclaration","createExternalModuleReference","isCallExpression","isIdentifier","expression","firstArg","arguments","isStringLiteral","updatedArg","updateCallExpression","typeArguments","visitEachChild","visitNode","exports"],"sources":["import.ts"],"sourcesContent":["import ts from 'typescript';\nimport { SourceFileTransformer } from '.';\n\nexport const importTransformer: SourceFileTransformer = (mapping: Record<string, string>) => {\n return (context) => {\n const visit: ts.Visitor = (node) => {\n if (ts.isImportDeclaration(node)) {\n let moduleSpecifier = node.moduleSpecifier.getText().slice(1, -1);\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (moduleSpecifier.includes(oldName)) {\n moduleSpecifier = moduleSpecifier.replace(oldName, newName);\n }\n }\n\n if (node.importClause?.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {\n const transformedBindings = node.importClause.namedBindings.elements.map((element) => {\n let originalName = element.propertyName ? element.propertyName.text : element.name.text;\n const aliasName = element.name.text;\n\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (originalName.startsWith(oldName) || originalName.endsWith(oldName)) {\n originalName = originalName.replace(oldName, newName);\n }\n }\n\n return ts.factory.updateImportSpecifier(\n element,\n false,\n element.propertyName ? ts.factory.createIdentifier(originalName) : undefined,\n ts.factory.createIdentifier(aliasName)\n );\n });\n\n const updatedImportClause = ts.factory.updateImportClause(\n node.importClause,\n node.importClause.isTypeOnly,\n node.importClause.name,\n ts.factory.createNamedImports(transformedBindings)\n );\n\n return ts.factory.updateImportDeclaration(\n node,\n node.decorators,\n node.modifiers,\n updatedImportClause,\n ts.factory.createStringLiteral(moduleSpecifier),\n undefined\n );\n }\n\n return ts.factory.updateImportDeclaration(\n node,\n node.decorators,\n node.modifiers,\n node.importClause,\n ts.factory.createStringLiteral(moduleSpecifier),\n undefined\n );\n }\n if (ts.isImportEqualsDeclaration(node)) {\n let moduleSpecifier = node.moduleReference.getText().slice(1, -1);\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (moduleSpecifier.includes(oldName)) {\n moduleSpecifier = moduleSpecifier.replace(oldName, newName);\n }\n }\n\n const updatedImportEqualsDeclaration = ts.factory.updateImportEqualsDeclaration(\n node,\n node.decorators,\n node.modifiers,\n node.isTypeOnly,\n node.name,\n ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(moduleSpecifier))\n );\n\n return updatedImportEqualsDeclaration;\n }\n\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'require') {\n const [firstArg] = node.arguments;\n\n if (ts.isStringLiteral(firstArg)) {\n let moduleSpecifier = firstArg.text;\n\n for (const [oldName, newName] of Object.entries(mapping)) {\n if (moduleSpecifier.includes(oldName)) {\n moduleSpecifier = moduleSpecifier.replace(oldName, newName);\n }\n }\n\n const updatedArg = ts.factory.createStringLiteral(moduleSpecifier);\n return ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [\n updatedArg,\n ...node.arguments.slice(1),\n ]);\n }\n }\n\n return ts.visitEachChild(node, visit, context);\n };\n return (node) => ts.visitNode(node, visit);\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;AAA4B,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGrB,MAAMG,iBAAwC,GAAIC,OAA+B,IAAK;EAC3F,OAAQC,OAAO,IAAK;IAClB,MAAMC,KAAiB,GAAIC,IAAI,IAAK;MAClC,IAAIC,qBAAE,CAACC,mBAAmB,CAACF,IAAI,CAAC,EAAE;QAAA,IAAAG,kBAAA;QAChC,IAAIC,eAAe,GAAGJ,IAAI,CAACI,eAAe,CAACC,OAAO,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjE,KAAK,MAAM,CAACC,OAAO,EAAEC,OAAO,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACb,OAAO,CAAC,EAAE;UACxD,IAAIO,eAAe,CAACO,QAAQ,CAACJ,OAAO,CAAC,EAAE;YAC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
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -19,6 +18,7 @@ function _replaceName() {
|
|
|
19
18
|
};
|
|
20
19
|
return data;
|
|
21
20
|
}
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
function interfaceNamesTransformer(nameMapping) {
|
|
23
23
|
return context => {
|
|
24
24
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","interfaceNamesTransformer","nameMapping","context","factory","visit","node","ts","isInterfaceDeclaration","oldName","name","text","newName","replaceName","newMembers","members","map","member","isPropertySignature","isIdentifier","memberName","updatePropertySignature","modifiers","createIdentifier","questionToken","type","updateInterfaceDeclaration","decorators","typeParameters","heritageClauses","visitEachChild","child","visitNode"],"sources":["interface.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function interfaceNamesTransformer(nameMapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n const visit: ts.Visitor = (node) => {\n if (ts.isInterfaceDeclaration(node)) {\n const oldName = node.name.text;\n const newName = replaceName(oldName, nameMapping);\n if (newName) {\n const newMembers = node.members.map((member) => {\n if (ts.isPropertySignature(member) && ts.isIdentifier(member.name)) {\n const memberName = member.name.text;\n if (nameMapping[memberName]) {\n return factory.updatePropertySignature(\n member,\n member.modifiers,\n factory.createIdentifier(nameMapping[memberName]),\n member.questionToken,\n member.type\n );\n }\n }\n return member;\n });\n return factory.updateInterfaceDeclaration(\n node,\n node.decorators,\n node.modifiers,\n factory.createIdentifier(newName),\n node.typeParameters,\n node.heritageClauses,\n newMembers\n );\n }\n }\n return ts.visitEachChild(node, (child) => visit(child), context);\n };\n return (node) => ts.visitNode(node, visit);\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","obj","__esModule","default","interfaceNamesTransformer","nameMapping","context","factory","visit","node","ts","isInterfaceDeclaration","oldName","name","text","newName","replaceName","newMembers","members","map","member","isPropertySignature","isIdentifier","memberName","updatePropertySignature","modifiers","createIdentifier","questionToken","type","updateInterfaceDeclaration","decorators","typeParameters","heritageClauses","visitEachChild","child","visitNode"],"sources":["interface.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function interfaceNamesTransformer(nameMapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n const visit: ts.Visitor = (node) => {\n if (ts.isInterfaceDeclaration(node)) {\n const oldName = node.name.text;\n const newName = replaceName(oldName, nameMapping);\n if (newName) {\n const newMembers = node.members.map((member) => {\n if (ts.isPropertySignature(member) && ts.isIdentifier(member.name)) {\n const memberName = member.name.text;\n if (nameMapping[memberName]) {\n return factory.updatePropertySignature(\n member,\n member.modifiers,\n factory.createIdentifier(nameMapping[memberName]),\n member.questionToken,\n member.type\n );\n }\n }\n return member;\n });\n return factory.updateInterfaceDeclaration(\n node,\n node.decorators,\n node.modifiers,\n factory.createIdentifier(newName),\n node.typeParameters,\n node.heritageClauses,\n newMembers\n );\n }\n }\n return ts.visitEachChild(node, (child) => visit(child), context);\n };\n return (node) => ts.visitNode(node, visit);\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,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4C,SAAAC,uBAAAG,GAAA,W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AACuB,cAAc,CAACxB,IAAI,EAAGyB,KAAK,IAAK1B,KAAK,CAAC0B,KAAK,CAAC,EAAE5B,OAAO,CAAC;IAClE,CAAC;IACD,OAAQG,IAAI,IAAKC,qBAAE,CAACyB,SAAS,CAAC1B,IAAI,EAAED,KAAK,CAAC;EAC5C,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.constructor.js");
|
|
5
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
6
|
-
require("core-js/modules/es.string.replace.js");
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["replaceName","oldName","nameMapping","old","Object","keys","startsWith","replace","RegExp","endsWith","undefined"],"sources":["replaceName.ts"],"sourcesContent":["export function replaceName(oldName: string, nameMapping: Record<string, string>): string | undefined {\n for (const old of Object.keys(nameMapping)) {\n if (oldName.startsWith(old) || oldName === old) {\n return oldName.replace(new RegExp(`^${old}`), nameMapping[old]);\n }\n if (oldName.endsWith(old)) {\n return oldName.replace(new RegExp(`${old}$`), nameMapping[old]);\n }\n }\n return undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["replaceName","oldName","nameMapping","old","Object","keys","startsWith","replace","RegExp","endsWith","undefined"],"sources":["replaceName.ts"],"sourcesContent":["export function replaceName(oldName: string, nameMapping: Record<string, string>): string | undefined {\n for (const old of Object.keys(nameMapping)) {\n if (oldName.startsWith(old) || oldName === old) {\n return oldName.replace(new RegExp(`^${old}`), nameMapping[old]);\n }\n if (oldName.endsWith(old)) {\n return oldName.replace(new RegExp(`${old}$`), nameMapping[old]);\n }\n }\n return undefined;\n}\n"],"mappings":";;;;;;AAAO,SAASA,WAAWA,CAACC,OAAe,EAAEC,WAAmC,EAAsB;EACpG,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACH,WAAW,CAAC,EAAE;IAC1C,IAAID,OAAO,CAACK,UAAU,CAACH,GAAG,CAAC,IAAIF,OAAO,KAAKE,GAAG,EAAE;MAC9C,OAAOF,OAAO,CAACM,OAAO,CAAC,IAAIC,MAAM,CAAE,IAAGL,GAAI,EAAC,CAAC,EAAED,WAAW,CAACC,GAAG,CAAC,CAAC;IACjE;IACA,IAAIF,OAAO,CAACQ,QAAQ,CAACN,GAAG,CAAC,EAAE;MACzB,OAAOF,OAAO,CAACM,OAAO,CAAC,IAAIC,MAAM,CAAE,GAAEL,GAAI,GAAE,CAAC,EAAED,WAAW,CAACC,GAAG,CAAC,CAAC;IACjE;EACF;EACA,OAAOO,SAAS;AAClB"}
|
|
@@ -1,11 +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
|
-
require("core-js/modules/es.regexp.constructor.js");
|
|
7
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
8
|
-
require("core-js/modules/es.string.replace.js");
|
|
9
3
|
Object.defineProperty(exports, "__esModule", {
|
|
10
4
|
value: true
|
|
11
5
|
});
|
|
@@ -33,6 +27,7 @@ function _emptyLineEncoder() {
|
|
|
33
27
|
}
|
|
34
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
31
|
/**
|
|
37
32
|
* Transforms a TypeScript source file using the provided transformer.
|
|
38
33
|
*
|
|
@@ -71,7 +66,7 @@ async function transformSourceFile(sourceFilePath, sourceFileContent, transforme
|
|
|
71
66
|
try {
|
|
72
67
|
const formattedSourceFileStr = await (formatter === null || formatter === void 0 ? void 0 : formatter.formatSnippet(transformedSourceFileStr, sourceFilePath));
|
|
73
68
|
return formattedSourceFileStr || transformedSourceFileStr;
|
|
74
|
-
} catch
|
|
69
|
+
} catch {
|
|
75
70
|
// We can ignore if the formatter fails
|
|
76
71
|
// TODO: log the error
|
|
77
72
|
// ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","path","_interopRequireWildcard","_emptyLineEncoder","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","transformSourceFile","sourceFilePath","sourceFileContent","transformers","formatter","updates","ext","extname","compatibleExts","includes","transformed","entries","forEach","oldStr","newStr","oldStringRegex","RegExp","replace","encoder","EmptyLineEncoder","encode","sourceFile","ts","createSourceFile","ScriptTarget","Latest","ScriptKind","TSX","transformedResult","transform","transformedSourceFile","printer","createPrinter","removeComments","transformedSourceFileStr","printFile","decode","emptyLineComment","emptyLineMarker","regex","formattedSourceFileStr","formatSnippet"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","path","_interopRequireWildcard","_emptyLineEncoder","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","transformSourceFile","sourceFilePath","sourceFileContent","transformers","formatter","updates","ext","extname","compatibleExts","includes","transformed","entries","forEach","oldStr","newStr","oldStringRegex","RegExp","replace","encoder","EmptyLineEncoder","encode","sourceFile","ts","createSourceFile","ScriptTarget","Latest","ScriptKind","TSX","transformedResult","transform","transformedSourceFile","printer","createPrinter","removeComments","transformedSourceFileStr","printFile","decode","emptyLineComment","emptyLineMarker","regex","formattedSourceFileStr","formatSnippet"],"sources":["transform.ts"],"sourcesContent":["import { Formatter } from '@teambit/formatter';\nimport ts from 'typescript';\nimport * as path from 'path';\nimport { EmptyLineEncoder } from './empty-line-encoder';\n/**\n * Transforms a TypeScript source file using the provided transformer.\n *\n * @param sourceFilePath Path to the TypeScript source file.\n * @param sourceFileContent The content of the source file.\n * @param transformers The transformers to be applied on the source file.\n * @param formatter (Optional) An optional formatter to format the transformed code. If no formatter is provided, the function returns the transformed source file as a string without any formatting.\n * @returns A promise that resolves to the transformed source file as a string.\n */\nexport async function transformSourceFile(\n sourceFilePath: string,\n sourceFileContent: string,\n transformers: ts.TransformerFactory<ts.SourceFile>[],\n formatter?: Formatter,\n updates?: Record<string, string>\n): Promise<string> {\n const ext = path.extname(sourceFilePath);\n const compatibleExts = ['.ts', '.tsx', '.js', '.jsx'];\n if (!compatibleExts.includes(ext)) {\n if (!updates) return sourceFileContent;\n let transformed = sourceFileContent;\n Object.entries(updates).forEach(([oldStr, newStr]) => {\n const oldStringRegex = new RegExp(oldStr, 'g');\n transformed = transformed.replace(oldStringRegex, newStr);\n });\n return transformed;\n }\n\n const encoder = new EmptyLineEncoder();\n sourceFileContent = encoder.encode(sourceFileContent);\n\n const sourceFile = ts.createSourceFile(\n sourceFilePath,\n sourceFileContent,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TSX\n );\n\n const transformedResult: ts.TransformationResult<ts.SourceFile> = ts.transform<ts.SourceFile>(\n sourceFile,\n transformers\n );\n const transformedSourceFile: ts.SourceFile = transformedResult.transformed[0] as ts.SourceFile;\n\n const printer: ts.Printer = ts.createPrinter({\n removeComments: false,\n });\n\n let transformedSourceFileStr = printer.printFile(transformedSourceFile);\n transformedSourceFileStr = encoder.decode(transformedSourceFileStr);\n // Remove trailing empty line markers\n const emptyLineComment = `\\\\s*\\\\/\\\\*${encoder.emptyLineMarker}\\\\*\\\\/\\\\s*$`;\n const regex = new RegExp(emptyLineComment, 'g');\n transformedSourceFileStr = transformedSourceFileStr.replace(regex, '');\n\n try {\n const formattedSourceFileStr = await formatter?.formatSnippet(transformedSourceFileStr, sourceFilePath);\n return formattedSourceFileStr || transformedSourceFileStr;\n } catch {\n // We can ignore if the formatter fails\n // TODO: log the error\n // ignore\n }\n return transformedSourceFileStr;\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,kBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,iBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAwD,SAAAM,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YA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O,CAACkB,MAAM,CAACF,wBAAwB,CAAC;EACnE;EACA,MAAMG,gBAAgB,GAAI,aAAYnB,OAAO,CAACoB,eAAgB,aAAY;EAC1E,MAAMC,KAAK,GAAG,IAAIvB,MAAM,CAACqB,gBAAgB,EAAE,GAAG,CAAC;EAC/CH,wBAAwB,GAAGA,wBAAwB,CAACjB,OAAO,CAACsB,KAAK,EAAE,EAAE,CAAC;EAEtE,IAAI;IACF,MAAMC,sBAAsB,GAAG,OAAMpC,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEqC,aAAa,CAACP,wBAAwB,EAAEjC,cAAc,CAAC;IACvG,OAAOuC,sBAAsB,IAAIN,wBAAwB;EAC3D,CAAC,CAAC,MAAM;IACN;IACA;IACA;EAAA;EAEF,OAAOA,wBAAwB;AACjC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -19,6 +18,7 @@ function _replaceName() {
|
|
|
19
18
|
};
|
|
20
19
|
return data;
|
|
21
20
|
}
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
function typeReferenceTransformer(mapping) {
|
|
23
23
|
return context => {
|
|
24
24
|
const visit = node => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","typeReferenceTransformer","mapping","context","visit","node","ts","isTypeReferenceNode","oldName","typeName","getText","newName","replaceName","factory","updateTypeReferenceNode","createIdentifier","typeArguments","visitEachChild","visitNode"],"sources":["type-reference.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function typeReferenceTransformer(mapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const visit: ts.Visitor = (node) => {\n if (ts.isTypeReferenceNode(node)) {\n const oldName = node.typeName.getText();\n const newName = replaceName(oldName, mapping);\n if (newName) {\n return ts.factory.updateTypeReferenceNode(node, ts.factory.createIdentifier(newName), node.typeArguments);\n }\n }\n return ts.visitEachChild(node, visit, context);\n };\n\n return (node) => ts.visitNode(node, visit);\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","obj","__esModule","default","typeReferenceTransformer","mapping","context","visit","node","ts","isTypeReferenceNode","oldName","typeName","getText","newName","replaceName","factory","updateTypeReferenceNode","createIdentifier","typeArguments","visitEachChild","visitNode"],"sources":["type-reference.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function typeReferenceTransformer(mapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const visit: ts.Visitor = (node) => {\n if (ts.isTypeReferenceNode(node)) {\n const oldName = node.typeName.getText();\n const newName = replaceName(oldName, mapping);\n if (newName) {\n return ts.factory.updateTypeReferenceNode(node, ts.factory.createIdentifier(newName), node.typeArguments);\n }\n }\n return ts.visitEachChild(node, visit, context);\n };\n\n return (node) => ts.visitNode(node, visit);\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,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4C,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErC,SAASG,wBAAwBA,CAACC,OAA+B,EAAwC;EAC9G,OAAQC,OAAO,IAAK;IAClB,MAAMC,KAAiB,GAAIC,IAAI,IAAK;MAClC,IAAIC,qBAAE,CAACC,mBAAmB,CAACF,IAAI,CAAC,EAAE;QAChC,MAAMG,OAAO,GAAGH,IAAI,CAACI,QAAQ,CAACC,OAAO,CAAC,CAAC;QACvC,MAAMC,OAAO,GAAG,IAAAC,0BAAW,EAACJ,OAAO,EAAEN,OAAO,CAAC;QAC7C,IAAIS,OAAO,EAAE;UACX,OAAOL,qBAAE,CAACO,OAAO,CAACC,uBAAuB,CAACT,IAAI,EAAEC,qBAAE,CAACO,OAAO,CAACE,gBAAgB,CAACJ,OAAO,CAAC,EAAEN,IAAI,CAACW,aAAa,CAAC;QAC3G;MACF;MACA,OAAOV,qBAAE,CAACW,cAAc,CAACZ,IAAI,EAAED,KAAK,EAAED,OAAO,CAAC;IAChD,CAAC;IAED,OAAQE,IAAI,IAAKC,qBAAE,CAACY,SAAS,CAACb,IAAI,EAAED,KAAK,CAAC;EAC5C,CAAC;AACH"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -19,6 +18,7 @@ function _replaceName() {
|
|
|
19
18
|
};
|
|
20
19
|
return data;
|
|
21
20
|
}
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
function typeAliasNamesTransformer(nameMapping) {
|
|
23
23
|
return context => {
|
|
24
24
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","typeAliasNamesTransformer","nameMapping","context","factory","visit","node","ts","isTypeAliasDeclaration","oldName","name","text","newName","replaceName","updateTypeAliasDeclaration","decorators","modifiers","createIdentifier","typeParameters","type","visitEachChild","child","visitNode"],"sources":["typeAlias.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function typeAliasNamesTransformer(nameMapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n const visit: ts.Visitor = (node) => {\n if (ts.isTypeAliasDeclaration(node)) {\n const oldName = node.name.text;\n const newName = replaceName(oldName, nameMapping);\n if (newName) {\n return factory.updateTypeAliasDeclaration(\n node,\n node.decorators,\n node.modifiers,\n factory.createIdentifier(newName),\n node.typeParameters,\n node.type\n );\n }\n }\n return ts.visitEachChild(node, (child) => visit(child), context);\n };\n return (node) => ts.visitNode(node, visit);\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","obj","__esModule","default","typeAliasNamesTransformer","nameMapping","context","factory","visit","node","ts","isTypeAliasDeclaration","oldName","name","text","newName","replaceName","updateTypeAliasDeclaration","decorators","modifiers","createIdentifier","typeParameters","type","visitEachChild","child","visitNode"],"sources":["typeAlias.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function typeAliasNamesTransformer(nameMapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n const visit: ts.Visitor = (node) => {\n if (ts.isTypeAliasDeclaration(node)) {\n const oldName = node.name.text;\n const newName = replaceName(oldName, nameMapping);\n if (newName) {\n return factory.updateTypeAliasDeclaration(\n node,\n node.decorators,\n node.modifiers,\n factory.createIdentifier(newName),\n node.typeParameters,\n node.type\n );\n }\n }\n return ts.visitEachChild(node, (child) => visit(child), context);\n };\n return (node) => ts.visitNode(node, visit);\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,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4C,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErC,SAASG,yBAAyBA,CAACC,WAAmC,EAAwC;EACnH,OAAQC,OAAO,IAAK;IAClB,MAAM;MAAEC;IAAQ,CAAC,GAAGD,OAAO;IAC3B,MAAME,KAAiB,GAAIC,IAAI,IAAK;MAClC,IAAIC,qBAAE,CAACC,sBAAsB,CAACF,IAAI,CAAC,EAAE;QACnC,MAAMG,OAAO,GAAGH,IAAI,CAACI,IAAI,CAACC,IAAI;QAC9B,MAAMC,OAAO,GAAG,IAAAC,0BAAW,EAACJ,OAAO,EAAEP,WAAW,CAAC;QACjD,IAAIU,OAAO,EAAE;UACX,OAAOR,OAAO,CAACU,0BAA0B,CACvCR,IAAI,EACJA,IAAI,CAACS,UAAU,EACfT,IAAI,CAACU,SAAS,EACdZ,OAAO,CAACa,gBAAgB,CAACL,OAAO,CAAC,EACjCN,IAAI,CAACY,cAAc,EACnBZ,IAAI,CAACa,IACP,CAAC;QACH;MACF;MACA,OAAOZ,qBAAE,CAACa,cAAc,CAACd,IAAI,EAAGe,KAAK,IAAKhB,KAAK,CAACgB,KAAK,CAAC,EAAElB,OAAO,CAAC;IAClE,CAAC;IACD,OAAQG,IAAI,IAAKC,qBAAE,CAACe,SAAS,CAAChB,IAAI,EAAED,KAAK,CAAC;EAC5C,CAAC;AACH"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -19,6 +18,7 @@ function _replaceName() {
|
|
|
19
18
|
};
|
|
20
19
|
return data;
|
|
21
20
|
}
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
function variableNamesTransformer(nameMapping) {
|
|
23
23
|
return context => {
|
|
24
24
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","variableNamesTransformer","nameMapping","context","factory","visit","node","ts","isVariableDeclaration","name","kind","SyntaxKind","Identifier","oldName","text","newName","replaceName","updateVariableDeclaration","createIdentifier","exclamationToken","type","initializer","visitEachChild","child","visitNode"],"sources":["variable.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function variableNamesTransformer(nameMapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n const visit: ts.Visitor = (node) => {\n if (ts.isVariableDeclaration(node) && node.name.kind === ts.SyntaxKind.Identifier) {\n const oldName = node.name.text;\n const newName = replaceName(oldName, nameMapping);\n if (newName) {\n return factory.updateVariableDeclaration(\n node,\n factory.createIdentifier(newName),\n node.exclamationToken,\n node.type,\n node.initializer\n );\n }\n }\n return ts.visitEachChild(node, (child) => visit(child), context);\n };\n return (node) => ts.visitNode(node, visit);\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_replaceName","obj","__esModule","default","variableNamesTransformer","nameMapping","context","factory","visit","node","ts","isVariableDeclaration","name","kind","SyntaxKind","Identifier","oldName","text","newName","replaceName","updateVariableDeclaration","createIdentifier","exclamationToken","type","initializer","visitEachChild","child","visitNode"],"sources":["variable.ts"],"sourcesContent":["import ts from 'typescript';\nimport { replaceName } from './replaceName';\n\nexport function variableNamesTransformer(nameMapping: Record<string, string>): ts.TransformerFactory<ts.SourceFile> {\n return (context) => {\n const { factory } = context;\n const visit: ts.Visitor = (node) => {\n if (ts.isVariableDeclaration(node) && node.name.kind === ts.SyntaxKind.Identifier) {\n const oldName = node.name.text;\n const newName = replaceName(oldName, nameMapping);\n if (newName) {\n return factory.updateVariableDeclaration(\n node,\n factory.createIdentifier(newName),\n node.exclamationToken,\n node.type,\n node.initializer\n );\n }\n }\n return ts.visitEachChild(node, (child) => visit(child), context);\n };\n return (node) => ts.visitNode(node, visit);\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,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA4C,SAAAC,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErC,SAASG,wBAAwBA,CAACC,WAAmC,EAAwC;EAClH,OAAQC,OAAO,IAAK;IAClB,MAAM;MAAEC;IAAQ,CAAC,GAAGD,OAAO;IAC3B,MAAME,KAAiB,GAAIC,IAAI,IAAK;MAClC,IAAIC,qBAAE,CAACC,qBAAqB,CAACF,IAAI,CAAC,IAAIA,IAAI,CAACG,IAAI,CAACC,IAAI,KAAKH,qBAAE,CAACI,UAAU,CAACC,UAAU,EAAE;QACjF,MAAMC,OAAO,GAAGP,IAAI,CAACG,IAAI,CAACK,IAAI;QAC9B,MAAMC,OAAO,GAAG,IAAAC,0BAAW,EAACH,OAAO,EAAEX,WAAW,CAAC;QACjD,IAAIa,OAAO,EAAE;UACX,OAAOX,OAAO,CAACa,yBAAyB,CACtCX,IAAI,EACJF,OAAO,CAACc,gBAAgB,CAACH,OAAO,CAAC,EACjCT,IAAI,CAACa,gBAAgB,EACrBb,IAAI,CAACc,IAAI,EACTd,IAAI,CAACe,WACP,CAAC;QACH;MACF;MACA,OAAOd,qBAAE,CAACe,cAAc,CAAChB,IAAI,EAAGiB,KAAK,IAAKlB,KAAK,CAACkB,KAAK,CAAC,EAAEpB,OAAO,CAAC;IAClE,CAAC;IACD,OAAQG,IAAI,IAAKC,qBAAE,CAACiB,SAAS,CAAClB,IAAI,EAAED,KAAK,CAAC;EAC5C,CAAC;AACH"}
|
|
@@ -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
|
function _typescript() {
|
|
7
4
|
const data = _interopRequireDefault(require("typescript"));
|
|
8
5
|
_typescript = function () {
|
|
@@ -17,6 +14,7 @@ function _sourceFileTransformers() {
|
|
|
17
14
|
};
|
|
18
15
|
return data;
|
|
19
16
|
}
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
18
|
function normalizeFormatting(code) {
|
|
21
19
|
const sourceFile = _typescript().default.createSourceFile('temp.ts', code, _typescript().default.ScriptTarget.Latest, true);
|
|
22
20
|
const printer = _typescript().default.createPrinter({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_sourceFileTransformers","normalizeFormatting","code","sourceFile","ts","createSourceFile","ScriptTarget","Latest","printer","createPrinter","newLine","NewLineKind","LineFeed","removeComments","printFile","describe","createTransformerTest","sourceCode","nameMapping","transformer","expectedCode","it","name","result","transformSourceFile","normalizedResult","normalizedExpectedCode","expect","toBe","testCases","classNamesTransformer","TestClass","functionNamesTransformer","testFunction","importTransformer","interfaceNamesTransformer","TestInterface","typeAliasNamesTransformer","TestType","variableNamesTransformer","testVariable","oldMethod","oldMember","expressionStatementTransformer","staticMethod","method","exportTransformer","normalizedSourceCode"],"sources":["transform-source-file.spec.ts"],"sourcesContent":["import ts from 'typescript';\nimport {\n transformSourceFile,\n classNamesTransformer,\n functionNamesTransformer,\n importTransformer,\n interfaceNamesTransformer,\n typeAliasNamesTransformer,\n variableNamesTransformer,\n expressionStatementTransformer,\n exportTransformer,\n} from './sourceFileTransformers';\n\nfunction normalizeFormatting(code: string): string {\n const sourceFile = ts.createSourceFile('temp.ts', code, ts.ScriptTarget.Latest, true);\n const printer = ts.createPrinter({\n newLine: ts.NewLineKind.LineFeed,\n removeComments: false,\n });\n return printer.printFile(sourceFile);\n}\n\ndescribe('transformSourceFile', () => {\n const createTransformerTest = (\n sourceCode: string,\n nameMapping: any,\n transformer: (nameMapping: any) => ts.TransformerFactory<ts.SourceFile>,\n expectedCode: string\n ) => {\n it(`should correctly transform source code with ${transformer.name}`, async () => {\n const result = await transformSourceFile('test.ts', sourceCode, [transformer(nameMapping)]);\n const normalizedResult = normalizeFormatting(result);\n const normalizedExpectedCode = normalizeFormatting(expectedCode);\n\n expect(normalizedResult).toBe(normalizedExpectedCode);\n });\n };\n\n const testCases = [\n {\n transformer: classNamesTransformer,\n sourceCode: 'class TestClass {}',\n nameMapping: { TestClass: 'NewClassName' },\n expectedCode: 'class NewClassName {}',\n },\n {\n transformer: functionNamesTransformer,\n sourceCode: 'function testFunction() {}',\n nameMapping: { testFunction: 'newFunctionName' },\n expectedCode: 'function newFunctionName() {}',\n },\n {\n transformer: importTransformer,\n sourceCode: 'import { Test } from \"./test\";',\n nameMapping: { './test': './newTest' },\n expectedCode: 'import { Test } from \"./newTest\";',\n },\n {\n transformer: interfaceNamesTransformer,\n sourceCode: 'interface TestInterface {}',\n nameMapping: { TestInterface: 'NewInterfaceName' },\n expectedCode: 'interface NewInterfaceName {}',\n },\n {\n transformer: typeAliasNamesTransformer,\n sourceCode: 'type TestType = string;',\n nameMapping: { TestType: 'NewTypeName' },\n expectedCode: 'type NewTypeName = string;',\n },\n {\n transformer: variableNamesTransformer,\n sourceCode: 'let testVariable = \"test\";',\n nameMapping: { testVariable: 'newVariableName' },\n expectedCode: 'let newVariableName = \"test\";',\n },\n {\n transformer: classNamesTransformer,\n sourceCode: 'class TestClass { oldMethod() {} }',\n nameMapping: { TestClass: 'NewClassName', oldMethod: 'newMethodName' },\n expectedCode: 'class NewClassName { newMethodName() {} }',\n },\n {\n transformer: classNamesTransformer,\n sourceCode: 'class TestClass { oldMember: string; }',\n nameMapping: { TestClass: 'NewClassName', oldMember: 'newMember' },\n expectedCode: 'class NewClassName { newMember: string; }',\n },\n {\n transformer: expressionStatementTransformer,\n sourceCode: 'TestClass.staticMethod();',\n nameMapping: { TestClass: 'NewClassName', staticMethod: 'newMethodName' },\n expectedCode: 'NewClassName.newMethodName();',\n },\n {\n transformer: expressionStatementTransformer,\n sourceCode: 'let instance = new TestClass(); instance.method();',\n nameMapping: { TestClass: 'NewClassName', method: 'newMethodName' },\n expectedCode: 'let instance = new NewClassName(); instance.newMethodName();',\n },\n {\n transformer: interfaceNamesTransformer,\n sourceCode: 'interface TestInterface { oldMember: string; }',\n nameMapping: { TestInterface: 'NewInterfaceName', oldMember: 'newMember' },\n expectedCode: 'interface NewInterfaceName { newMember: string; }',\n },\n {\n transformer: importTransformer,\n sourceCode: 'const UI = require(\"@xxx/ui-library\");',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'const UI = require(\"@abc/ui-library\");',\n },\n {\n transformer: exportTransformer,\n sourceCode: 'export { Component } from \"@xxx/ui-library\";',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'export { Component } from \"@abc/ui-library\";',\n },\n {\n transformer: exportTransformer,\n sourceCode: 'export * from \"@xxx/ui-library\";',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'export * from \"@abc/ui-library\";',\n },\n {\n transformer: exportTransformer,\n sourceCode: 'export { default as UI } from \"@xxx/ui-library\";',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'export { default as UI } from \"@abc/ui-library\";',\n },\n ];\n\n for (const { transformer, sourceCode, nameMapping, expectedCode } of testCases) {\n createTransformerTest(sourceCode, nameMapping, transformer, expectedCode);\n }\n\n it('should return original source code if no transformations are applied', async () => {\n const sourceCode = 'class TestClass {} function testFunction() {}';\n const result = await transformSourceFile('test.ts', sourceCode, []);\n const normalizedResult = normalizeFormatting(result);\n const normalizedSourceCode = normalizeFormatting(sourceCode);\n expect(normalizedResult).toBe(normalizedSourceCode);\n });\n\n it('should handle multiple transformers', async () => {\n const sourceCode = 'class TestClass {} function testFunction() {}';\n const expectedCode = 'class NewClassName {} function newFunctionName() {}';\n const result = await transformSourceFile('test.ts', sourceCode, [\n classNamesTransformer({ TestClass: 'NewClassName' }),\n functionNamesTransformer({ testFunction: 'newFunctionName' }),\n ]);\n const normalizedResult = normalizeFormatting(result);\n const normalizedExpectedCode = normalizeFormatting(expectedCode);\n expect(normalizedResult).toBe(normalizedExpectedCode);\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,wBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,uBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAYA,SAASI,mBAAmBA,CAACC,IAAY,EAAU;EACjD,MAAMC,UAAU,GAAGC,qBAAE,CAACC,gBAAgB,CAAC,SAAS,EAAEH,IAAI,EAAEE,qBAAE,CAACE,YAAY,CAACC,MAAM,EAAE,IAAI,CAAC;EACrF,MAAMC,OAAO,GAAGJ,qBAAE,CAACK,aAAa,CAAC;IAC/BC,OAAO,EAAEN,qBAAE,CAACO,WAAW,CAACC,QAAQ;IAChCC,cAAc,EAAE;EAClB,CAAC,CAAC;EACF,OAAOL,OAAO,CAACM,SAAS,CAACX,UAAU,CAAC;AACtC;AAEAY,QAAQ,CAAC,qBAAqB,EAAE,MAAM;E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,CAC9D,CAAC;IACF,MAAMR,gBAAgB,GAAGxB,mBAAmB,CAACsB,MAAM,CAAC;IACpD,MAAMG,sBAAsB,GAAGzB,mBAAmB,CAACmB,YAAY,CAAC;IAChEO,MAAM,CAACF,gBAAgB,CAAC,CAACG,IAAI,CAACF,sBAAsB,CAAC;EACvD,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_sourceFileTransformers","obj","__esModule","default","normalizeFormatting","code","sourceFile","ts","createSourceFile","ScriptTarget","Latest","printer","createPrinter","newLine","NewLineKind","LineFeed","removeComments","printFile","describe","createTransformerTest","sourceCode","nameMapping","transformer","expectedCode","it","name","result","transformSourceFile","normalizedResult","normalizedExpectedCode","expect","toBe","testCases","classNamesTransformer","TestClass","functionNamesTransformer","testFunction","importTransformer","interfaceNamesTransformer","TestInterface","typeAliasNamesTransformer","TestType","variableNamesTransformer","testVariable","oldMethod","oldMember","expressionStatementTransformer","staticMethod","method","exportTransformer","normalizedSourceCode"],"sources":["transform-source-file.spec.ts"],"sourcesContent":["import ts from 'typescript';\nimport {\n transformSourceFile,\n classNamesTransformer,\n functionNamesTransformer,\n importTransformer,\n interfaceNamesTransformer,\n typeAliasNamesTransformer,\n variableNamesTransformer,\n expressionStatementTransformer,\n exportTransformer,\n} from './sourceFileTransformers';\n\nfunction normalizeFormatting(code: string): string {\n const sourceFile = ts.createSourceFile('temp.ts', code, ts.ScriptTarget.Latest, true);\n const printer = ts.createPrinter({\n newLine: ts.NewLineKind.LineFeed,\n removeComments: false,\n });\n return printer.printFile(sourceFile);\n}\n\ndescribe('transformSourceFile', () => {\n const createTransformerTest = (\n sourceCode: string,\n nameMapping: any,\n transformer: (nameMapping: any) => ts.TransformerFactory<ts.SourceFile>,\n expectedCode: string\n ) => {\n it(`should correctly transform source code with ${transformer.name}`, async () => {\n const result = await transformSourceFile('test.ts', sourceCode, [transformer(nameMapping)]);\n const normalizedResult = normalizeFormatting(result);\n const normalizedExpectedCode = normalizeFormatting(expectedCode);\n\n expect(normalizedResult).toBe(normalizedExpectedCode);\n });\n };\n\n const testCases = [\n {\n transformer: classNamesTransformer,\n sourceCode: 'class TestClass {}',\n nameMapping: { TestClass: 'NewClassName' },\n expectedCode: 'class NewClassName {}',\n },\n {\n transformer: functionNamesTransformer,\n sourceCode: 'function testFunction() {}',\n nameMapping: { testFunction: 'newFunctionName' },\n expectedCode: 'function newFunctionName() {}',\n },\n {\n transformer: importTransformer,\n sourceCode: 'import { Test } from \"./test\";',\n nameMapping: { './test': './newTest' },\n expectedCode: 'import { Test } from \"./newTest\";',\n },\n {\n transformer: interfaceNamesTransformer,\n sourceCode: 'interface TestInterface {}',\n nameMapping: { TestInterface: 'NewInterfaceName' },\n expectedCode: 'interface NewInterfaceName {}',\n },\n {\n transformer: typeAliasNamesTransformer,\n sourceCode: 'type TestType = string;',\n nameMapping: { TestType: 'NewTypeName' },\n expectedCode: 'type NewTypeName = string;',\n },\n {\n transformer: variableNamesTransformer,\n sourceCode: 'let testVariable = \"test\";',\n nameMapping: { testVariable: 'newVariableName' },\n expectedCode: 'let newVariableName = \"test\";',\n },\n {\n transformer: classNamesTransformer,\n sourceCode: 'class TestClass { oldMethod() {} }',\n nameMapping: { TestClass: 'NewClassName', oldMethod: 'newMethodName' },\n expectedCode: 'class NewClassName { newMethodName() {} }',\n },\n {\n transformer: classNamesTransformer,\n sourceCode: 'class TestClass { oldMember: string; }',\n nameMapping: { TestClass: 'NewClassName', oldMember: 'newMember' },\n expectedCode: 'class NewClassName { newMember: string; }',\n },\n {\n transformer: expressionStatementTransformer,\n sourceCode: 'TestClass.staticMethod();',\n nameMapping: { TestClass: 'NewClassName', staticMethod: 'newMethodName' },\n expectedCode: 'NewClassName.newMethodName();',\n },\n {\n transformer: expressionStatementTransformer,\n sourceCode: 'let instance = new TestClass(); instance.method();',\n nameMapping: { TestClass: 'NewClassName', method: 'newMethodName' },\n expectedCode: 'let instance = new NewClassName(); instance.newMethodName();',\n },\n {\n transformer: interfaceNamesTransformer,\n sourceCode: 'interface TestInterface { oldMember: string; }',\n nameMapping: { TestInterface: 'NewInterfaceName', oldMember: 'newMember' },\n expectedCode: 'interface NewInterfaceName { newMember: string; }',\n },\n {\n transformer: importTransformer,\n sourceCode: 'const UI = require(\"@xxx/ui-library\");',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'const UI = require(\"@abc/ui-library\");',\n },\n {\n transformer: exportTransformer,\n sourceCode: 'export { Component } from \"@xxx/ui-library\";',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'export { Component } from \"@abc/ui-library\";',\n },\n {\n transformer: exportTransformer,\n sourceCode: 'export * from \"@xxx/ui-library\";',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'export * from \"@abc/ui-library\";',\n },\n {\n transformer: exportTransformer,\n sourceCode: 'export { default as UI } from \"@xxx/ui-library\";',\n nameMapping: { '@xxx/ui-library': '@abc/ui-library' },\n expectedCode: 'export { default as UI } from \"@abc/ui-library\";',\n },\n ];\n\n for (const { transformer, sourceCode, nameMapping, expectedCode } of testCases) {\n createTransformerTest(sourceCode, nameMapping, transformer, expectedCode);\n }\n\n it('should return original source code if no transformations are applied', async () => {\n const sourceCode = 'class TestClass {} function testFunction() {}';\n const result = await transformSourceFile('test.ts', sourceCode, []);\n const normalizedResult = normalizeFormatting(result);\n const normalizedSourceCode = normalizeFormatting(sourceCode);\n expect(normalizedResult).toBe(normalizedSourceCode);\n });\n\n it('should handle multiple transformers', async () => {\n const sourceCode = 'class TestClass {} function testFunction() {}';\n const expectedCode = 'class NewClassName {} function newFunctionName() {}';\n const result = await transformSourceFile('test.ts', sourceCode, [\n classNamesTransformer({ TestClass: 'NewClassName' }),\n functionNamesTransformer({ testFunction: 'newFunctionName' }),\n ]);\n const normalizedResult = normalizeFormatting(result);\n const normalizedExpectedCode = normalizeFormatting(expectedCode);\n expect(normalizedResult).toBe(normalized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EC,WAAW;IAAEE;EAAa,CAAC,IAAIS,SAAS,EAAE;IAC9Eb,qBAAqB,CAACC,UAAU,EAAEC,WAAW,EAAEC,WAAW,EAAEC,YAAY,CAAC;EAC3E;EAEAC,EAAE,CAAC,sEAAsE,EAAE,YAAY;IACrF,MAAMJ,UAAU,GAAG,+CAA+C;IAClE,MAAMM,MAAM,GAAG,MAAM,IAAAC,6CAAmB,EAAC,SAAS,EAAEP,UAAU,EAAE,EAAE,CAAC;IACnE,MAAMQ,gBAAgB,GAAGxB,mBAAmB,CAACsB,MAAM,CAAC;IACpD,MAAMwB,oBAAoB,GAAG9C,mBAAmB,CAACgB,UAAU,CAAC;IAC5DU,MAAM,CAACF,gBAAgB,CAAC,CAACG,IAAI,CAACmB,oBAAoB,CAAC;EACrD,CAAC,CAAC;EAEF1B,EAAE,CAAC,qCAAqC,EAAE,YAAY;IACpD,MAAMJ,UAAU,GAAG,+CAA+C;IAClE,MAAMG,YAAY,GAAG,qDAAqD;IAC1E,MAAMG,MAAM,GAAG,MAAM,IAAAC,6CAAmB,EAAC,SAAS,EAAEP,UAAU,EAAE,CAC9D,IAAAa,+CAAqB,EAAC;MAAEC,SAAS,EAAE;IAAe,CAAC,CAAC,EACpD,IAAAC,kDAAwB,EAAC;MAAEC,YAAY,EAAE;IAAkB,CAAC,CAAC,CAC9D,CAAC;IACF,MAAMR,gBAAgB,GAAGxB,mBAAmB,CAACsB,MAAM,CAAC;IACpD,MAAMG,sBAAsB,GAAGzB,mBAAmB,CAACmB,YAAY,CAAC;IAChEO,MAAM,CAACF,gBAAgB,CAAC,CAACG,IAAI,CAACF,sBAAsB,CAAC;EACvD,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -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
|
class ArrayTypeTransformer {
|
|
24
23
|
predicate(node) {
|
|
25
24
|
return node.kind === _typescript().default.SyntaxKind.ArrayType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","ArrayTypeTransformer","predicate","node","kind","ts","SyntaxKind","ArrayType","getIdentifiers","transform","context","type","computeSchema","elementType","location","getLocation","TypeArraySchema","exports"],"sources":["array-type.ts"],"sourcesContent":["import ts, { ArrayTypeNode, Node } from 'typescript';\nimport { TypeArraySchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ArrayTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ArrayType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ArrayTypeNode, context: SchemaExtractorContext) {\n const type = await context.computeSchema(node.elementType);\n const location = context.getLocation(node);\n return new TypeArraySchema(location, type);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","obj","__esModule","default","ArrayTypeTransformer","predicate","node","kind","ts","SyntaxKind","ArrayType","getIdentifiers","transform","context","type","computeSchema","elementType","location","getLocation","TypeArraySchema","exports"],"sources":["array-type.ts"],"sourcesContent":["import ts, { ArrayTypeNode, Node } from 'typescript';\nimport { TypeArraySchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ArrayTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ArrayType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ArrayTypeNode, context: SchemaExtractorContext) {\n const type = await context.computeSchema(node.elementType);\n const location = context.getLocation(node);\n return new TypeArraySchema(location, 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;AAA8E,SAAAC,uBAAAG,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,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,IAAI,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACT,IAAI,CAACU,WAAW,CAAC;IAC1D,MAAMC,QAAQ,GAAGJ,OAAO,CAACK,WAAW,CAACZ,IAAI,CAAC;IAC1C,OAAO,KAAIa,oCAAe,EAACF,QAAQ,EAAEH,IAAI,CAAC;EAC5C;AACF;AAACM,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
|
});
|
|
@@ -34,6 +32,7 @@ function _identifier() {
|
|
|
34
32
|
};
|
|
35
33
|
return data;
|
|
36
34
|
}
|
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
36
|
/**
|
|
38
37
|
* for example:
|
|
39
38
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_parseTypeFromQuickInfo","_identifier","BindingElementTransformer","predicate","node","kind","ts","SyntaxKind","BindingElement","getIdentifiers","Identifier","name","getText","getSourceFile","fileName","transform","context","_info$body","info","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","doc","jsDocToDocSchema","VariableLikeSchema","getLocation","exports"],"sources":["binding-element.ts"],"sourcesContent":["import ts, { BindingElement, Node } from 'typescript';\nimport { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport { Identifier } from '../identifier';\n\n/**\n * for example:\n *\n * const objBindingElem = { elem1: 1, elem2: 2 };\n * const { elem1 } = objBindingElem;\n * export { elem1 };\n */\nexport class BindingElementTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.BindingElement;\n }\n\n async getIdentifiers(node: BindingElement) {\n return [new Identifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(node: BindingElement, context: SchemaExtractorContext) {\n const name = node.name.getText();\n const info = await context.getQuickInfo(node.name);\n const displaySig = info?.body?.displayString || '';\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(node, typeStr);\n const doc = await context.jsDocToDocSchema(node);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, false, doc);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_parseTypeFromQuickInfo","_identifier","obj","__esModule","default","BindingElementTransformer","predicate","node","kind","ts","SyntaxKind","BindingElement","getIdentifiers","Identifier","name","getText","getSourceFile","fileName","transform","context","_info$body","info","getQuickInfo","displaySig","body","displayString","typeStr","parseTypeFromQuickInfo","type","resolveType","doc","jsDocToDocSchema","VariableLikeSchema","getLocation","exports"],"sources":["binding-element.ts"],"sourcesContent":["import ts, { BindingElement, Node } from 'typescript';\nimport { VariableLikeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { parseTypeFromQuickInfo } from './utils/parse-type-from-quick-info';\nimport { Identifier } from '../identifier';\n\n/**\n * for example:\n *\n * const objBindingElem = { elem1: 1, elem2: 2 };\n * const { elem1 } = objBindingElem;\n * export { elem1 };\n */\nexport class BindingElementTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.BindingElement;\n }\n\n async getIdentifiers(node: BindingElement) {\n return [new Identifier(node.name.getText(), node.getSourceFile().fileName)];\n }\n\n async transform(node: BindingElement, context: SchemaExtractorContext) {\n const name = node.name.getText();\n const info = await context.getQuickInfo(node.name);\n const displaySig = info?.body?.displayString || '';\n const typeStr = parseTypeFromQuickInfo(info);\n const type = await context.resolveType(node, typeStr);\n const doc = await context.jsDocToDocSchema(node);\n return new VariableLikeSchema(context.getLocation(node), name, displaySig, type, false, 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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AC,gDAAsB,EAACN,IAAI,CAAC;IAC5C,MAAMO,IAAI,GAAG,MAAMT,OAAO,CAACU,WAAW,CAACtB,IAAI,EAAEmB,OAAO,CAAC;IACrD,MAAMI,GAAG,GAAG,MAAMX,OAAO,CAACY,gBAAgB,CAACxB,IAAI,CAAC;IAChD,OAAO,KAAIyB,uCAAkB,EAACb,OAAO,CAACc,WAAW,CAAC1B,IAAI,CAAC,EAAEO,IAAI,EAAES,UAAU,EAAEK,IAAI,EAAE,KAAK,EAAEE,GAAG,CAAC;EAC9F;AACF;AAACI,OAAA,CAAA7B,yBAAA,GAAAA,yBAAA"}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.array.flat-map.js");
|
|
5
|
-
require("core-js/modules/es.array.unscopables.flat-map.js");
|
|
6
|
-
require("core-js/modules/es.promise.js");
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
6
|
exports.ClassDeclarationTransformer = void 0;
|
|
11
|
-
function _defineProperty2() {
|
|
12
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
_defineProperty2 = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
7
|
function _pMapSeries() {
|
|
19
8
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
20
9
|
_pMapSeries = function () {
|
|
@@ -50,8 +39,12 @@ function _identifier() {
|
|
|
50
39
|
};
|
|
51
40
|
return data;
|
|
52
41
|
}
|
|
42
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
43
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
54
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (
|
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
45
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
46
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
47
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
55
48
|
class ClassDeclarationTransformer {
|
|
56
49
|
predicate(node) {
|
|
57
50
|
return node.kind === _typescript().default.SyntaxKind.ClassDeclaration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_lodash","_semanticsEntities","_typescript","_identifier","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","
|
|
1
|
+
{"version":3,"names":["_pMapSeries","data","_interopRequireDefault","require","_lodash","_semanticsEntities","_typescript","_identifier","obj","__esModule","default","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","ClassDeclarationTransformer","predicate","node","kind","ts","SyntaxKind","ClassDeclaration","getName","_node$name","name","getText","getIdentifiers","Identifier","getSourceFile","fileName","getExpressionWithTypeArgs","context","token","heritageClauses","pMapSeries","heritageClause","flatMap","h","types","map","type","expressionWithTypeArgs","typeArguments","expression","typeArgsNodes","t","computeSchema","location","getLocation","expressionNode","visitDefinition","UnresolvedSchema","ExpressionWithTypeArgumentsSchema","transform","_node$typeParameters","className","extendsExpressionsWithTypeArgs","ExtendsKeyword","implementsExpressionsWithTypeArgs","ImplementsKeyword","typeParameters","typeParam","signature","getQuickInfoDisplayString","members","member","_member$modifiers","isPrivate","modifiers","some","modifier","PrivateKeyword","doc","jsDocToDocSchema","Error","ClassSchema","compact","exports"],"sources":["class-declaration.ts"],"sourcesContent":["import pMapSeries from 'p-map-series';\nimport { compact } from 'lodash';\nimport {\n ClassSchema,\n UnresolvedSchema,\n ExpressionWithTypeArgumentsSchema,\n} from '@teambit/semantics.entities.semantic-schema';\nimport ts, { Node, ClassDeclaration } from 'typescript';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ClassDeclarationTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.ClassDeclaration;\n }\n\n // @todo: in case of `export default class` the class has no name.\n private getName(node: ClassDeclaration) {\n return node.name?.getText() || 'default';\n }\n\n async getIdentifiers(node: ClassDeclaration) {\n return [new Identifier(this.getName(node), node.getSourceFile().fileName)];\n }\n\n private async getExpressionWithTypeArgs(\n node: ClassDeclaration,\n context: SchemaExtractorContext,\n token: ts.SyntaxKind.ExtendsKeyword | ts.SyntaxKind.ImplementsKeyword\n ) {\n if (!node.heritageClauses) return [];\n\n return pMapSeries(\n node.heritageClauses\n .filter((heritageClause: ts.HeritageClause) => heritageClause.token === token)\n .flatMap((h: ts.HeritageClause) => {\n const { types } = h;\n const name = h.getText();\n return types.map((type) => ({ ...type, name }));\n }),\n async (expressionWithTypeArgs: ts.ExpressionWithTypeArguments & { name: string }) => {\n const { typeArguments, expression, name } = expressionWithTypeArgs;\n const typeArgsNodes = typeArguments ? await pMapSeries(typeArguments, (t) => context.computeSchema(t)) : [];\n const location = context.getLocation(expression);\n const expressionNode =\n (await context.visitDefinition(expression)) || new UnresolvedSchema(location, expression.getText());\n return new ExpressionWithTypeArgumentsSchema(typeArgsNodes, expressionNode, name, location);\n }\n );\n }\n\n async transform(node: ClassDeclaration, context: SchemaExtractorContext) {\n const className = this.getName(node);\n const extendsExpressionsWithTypeArgs = await this.getExpressionWithTypeArgs(\n node,\n context,\n ts.SyntaxKind.ExtendsKeyword\n );\n\n const implementsExpressionsWithTypeArgs = await this.getExpressionWithTypeArgs(\n node,\n context,\n ts.SyntaxKind.ImplementsKeyword\n );\n\n const typeParameters = node.typeParameters?.map((typeParam) => {\n return typeParam.name.getText();\n });\n const signature = node.name ? await context.getQuickInfoDisplayString(node.name) : undefined;\n const members = await pMapSeries(node.members, async (member) => {\n const isPrivate = member.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.PrivateKeyword);\n if (isPrivate) {\n return null;\n }\n return context.computeSchema(member);\n });\n const doc = await context.jsDocToDocSchema(node);\n\n if (!signature) {\n throw Error(`Missing signature for class ${className} declaration`);\n }\n\n return new ClassSchema(\n className,\n compact(members),\n context.getLocation(node),\n signature,\n doc,\n typeParameters,\n extendsExpressionsWithTypeArgs,\n implementsExpressionsWithTypeArgs\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MA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C+C,OAAO,EAAE,MAAOC,MAAM,IAAK;MAAA,IAAAC,iBAAA;MAC/D,MAAMC,SAAS,IAAAD,iBAAA,GAAGD,MAAM,CAACG,SAAS,cAAAF,iBAAA,uBAAhBA,iBAAA,CAAkBG,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACpD,IAAI,KAAKC,qBAAE,CAACC,UAAU,CAACmD,cAAc,CAAC;MACtG,IAAIJ,SAAS,EAAE;QACb,OAAO,IAAI;MACb;MACA,OAAOpC,OAAO,CAACe,aAAa,CAACmB,MAAM,CAAC;IACtC,CAAC,CAAC;IACF,MAAMO,GAAG,GAAG,MAAMzC,OAAO,CAAC0C,gBAAgB,CAACxD,IAAI,CAAC;IAEhD,IAAI,CAAC6C,SAAS,EAAE;MACd,MAAMY,KAAK,CAAE,+BAA8BnB,SAAU,cAAa,CAAC;IACrE;IAEA,OAAO,KAAIoB,gCAAW,EACpBpB,SAAS,EACT,IAAAqB,iBAAO,EAACZ,OAAO,CAAC,EAChBjC,OAAO,CAACiB,WAAW,CAAC/B,IAAI,CAAC,EACzB6C,SAAS,EACTU,GAAG,EACHZ,cAAc,EACdJ,8BAA8B,EAC9BE,iCACF,CAAC;EACH;AACF;AAACmB,OAAA,CAAA9D,2BAAA,GAAAA,2BAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","require","_semanticsEntities","ConditionalTypeTransformer","predicate","node","kind","SyntaxKind","ConditionalType","getIdentifiers","transform","context","checkType","computeSchema","extendsType","trueType","falseType","ConditionalTypeSchema","getLocation","exports"],"sources":["conditional-type.ts"],"sourcesContent":["import { Node, SyntaxKind, ConditionalTypeNode } from 'typescript';\nimport { ConditionalTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ConditionalTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ConditionalType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ConditionalTypeNode, context: SchemaExtractorContext) {\n const checkType = await context.computeSchema(node.checkType);\n const extendsType = await context.computeSchema(node.extendsType);\n const trueType = await context.computeSchema(node.trueType);\n const falseType = await context.computeSchema(node.falseType);\n return new ConditionalTypeSchema(context.getLocation(node), checkType, extendsType, trueType, falseType);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","require","_semanticsEntities","ConditionalTypeTransformer","predicate","node","kind","SyntaxKind","ConditionalType","getIdentifiers","transform","context","checkType","computeSchema","extendsType","trueType","falseType","ConditionalTypeSchema","getLocation","exports"],"sources":["conditional-type.ts"],"sourcesContent":["import { Node, SyntaxKind, ConditionalTypeNode } from 'typescript';\nimport { ConditionalTypeSchema } from '@teambit/semantics.entities.semantic-schema';\nimport { SchemaTransformer } from '../schema-transformer';\nimport { SchemaExtractorContext } from '../schema-extractor-context';\nimport { Identifier } from '../identifier';\n\nexport class ConditionalTypeTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === SyntaxKind.ConditionalType;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ConditionalTypeNode, context: SchemaExtractorContext) {\n const checkType = await context.computeSchema(node.checkType);\n const extendsType = await context.computeSchema(node.extendsType);\n const trueType = await context.computeSchema(node.trueType);\n const falseType = await context.computeSchema(node.falseType);\n return new ConditionalTypeSchema(context.getLocation(node), checkType, extendsType, trueType, falseType);\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,0BAA0B,CAA8B;EACnEC,SAASA,CAACC,IAAU,EAAE;IACpB,OAAOA,IAAI,CAACC,IAAI,KAAKC,wBAAU,CAACC,eAAe;EACjD;EAEA,MAAMC,cAAcA,CAAA,EAA0B;IAC5C,OAAO,EAAE;EACX;EAEA,MAAMC,SAASA,CAACL,IAAyB,EAAEM,OAA+B,EAAE;IAC1E,MAAMC,SAAS,GAAG,MAAMD,OAAO,CAACE,aAAa,CAACR,IAAI,CAACO,SAAS,CAAC;IAC7D,MAAME,WAAW,GAAG,MAAMH,OAAO,CAACE,aAAa,CAACR,IAAI,CAACS,WAAW,CAAC;IACjE,MAAMC,QAAQ,GAAG,MAAMJ,OAAO,CAACE,aAAa,CAACR,IAAI,CAACU,QAAQ,CAAC;IAC3D,MAAMC,SAAS,GAAG,MAAML,OAAO,CAACE,aAAa,CAACR,IAAI,CAACW,SAAS,CAAC;IAC7D,OAAO,KAAIC,0CAAqB,EAACN,OAAO,CAACO,WAAW,CAACb,IAAI,CAAC,EAAEO,SAAS,EAAEE,WAAW,EAAEC,QAAQ,EAAEC,SAAS,CAAC;EAC1G;AACF;AAACG,OAAA,CAAAhB,0BAAA,GAAAA,0BAAA"}
|
|
@@ -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 ConstructorTransformer {
|
|
31
30
|
predicate(node) {
|
|
32
31
|
return node.kind === _typescript().default.SyntaxKind.Constructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","ConstructorTransformer","predicate","node","kind","ts","SyntaxKind","Constructor","getIdentifiers","transform","context","_info$body","_node$modifiers","args","pMapSeries","parameters","param","computeSchema","info","getQuickInfo","displaySig","body","displayString","returns","ThisTypeSchema","getLocation","parent","modifiers","map","modifier","getText","doc","jsDocToDocSchema","ConstructorSchema","exports"],"sources":["constructor.ts"],"sourcesContent":["import ts, { Node, ConstructorDeclaration } from 'typescript';\nimport {\n ConstructorSchema,\n ParameterSchema,\n ThisTypeSchema,\n Modifier,\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 { Identifier } from '../identifier';\n\nexport class ConstructorTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.Constructor;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ConstructorDeclaration, context: SchemaExtractorContext) {\n const args = await pMapSeries(node.parameters, async (param) => context.computeSchema(param));\n const info = await context.getQuickInfo(node);\n const displaySig = info?.body?.displayString || '';\n\n const returns = new ThisTypeSchema(context.getLocation(node.parent));\n const modifiers = node.modifiers?.map((modifier) => modifier.getText()) || [];\n const doc = await context.jsDocToDocSchema(node);\n\n return new ConstructorSchema(\n context.getLocation(node),\n args as ParameterSchema[],\n returns,\n displaySig,\n modifiers as Modifier[],\n doc\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_typescript","data","_interopRequireDefault","require","_semanticsEntities","_pMapSeries","obj","__esModule","default","ConstructorTransformer","predicate","node","kind","ts","SyntaxKind","Constructor","getIdentifiers","transform","context","_info$body","_node$modifiers","args","pMapSeries","parameters","param","computeSchema","info","getQuickInfo","displaySig","body","displayString","returns","ThisTypeSchema","getLocation","parent","modifiers","map","modifier","getText","doc","jsDocToDocSchema","ConstructorSchema","exports"],"sources":["constructor.ts"],"sourcesContent":["import ts, { Node, ConstructorDeclaration } from 'typescript';\nimport {\n ConstructorSchema,\n ParameterSchema,\n ThisTypeSchema,\n Modifier,\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 { Identifier } from '../identifier';\n\nexport class ConstructorTransformer implements SchemaTransformer {\n predicate(node: Node) {\n return node.kind === ts.SyntaxKind.Constructor;\n }\n\n async getIdentifiers(): Promise<Identifier[]> {\n return [];\n }\n\n async transform(node: ConstructorDeclaration, context: SchemaExtractorContext) {\n const args = await pMapSeries(node.parameters, async (param) => context.computeSchema(param));\n const info = await context.getQuickInfo(node);\n const displaySig = info?.body?.displayString || '';\n\n const returns = new ThisTypeSchema(context.getLocation(node.parent));\n const modifiers = node.modifiers?.map((modifier) => modifier.getText()) || [];\n const doc = await context.jsDocToDocSchema(node);\n\n return new ConstructorSchema(\n context.getLocation(node),\n args as ParameterSchema[],\n returns,\n displaySig,\n modifiers as Modifier[],\n doc\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,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAMA,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,K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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
|
});
|
|
@@ -34,6 +32,7 @@ function _identifier() {
|
|
|
34
32
|
};
|
|
35
33
|
return data;
|
|
36
34
|
}
|
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
36
|
class EnumDeclarationTransformer {
|
|
38
37
|
predicate(node) {
|
|
39
38
|
return node.kind === _typescript().default.SyntaxKind.EnumDeclaration;
|