rewriteExportNames =
	({ ast, moduleGraph, module, externalExports, runtime }) =>
	bin =>
		editWithAST(ast, bin, {
			/**
			 * @param {NodePath<ModuleExport>} path path
			 */
			ModuleExport(path) {
				const isExternal = externalExports.has(path.node.name);
				if (isExternal) {
					path.remove();
					return;
				}
				const usedName = moduleGraph
					.getExportsInfo(module)
					.getUsedName(path.node.name, runtime);
				if (!usedName) {
					path.remove();
					return;
				}
				path.node.name = /** @type {string} */ (usedName);
			}
		})
Rewrite the export names
@param {object} state state
@param {AST} state.ast Module's ast
@param {Module} state.module Module
@param {ModuleGraph} state.moduleGraph module graph
@param {Set<string>} state.externalExports Module
@param {RuntimeSpec} state.runtime runtime
@returns {ArrayBufferTransform} transform