build: add support for an optional "opts" object