Port of src/printer/lib/codec.ts (vlq, from https://github.com/Rich-Harris/vlq, credit: Rich Harris).
src/printer/lib/codec.ts