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

Function isNodeImport

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

Source from the content-addressed store, hash-verified

136735 }
136736 }
136737 function isNodeImport(node) {
136738 var parent = node.parent;
136739 switch (parent.kind) {
136740 case 265 /* SyntaxKind.ImportEqualsDeclaration */:
136741 return parent.name === node && isExternalModuleImportEquals(parent);
136742 case 270 /* SyntaxKind.ImportSpecifier */:
136743 // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`.
136744 return !parent.propertyName;
136745 case 267 /* SyntaxKind.ImportClause */:
136746 case 268 /* SyntaxKind.NamespaceImport */:
136747 ts.Debug.assert(parent.name === node);
136748 return true;
136749 case 203 /* SyntaxKind.BindingElement */:
136750 return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent);
136751 default:
136752 return false;
136753 }
136754 }
136755 function getExportInfo(exportSymbol, exportKind, checker) {
136756 var moduleSymbol = exportSymbol.parent;
136757 if (!moduleSymbol)

Callers 1

getImportFunction · 0.85

Calls 2

assertMethod · 0.80

Tested by

no test coverage detected