MCPcopy Index your code
hub / github.com/nodejs/node / visitExportDeclaration

Function visitExportDeclaration

test/fixtures/snapshot/typescript.js:93884–93903  ·  view source on GitHub ↗

* Visits an export declaration, eliding it if it does not contain a clause that resolves to a value. * * @param node The export declaration node.

(node)

Source from the content-addressed store, hash-verified

93882 * @param node The export declaration node.
93883 */
93884 function visitExportDeclaration(node) {
93885 if (node.isTypeOnly) {
93886 return undefined;
93887 }
93888 if (!node.exportClause || ts.isNamespaceExport(node.exportClause)) {
93889 // never elide `export <whatever> from <whereever>` declarations -
93890 // they should be kept for sideffects/untyped exports, even when the
93891 // type checker doesn't know about any exports
93892 return node;
93893 }
93894 // Elide the export declaration if all of its named exports are elided.
93895 var allowEmpty = !!node.moduleSpecifier && (compilerOptions.importsNotUsedAsValues === 1 /* ImportsNotUsedAsValues.Preserve */ ||
93896 compilerOptions.importsNotUsedAsValues === 2 /* ImportsNotUsedAsValues.Error */);
93897 var exportClause = ts.visitNode(node.exportClause, function (bindings) { return visitNamedExportBindings(bindings, allowEmpty); }, ts.isNamedExportBindings);
93898 return exportClause
93899 ? factory.updateExportDeclaration(node,
93900 /*decorators*/ undefined,
93901 /*modifiers*/ undefined, node.isTypeOnly, exportClause, node.moduleSpecifier, node.assertClause)
93902 : undefined;
93903 }
93904 /**
93905 * Visits named exports, eliding it if it does not contain an export specifier that
93906 * resolves to a value.

Callers 3

visitElidableStatementFunction · 0.85
topLevelVisitorFunction · 0.85
visitorFunction · 0.85

Calls 6

visitNamedExportBindingsFunction · 0.85
createRequireCallFunction · 0.85
emitHelpersFunction · 0.85
createExportExpressionFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected