osm2geojson-ultra is faster & more complete convertor for OSM data in XML or JSON formats to GeoJSON - much faster (the more complex the data source is, the more performance advantages it posesses) than osmtogeojson in most situations - implemented in TypeScript with txml, please find more details from its github repo
Usage:<script type="module">
import osm2geojson from 'https://cdn.skypack.dev/osm2geojson-ultra';
osm2geojson(osm, opts);
</script>
$ npm install osm2geojson-ultra
import osm2geojson from 'osm2geojson-ultra';
osm2geojson(osm, opts);