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

Function convertReExportAll

test/fixtures/snapshot/typescript.js:152338–152347  ·  view source on GitHub ↗
(reExported, checker)

Source from the content-addressed store, hash-verified

152336 }
152337 }
152338 function convertReExportAll(reExported, checker) {
152339 // `module.exports = require("x");` ==> `export * from "x"; export { default } from "x";`
152340 var moduleSpecifier = reExported.text;
152341 var moduleSymbol = checker.getSymbolAtLocation(reExported);
152342 var exports = moduleSymbol ? moduleSymbol.exports : ts.emptyMap;
152343 return exports.has("export=" /* InternalSymbolName.ExportEquals */) ? [[reExportDefault(moduleSpecifier)], true] :
152344 !exports.has("default" /* InternalSymbolName.Default */) ? [[reExportStar(moduleSpecifier)], false] :
152345 // If there's some non-default export, must include both `export *` and `export default`.
152346 exports.size > 1 ? [[reExportStar(moduleSpecifier), reExportDefault(moduleSpecifier)], true] : [[reExportDefault(moduleSpecifier)], true];
152347 }
152348 function reExportStar(moduleSpecifier) {
152349 return makeExportDeclaration(/*exportClause*/ undefined, moduleSpecifier);
152350 }

Callers 1

convertAssignmentFunction · 0.85

Calls 3

reExportDefaultFunction · 0.85
reExportStarFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected