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

Function convertNamedExport

test/fixtures/snapshot/typescript.js:152319–152337  ·  view source on GitHub ↗
(sourceFile, assignment, changes, exports)

Source from the content-addressed store, hash-verified

152317 return statements && [statements, false];
152318 }
152319 function convertNamedExport(sourceFile, assignment, changes, exports) {
152320 // If "originalKeywordKind" was set, this is e.g. `exports.
152321 var text = assignment.left.name.text;
152322 var rename = exports.get(text);
152323 if (rename !== undefined) {
152324 /*
152325 const _class = 0;
152326 export { _class as class };
152327 */
152328 var newNodes = [
152329 makeConst(/*modifiers*/ undefined, rename, assignment.right),
152330 makeExportDeclaration([ts.factory.createExportSpecifier(/*isTypeOnly*/ false, rename, text)]),
152331 ];
152332 changes.replaceNodeWithNodes(sourceFile, assignment.parent, newNodes);
152333 }
152334 else {
152335 convertExportsPropertyAssignment(assignment, sourceFile, changes);
152336 }
152337 }
152338 function convertReExportAll(reExported, checker) {
152339 // `module.exports = require("x");` ==> `export * from "x"; export { default } from "x";`
152340 var moduleSpecifier = reExported.text;

Callers 1

convertAssignmentFunction · 0.85

Calls 4

makeConstFunction · 0.85
makeExportDeclarationFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected