[Extensions] Add support for requiring JS modules

See commit messages. The same way we expose C++ modules, we can also expose JS modules. This is to be used by the internal extension helpers and future helpers we may decide to add.