Repository navigation
A full rewrite as a small, pure ESM package with a standalone WebAssembly module. It's designed to be bundled directly into Mapbox GL JS, which will load it on demand instead of through setRTLTextPlugin.
Highlights
- Much smaller. The wasm is now 42 KB (15 KB gzipped), down from 98 KB, and the JS glue is about 0.7 KB gzipped.
- Pure ESM, no build step. There's no bundled UMD and no Rollup. The package is plain ES modules plus one
.wasmfile, with no runtime dependencies. - Two ways to load it:
import {applyArabicShaping, processBidirectionalText} from '@mapbox/mapbox-gl-rtl-text'loads the wasm automatically with top-level await.createRTL(fetch(url))from@mapbox/mapbox-gl-rtl-text/rtl.jslets you choose where and when the wasm loads.
- TypeScript types are included for both entry points.
- Reproducible builds. The same sources and Emscripten version produce a byte-identical wasm.
Breaking changes
- The package is ESM-only. The
mainUMD build (dist/mapbox-gl-rtl-text.js) is gone. - It no longer works as a
setRTLTextPluginplugin. Mapbox GL JS v3 should keep using the v0.4.0 build.