Since 7.2.5 the "main" property in the "package.json" of WebRTC adapter
points to an ES6 file which does not provide "module.exports" but
"exports.default". Due to this uses of "var adapter =
require('webrtc-adapter');" now fail, as the properties of the module
are loaded in "adapter.default" instead of in "adapter". To restore the
previous and expected behaviour a Babel plugin is now used to also add
"module.exports" if "exports.default" exists.
As WebRTC adapter still provides an ES5 file an alternative solution
would have been to alias "webrtc-adapter" to that file with
'--transform [ aliasify --global --aliases [ --webrtc-adapter
"webrtc-adapter/dist/adapter_core5.js" ] ]'.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Browserslist is used by Babel, which in turn is used in Talk to bundle
the SimpleWebRTC code with its dependencies (like WebRTC adapter). Until
recently, in the server its configuration was got from the Babel config,
but now it is stated in the "package.json" file. However, it is not
hardcoded, but provided through a new NPM module,
"browserslist-config-nextcloud". Browserslist gets its configuration
from the "package.json" in current or parent directories, so if
SimpleWebRTC was bundled and the "spreed" directory was a subdirectory
of the "server" directory of Nextcloud Browserslists got its
configuration from the "package.json" file in the server. In that case
the bundle failed because "browserslist-config-nextcloud" was not part
of the modules installed for Talk development.
To prevent that, now "browserslist-config-nextcloud" is a development
dependency of Talk. Also, for consistency,
"browserslist-config-nextcloud" is now always used when bundling
SimpleWebRTC, so the result is the same whether the Talk directory is a
subdirectory of the server or not when performing the bundle.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Currently there are no JavaScript unit tests, so the related stuff can
be removed and added later if/when needed.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
As stated in NPM documentation, the file is intended to be committed
into source repositories; this ensures that everyone is using the same
dependencies (as the semantic versioning of dependencies in
"package.json" does not).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>