The current implementation is hardcoded to inject itself when it finds a "source-layer" with ID "road". Probably works for most of Mapbox' styles but I've had style formats that didn't use that naming convention. I suggest exposing the source-layer ID (or maybe more than one?) as an option for better configurability.
(related, if it doesn't find a source-layer an empty array check could be done and maybe log for more graceful error exit)
The current implementation is hardcoded to inject itself when it finds a "source-layer" with ID "road". Probably works for most of Mapbox' styles but I've had style formats that didn't use that naming convention. I suggest exposing the source-layer ID (or maybe more than one?) as an option for better configurability.
(related, if it doesn't find a source-layer an empty array check could be done and maybe log for more graceful error exit)