You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
897 B
31 lines
897 B
2 years ago
|
/**
|
||
|
* Gets the socket integration to use for Webpack messages.
|
||
|
* @param {'wds' | 'whm' | 'wps' | string} integrationType A valid socket integration type or a path to a module.
|
||
|
* @returns {string} Path to the resolved socket integration module.
|
||
|
*/
|
||
|
function getSocketIntegration(integrationType) {
|
||
|
let resolvedSocketIntegration;
|
||
|
switch (integrationType) {
|
||
|
case 'wds': {
|
||
|
resolvedSocketIntegration = require.resolve('../../sockets/WDSSocket');
|
||
|
break;
|
||
|
}
|
||
|
case 'whm': {
|
||
|
resolvedSocketIntegration = require.resolve('../../sockets/WHMEventSource');
|
||
|
break;
|
||
|
}
|
||
|
case 'wps': {
|
||
|
resolvedSocketIntegration = require.resolve('../../sockets/WPSSocket');
|
||
|
break;
|
||
|
}
|
||
|
default: {
|
||
|
resolvedSocketIntegration = require.resolve(integrationType);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return resolvedSocketIntegration;
|
||
|
}
|
||
|
|
||
|
module.exports = getSocketIntegration;
|