MCPcopy Create free account
hub / github.com/nodejs/node / getExternalModuleName

Function getExternalModuleName

test/fixtures/snapshot/typescript.js:16777–16793  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

16775 }
16776 ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
16777 function getExternalModuleName(node) {
16778 switch (node.kind) {
16779 case 266 /* SyntaxKind.ImportDeclaration */:
16780 case 272 /* SyntaxKind.ExportDeclaration */:
16781 return node.moduleSpecifier;
16782 case 265 /* SyntaxKind.ImportEqualsDeclaration */:
16783 return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined;
16784 case 200 /* SyntaxKind.ImportType */:
16785 return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
16786 case 208 /* SyntaxKind.CallExpression */:
16787 return node.arguments[0];
16788 case 261 /* SyntaxKind.ModuleDeclaration */:
16789 return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined;
16790 default:
16791 return ts.Debug.assertNever(node);
16792 }
16793 }
16794 ts.getExternalModuleName = getExternalModuleName;
16795 function getNamespaceDeclarationNode(node) {
16796 switch (node.kind) {

Callers 3

organizeImportsWorkerFunction · 0.85
compareModuleSpecifiersFunction · 0.85

Calls 1

isLiteralImportTypeNodeFunction · 0.85

Tested by

no test coverage detected