Skip to content

Commit

Permalink
[FIX] cleanup package.json
Browse files Browse the repository at this point in the history
* Remove the "sideEffects" property from the package.json as
this property was for WebPack* and we are now using Rollup.

dev dependencies changes:

* Limit version tolerance of some linting dependencies to prevent
linting inconsistencies.

* Add missing rollup dependencies.

* Lint JS files back to es5 trailing comma as it is the default of
prettier <3.0, which is the version used in the rest of the odoo
codebase.
  • Loading branch information
ThanhDodeurOdoo authored and seb-odoo committed Dec 8, 2023
1 parent 53120d2 commit 81ee431
Showing 7 changed files with 672 additions and 403 deletions.
1,035 changes: 652 additions & 383 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
"author": "Odoo",
"license": "LGPL-3.0",
"type": "module",
"sideEffects": false,
"scripts": {
"build": "rollup -c",
"start": "node ./src/server.js",
@@ -30,18 +29,19 @@
},
"devDependencies": {
"@jest/globals": "^29.6.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^13.0.4",
"@types/node": "^20.5.0",
"eslint": "^8.46.0",
"eslint": "~8.46.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-prettier": "~4.2.0",
"fake-mediastreamtrack": "^1.2.0",
"git-rev-sync": "^3.0.2",
"jest": "^29.6.2",
"mediasoup-client": "^3.6.101",
"prettier": "^2.8.8",
"prettier": "~2.8.8",
"rollup": "^2.79.1",
"rollup-plugin-license": "3.2.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-commonjs": "^25.0.7"
"rollup-plugin-license": "3.2.0"
}
}
12 changes: 6 additions & 6 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -187,7 +187,7 @@ export class SfuClient extends EventTarget {
proms.push(
(async () => {
stats[type] = await producer.getStats();
})(),
})()
);
}
}
@@ -210,7 +210,7 @@ export class SfuClient extends EventTarget {
name: CLIENT_MESSAGE.INFO_CHANGE,
payload: { info, needRefresh },
},
{ batch: true },
{ batch: true }
);
}

@@ -251,7 +251,7 @@ export class SfuClient extends EventTarget {
name: CLIENT_MESSAGE.CONSUMPTION_CHANGE,
payload: { sessionId, states },
},
{ batch: true },
{ batch: true }
);
}

@@ -275,7 +275,7 @@ export class SfuClient extends EventTarget {
name: CLIENT_MESSAGE.PRODUCTION_CHANGE,
payload: { type, active: Boolean(track) },
},
{ batch: true },
{ batch: true }
);
return;
}
@@ -390,7 +390,7 @@ export class SfuClient extends EventTarget {
() => {
webSocket.send(JSON.stringify(this._jsonWebToken));
},
{ once: true },
{ once: true }
);
/**
* Receiving a message means that the server has authenticated the client and is ready to receive messages.
@@ -400,7 +400,7 @@ export class SfuClient extends EventTarget {
() => {
resolve(new Bus(webSocket));
},
{ once: true },
{ once: true }
);
});
}
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ const processHandlers = {
logger.info(`-- camera: ${camera} bps`);
logger.info(`-- screen: ${screen} bps`);
logger.info(`-- total: ${total} bps`);
})(),
})()
);
}
await Promise.all(proms);
8 changes: 4 additions & 4 deletions src/services/http.js
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ export async function start({ httpInterface = config.HTTP_INTERFACE, port = conf
JSON.stringify({
uuid: channel.uuid,
url: `${protocol}://${host}`,
}),
})
);
} catch (error) {
logger.warn(`[${remoteAddress}] failed to create channel: ${error.message}`);
@@ -83,15 +83,15 @@ export async function start({ httpInterface = config.HTTP_INTERFACE, port = conf
/** @type {{ sessionIdsByChannel: Object<string, number[]> }} */
const claims = await auth.verify(jsonWebToken);
for (const [channelUuid, sessionIds] of Object.entries(
claims.sessionIdsByChannel,
claims.sessionIdsByChannel
)) {
const channel = Channel.records.get(channelUuid);
if (!channel) {
return res.end();
}
if (!channel.remoteAddress === remoteAddress) {
logger.warn(
`[${remoteAddress}] tried to disconnect sessions from channel ${channelUuid} but is not the owner`,
`[${remoteAddress}] tried to disconnect sessions from channel ${channelUuid} but is not the owner`
);
return res.end();
}
@@ -198,7 +198,7 @@ class RouteListener {
});
} catch (error) {
logger.error(
`[${remoteAddress}] ${error.message} when calling ${req.url}: ${error.message}`,
`[${remoteAddress}] ${error.message} when calling ${req.url}: ${error.message}`
);
res.statusCode = 500; // Internal server error
return res.end();
4 changes: 2 additions & 2 deletions src/services/rtc.js
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export async function start() {
}
logger.info(`initialized ${workers.size} mediasoup workers`);
logger.info(
`transport(RTC) layer at ${config.PUBLIC_IP}:${config.RTC_MIN_PORT}-${config.RTC_MAX_PORT}`,
`transport(RTC) layer at ${config.PUBLIC_IP}:${config.RTC_MIN_PORT}-${config.RTC_MAX_PORT}`
);
}

@@ -57,7 +57,7 @@ export async function getWorker() {
leastUsedWorker = worker;
lowestUsage = ru_maxrss;
}
})(),
})()
);
}
await Promise.all(proms);
2 changes: 1 addition & 1 deletion src/services/ws.js
Original file line number Diff line number Diff line change
@@ -130,7 +130,7 @@ async function connect(webSocket, jsonWebToken) {
});
});
webSocket.on("error", (error) =>
session.close({ code: SESSION_CLOSE_CODE.WS_ERROR, cause: error.message }),
session.close({ code: SESSION_CLOSE_CODE.WS_ERROR, cause: error.message })
);
// Not awaiting connect
session.connect(bus, ice_servers);

0 comments on commit 81ee431

Please sign in to comment.