mediasoup-client 3.6.84 → 3.6.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Device.d.ts.map +1 -1
- package/lib/Device.js +32 -24
- package/lib/handlers/sdp/MediaSection.d.ts.map +1 -1
- package/lib/handlers/sdp/MediaSection.js +0 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/npm-scripts.mjs +248 -0
- package/package.json +22 -21
- package/lib/handlers/sdp/types.d.ts +0 -6
- package/lib/handlers/sdp/types.d.ts.map +0 -1
- package/lib/handlers/sdp/types.js +0 -2
- package/npm-scripts.js +0 -221
package/lib/Device.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../src/Device.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAoB,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAoB,MAAM,6BAA6B,CAAC;AAY/E,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,MAAM,MAAM,kBAAkB,GAC3B,WAAW,GACX,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,UAAU,GACV,UAAU,GACV,QAAQ,GACR,wBAAwB,GACxB,aAAa,CAAC;AAEjB,MAAM,MAAM,aAAa,GACzB;IACC;;OAEG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAA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22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.Device = exports.detectDevice = void 0;
|
|
30
|
-
const
|
|
27
|
+
const ua_parser_js_1 = require("ua-parser-js");
|
|
31
28
|
const Logger_1 = require("./Logger");
|
|
32
29
|
const EnhancedEventEmitter_1 = require("./EnhancedEventEmitter");
|
|
33
30
|
const errors_1 = require("./errors");
|
|
@@ -47,69 +44,80 @@ const ReactNativeUnifiedPlan_1 = require("./handlers/ReactNativeUnifiedPlan");
|
|
|
47
44
|
const ReactNative_1 = require("./handlers/ReactNative");
|
|
48
45
|
const logger = new Logger_1.Logger('Device');
|
|
49
46
|
function detectDevice() {
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
50
48
|
// React-Native.
|
|
51
49
|
// NOTE: react-native-webrtc >= 1.75.0 is required.
|
|
52
50
|
// NOTE: react-native-webrtc with Unified Plan requires version >= 106.0.0.
|
|
53
51
|
if (typeof navigator === 'object' && navigator.product === 'ReactNative') {
|
|
52
|
+
logger.debug('detectDevice() | React-Native detected');
|
|
54
53
|
if (typeof RTCPeerConnection === 'undefined') {
|
|
55
|
-
logger.warn('
|
|
54
|
+
logger.warn('detectDevice() | unsupported react-native-webrtc without RTCPeerConnection, forgot to call registerGlobals()?');
|
|
56
55
|
return undefined;
|
|
57
56
|
}
|
|
58
57
|
if (typeof RTCRtpTransceiver !== 'undefined') {
|
|
59
|
-
logger.debug('
|
|
58
|
+
logger.debug('detectDevice() | ReactNative UnifiedPlan handler chosen');
|
|
60
59
|
return 'ReactNativeUnifiedPlan';
|
|
61
60
|
}
|
|
62
61
|
else {
|
|
63
|
-
logger.debug('
|
|
62
|
+
logger.debug('detectDevice() | ReactNative PlanB handler chosen');
|
|
64
63
|
return 'ReactNative';
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
// Browser.
|
|
68
67
|
else if (typeof navigator === 'object' && typeof navigator.userAgent === 'string') {
|
|
69
68
|
const ua = navigator.userAgent;
|
|
70
|
-
const
|
|
71
|
-
|
|
69
|
+
const uaParser = new ua_parser_js_1.UAParser(ua);
|
|
70
|
+
logger.debug('detectDevice() | browser detected [ua:%s, parsed:%o]', ua, uaParser.getResult());
|
|
71
|
+
const browser = uaParser.getBrowser();
|
|
72
|
+
const browserName = (_b = (_a = browser.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
|
|
73
|
+
const browserVersion = parseInt((_c = browser.major) !== null && _c !== void 0 ? _c : '0');
|
|
74
|
+
const engine = uaParser.getEngine();
|
|
75
|
+
const engineName = (_e = (_d = engine.name) === null || _d === void 0 ? void 0 : _d.toLowerCase()) !== null && _e !== void 0 ? _e : '';
|
|
76
|
+
const os = uaParser.getOS();
|
|
77
|
+
const osName = (_g = (_f = os.name) === null || _f === void 0 ? void 0 : _f.toLowerCase()) !== null && _g !== void 0 ? _g : '';
|
|
78
|
+
const osVersion = parseFloat((_h = os.version) !== null && _h !== void 0 ? _h : '0');
|
|
72
79
|
// Chrome, Chromium, and Edge.
|
|
73
|
-
if (
|
|
80
|
+
if (['chrome', 'chromium', 'edge'].includes(browserName) && browserVersion >= 111) {
|
|
74
81
|
return 'Chrome111';
|
|
75
82
|
}
|
|
76
|
-
else if (
|
|
83
|
+
else if ((['chrome', 'chromium'].includes(browserName) && browserVersion >= 74) ||
|
|
84
|
+
(browserName === 'edge' && browserVersion >= 88)) {
|
|
77
85
|
return 'Chrome74';
|
|
78
86
|
}
|
|
79
|
-
else if (
|
|
87
|
+
else if (['chrome', 'chromium'].includes(browserName) && browserVersion >= 70) {
|
|
80
88
|
return 'Chrome70';
|
|
81
89
|
}
|
|
82
|
-
else if (
|
|
90
|
+
else if (['chrome', 'chromium'].includes(browserName) && browserVersion >= 67) {
|
|
83
91
|
return 'Chrome67';
|
|
84
92
|
}
|
|
85
|
-
else if (
|
|
93
|
+
else if (['chrome', 'chromium'].includes(browserName) && browserVersion >= 55) {
|
|
86
94
|
return 'Chrome55';
|
|
87
95
|
}
|
|
88
96
|
// Firefox.
|
|
89
|
-
else if (
|
|
97
|
+
else if (browserName === 'firefox' && osName !== 'ios' && browserVersion >= 60) {
|
|
90
98
|
return 'Firefox60';
|
|
91
99
|
}
|
|
92
|
-
// Firefox on iOS.
|
|
93
|
-
else if (
|
|
100
|
+
// Firefox on iOS (so Safari).
|
|
101
|
+
else if (browserName === 'firefox' && osName === 'ios' && osVersion >= 14.3) {
|
|
94
102
|
return 'Safari12';
|
|
95
103
|
}
|
|
96
104
|
// Safari with Unified-Plan support enabled.
|
|
97
|
-
else if (
|
|
105
|
+
else if (browserName === 'safari' &&
|
|
106
|
+
browserVersion >= 12 &&
|
|
98
107
|
typeof RTCRtpTransceiver !== 'undefined' &&
|
|
99
108
|
RTCRtpTransceiver.prototype.hasOwnProperty('currentDirection')) {
|
|
100
109
|
return 'Safari12';
|
|
101
110
|
}
|
|
102
111
|
// Safari with Plab-B support.
|
|
103
|
-
else if (
|
|
112
|
+
else if (browserName === 'safari' && browserVersion >= 11) {
|
|
104
113
|
return 'Safari11';
|
|
105
114
|
}
|
|
106
115
|
// Old Edge with ORTC support.
|
|
107
|
-
else if (
|
|
108
|
-
browser.satisfies({ 'microsoft edge': '<=18' })) {
|
|
116
|
+
else if (browserName === 'edge' && browserVersion >= 11 && browserVersion <= 18) {
|
|
109
117
|
return 'Edge11';
|
|
110
118
|
}
|
|
111
119
|
// Best effort for Chromium based browsers.
|
|
112
|
-
else if (
|
|
120
|
+
else if (engineName === 'blink') {
|
|
113
121
|
const match = ua.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);
|
|
114
122
|
if (match) {
|
|
115
123
|
const version = Number(match[1]);
|
|
@@ -135,13 +143,13 @@ function detectDevice() {
|
|
|
135
143
|
}
|
|
136
144
|
// Unsupported browser.
|
|
137
145
|
else {
|
|
138
|
-
logger.warn('
|
|
146
|
+
logger.warn('detectDevice() | browser not supported [name:%s, version:%s]', browserName, browserVersion);
|
|
139
147
|
return undefined;
|
|
140
148
|
}
|
|
141
149
|
}
|
|
142
150
|
// Unknown device.
|
|
143
151
|
else {
|
|
144
|
-
logger.warn('
|
|
152
|
+
logger.warn('detectDevice() | unknown device');
|
|
145
153
|
return undefined;
|
|
146
154
|
}
|
|
147
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaSection.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/MediaSection.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,aAAa,EACb,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACN,SAAS,EACT,aAAa,EAIb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"MediaSection.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/MediaSection.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,aAAa,EACb,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACN,SAAS,EACT,aAAa,EAIb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,8BAAsB,YAAY;IAGjC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC;IAErC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGlC,EACC,aAAa,EACb,aAAa,EACb,cAAc,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EAAE,GAAG,IAAI;CAoChE;AAED,qBAAa,iBAAkB,SAAQ,YAAY;gBAGjD,EACC,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,KAAa,EACb,GAAG,EACH,IAAI,EACJ,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,kBAA0B,EAC1B,EACD;QACC,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;QAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;QACxC,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;QAChC,kBAAkB,CAAC,EAAE,aAAa,CAAC;QACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC7B;IA4MF,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAMjC,MAAM,IAAI,IAAI;IAKd,YAAY,CACX,EACC,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,EACD;QACC,kBAAkB,EAAE,aAAa,CAAC;QAClC,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KAChB,GACC,IAAI;IAoHP,kBAAkB,CACjB,EAAE,kBAAkB,EAAE,EAAE;QAAE,kBAAkB,EAAE,aAAa,CAAA;KAAE,GAC3D,IAAI;CAiBP"}
|
|
@@ -323,9 +323,6 @@ class AnswerMediaSection extends MediaSection {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
const raw = this._mediaObject.simulcast.list1;
|
|
326
|
-
// NOTE: Ignore bug in @types/sdp-transform.
|
|
327
|
-
// Ongoing PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64119
|
|
328
|
-
// @ts-ignore
|
|
329
326
|
const simulcastStreams = sdpTransform.parseSimulcastStreamList(raw);
|
|
330
327
|
for (const simulcastStream of simulcastStreams) {
|
|
331
328
|
for (const simulcastFormat of simulcastStream) {
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/npm-scripts.mjs
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import process from 'process';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
|
|
6
|
+
const PKG = JSON.parse(fs.readFileSync('./package.json').toString());
|
|
7
|
+
const IS_WINDOWS = os.platform() === 'win32';
|
|
8
|
+
const MAYOR_VERSION = PKG.version.split('.')[0];
|
|
9
|
+
|
|
10
|
+
const task = process.argv.slice(2).join(' ');
|
|
11
|
+
|
|
12
|
+
run();
|
|
13
|
+
|
|
14
|
+
async function run()
|
|
15
|
+
{
|
|
16
|
+
switch (task)
|
|
17
|
+
{
|
|
18
|
+
// As per NPM documentation (https://docs.npmjs.com/cli/v9/using-npm/scripts)
|
|
19
|
+
// `prepare` script:
|
|
20
|
+
//
|
|
21
|
+
// - Runs BEFORE the package is packed, i.e. during `npm publish` and `npm pack`.
|
|
22
|
+
// - Runs on local `npm install` without any arguments.
|
|
23
|
+
// - NOTE: If a package being installed through git contains a `prepare` script,
|
|
24
|
+
// its dependencies and devDependencies will be installed, and the `prepare`
|
|
25
|
+
// script will be run, before the package is packaged and installed.
|
|
26
|
+
//
|
|
27
|
+
// So here we compile TypeScript to JavaScript.
|
|
28
|
+
case 'prepare':
|
|
29
|
+
{
|
|
30
|
+
buildTypescript(/* force */ false);
|
|
31
|
+
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
case 'typescript:build':
|
|
36
|
+
{
|
|
37
|
+
installDeps();
|
|
38
|
+
buildTypescript(/* force */ true);
|
|
39
|
+
replaceVersion();
|
|
40
|
+
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
case 'typescript:watch':
|
|
45
|
+
{
|
|
46
|
+
// NOTE: Load dep on demand since it's a devDependency.
|
|
47
|
+
const { TscWatchClient } = await import('tsc-watch/client.js');
|
|
48
|
+
|
|
49
|
+
const watch = new TscWatchClient();
|
|
50
|
+
|
|
51
|
+
deleteLib();
|
|
52
|
+
|
|
53
|
+
watch.on('success', replaceVersion);
|
|
54
|
+
watch.start('--pretty');
|
|
55
|
+
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
case 'lint':
|
|
60
|
+
{
|
|
61
|
+
lint();
|
|
62
|
+
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
case 'test':
|
|
67
|
+
{
|
|
68
|
+
buildTypescript(/* force */ false);
|
|
69
|
+
replaceVersion();
|
|
70
|
+
test();
|
|
71
|
+
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
case 'coverage':
|
|
76
|
+
{
|
|
77
|
+
buildTypescript(/* force */ false);
|
|
78
|
+
replaceVersion();
|
|
79
|
+
executeCmd('jest --coverage');
|
|
80
|
+
executeCmd('open-cli coverage/lcov-report/index.html');
|
|
81
|
+
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case 'install-deps':
|
|
86
|
+
{
|
|
87
|
+
installDeps();
|
|
88
|
+
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
case 'release:check':
|
|
93
|
+
{
|
|
94
|
+
checkRelease();
|
|
95
|
+
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
case 'release':
|
|
100
|
+
{
|
|
101
|
+
checkRelease();
|
|
102
|
+
|
|
103
|
+
executeCmd(`git commit -am '${PKG.version}'`);
|
|
104
|
+
executeCmd(`git tag -a ${PKG.version} -m '${PKG.version}'`);
|
|
105
|
+
executeCmd(`git push origin v${MAYOR_VERSION}`);
|
|
106
|
+
executeCmd(`git push origin '${PKG.version}'`);
|
|
107
|
+
executeCmd('npm publish');
|
|
108
|
+
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
default:
|
|
113
|
+
{
|
|
114
|
+
logError('unknown task');
|
|
115
|
+
|
|
116
|
+
exitWithError();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function replaceVersion()
|
|
122
|
+
{
|
|
123
|
+
logInfo('replaceVersion()');
|
|
124
|
+
|
|
125
|
+
const files = [ 'lib/index.js', 'lib/index.d.ts' ];
|
|
126
|
+
|
|
127
|
+
for (const file of files)
|
|
128
|
+
{
|
|
129
|
+
const text = fs.readFileSync(file, { encoding: 'utf8' });
|
|
130
|
+
const result = text.replace(/__MEDIASOUP_CLIENT_VERSION__/g, PKG.version);
|
|
131
|
+
|
|
132
|
+
fs.writeFileSync(file, result, { encoding: 'utf8' });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function deleteLib()
|
|
137
|
+
{
|
|
138
|
+
if (!fs.existsSync('lib'))
|
|
139
|
+
{
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
logInfo('deleteLib()');
|
|
144
|
+
|
|
145
|
+
if (!IS_WINDOWS)
|
|
146
|
+
{
|
|
147
|
+
executeCmd('rm -rf lib');
|
|
148
|
+
}
|
|
149
|
+
else
|
|
150
|
+
{
|
|
151
|
+
// NOTE: This command fails in Windows if the dir doesn't exist.
|
|
152
|
+
executeCmd('rmdir /s /q "lib"', /* exitOnError */ false);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function buildTypescript(force = false)
|
|
157
|
+
{
|
|
158
|
+
if (!force && fs.existsSync('lib'))
|
|
159
|
+
{
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
logInfo('buildTypescript()');
|
|
164
|
+
|
|
165
|
+
deleteLib();
|
|
166
|
+
executeCmd('tsc');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function lint()
|
|
170
|
+
{
|
|
171
|
+
logInfo('lint()');
|
|
172
|
+
|
|
173
|
+
executeCmd('eslint -c .eslintrc.js --max-warnings 0 src .eslintrc.js npm-scripts.mjs');
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function test()
|
|
177
|
+
{
|
|
178
|
+
logInfo('test()');
|
|
179
|
+
|
|
180
|
+
executeCmd('jest');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function installDeps()
|
|
184
|
+
{
|
|
185
|
+
logInfo('installDeps()');
|
|
186
|
+
|
|
187
|
+
// Install/update deps.
|
|
188
|
+
executeCmd('npm ci --ignore-scripts');
|
|
189
|
+
// Update package-lock.json.
|
|
190
|
+
executeCmd('npm install --package-lock-only --ignore-scripts');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function checkRelease()
|
|
194
|
+
{
|
|
195
|
+
logInfo('checkRelease()');
|
|
196
|
+
|
|
197
|
+
installDeps();
|
|
198
|
+
buildTypescript(/* force */ true);
|
|
199
|
+
replaceVersion();
|
|
200
|
+
lint();
|
|
201
|
+
test();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function executeCmd(command, exitOnError = true)
|
|
205
|
+
{
|
|
206
|
+
logInfo(`executeCmd(): ${command}`);
|
|
207
|
+
|
|
208
|
+
try
|
|
209
|
+
{
|
|
210
|
+
execSync(command, { stdio: [ 'ignore', process.stdout, process.stderr ] });
|
|
211
|
+
}
|
|
212
|
+
catch (error)
|
|
213
|
+
{
|
|
214
|
+
if (exitOnError)
|
|
215
|
+
{
|
|
216
|
+
logError(`executeCmd() failed, exiting: ${error}`);
|
|
217
|
+
exitWithError();
|
|
218
|
+
}
|
|
219
|
+
else
|
|
220
|
+
{
|
|
221
|
+
logInfo(`executeCmd() failed, ignoring: ${error}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function logInfo(message)
|
|
227
|
+
{
|
|
228
|
+
// eslint-disable-next-line no-console
|
|
229
|
+
console.log(`npm-scripts \x1b[36m[INFO] [${task}]\x1b\[0m`, message);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// eslint-disable-next-line no-unused-vars
|
|
233
|
+
function logWarn(message)
|
|
234
|
+
{
|
|
235
|
+
// eslint-disable-next-line no-console
|
|
236
|
+
console.warn(`npm-scripts \x1b[33m[WARN] [${task}]\x1b\[0m`, message);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function logError(message)
|
|
240
|
+
{
|
|
241
|
+
// eslint-disable-next-line no-console
|
|
242
|
+
console.error(`npm-scripts \x1b[31m[ERROR] [${task}]\x1b\[0m`, message);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function exitWithError()
|
|
246
|
+
{
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mediasoup-client",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.86",
|
|
4
4
|
"description": "mediasoup client side JavaScript library",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"main": "lib/index.js",
|
|
20
20
|
"types": "lib/index.d.ts",
|
|
21
21
|
"files": [
|
|
22
|
-
"npm-scripts.
|
|
22
|
+
"npm-scripts.mjs",
|
|
23
23
|
"lib"
|
|
24
24
|
],
|
|
25
25
|
"keywords": [
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"nodejs"
|
|
30
30
|
],
|
|
31
31
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
32
|
+
"node": ">=16"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"prepare": "node npm-scripts.
|
|
36
|
-
"typescript:build": "node npm-scripts.
|
|
37
|
-
"typescript:watch": "node npm-scripts.
|
|
38
|
-
"lint": "node npm-scripts.
|
|
39
|
-
"test": "node npm-scripts.
|
|
40
|
-
"coverage": "node npm-scripts.
|
|
41
|
-
"install-deps": "node npm-scripts.
|
|
42
|
-
"release:check": "node npm-scripts.
|
|
43
|
-
"release": "node npm-scripts.
|
|
35
|
+
"prepare": "node npm-scripts.mjs prepare",
|
|
36
|
+
"typescript:build": "node npm-scripts.mjs typescript:build",
|
|
37
|
+
"typescript:watch": "node npm-scripts.mjs typescript:watch",
|
|
38
|
+
"lint": "node npm-scripts.mjs lint",
|
|
39
|
+
"test": "node npm-scripts.mjs test",
|
|
40
|
+
"coverage": "node npm-scripts.mjs coverage",
|
|
41
|
+
"install-deps": "node npm-scripts.mjs install-deps",
|
|
42
|
+
"release:check": "node npm-scripts.mjs release:check",
|
|
43
|
+
"release": "node npm-scripts.mjs release"
|
|
44
44
|
},
|
|
45
45
|
"jest": {
|
|
46
46
|
"verbose": true,
|
|
@@ -61,29 +61,30 @@
|
|
|
61
61
|
"cacheDirectory": ".cache/jest"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@types/debug": "^4.1.
|
|
64
|
+
"@types/debug": "^4.1.8",
|
|
65
65
|
"awaitqueue": "^3.0.1",
|
|
66
|
-
"bowser": "^2.11.0",
|
|
67
66
|
"debug": "^4.3.4",
|
|
68
67
|
"events": "^3.3.0",
|
|
69
68
|
"fake-mediastreamtrack": "^1.1.6",
|
|
70
69
|
"h264-profile-level-id": "^1.0.1",
|
|
71
70
|
"queue-microtask": "^1.2.3",
|
|
72
71
|
"sdp-transform": "^2.14.1",
|
|
73
|
-
"supports-color": "^9.3.1"
|
|
72
|
+
"supports-color": "^9.3.1",
|
|
73
|
+
"ua-parser-js": "^1.0.35"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/events": "^3.0.0",
|
|
77
|
-
"@types/jest": "^29.5.
|
|
77
|
+
"@types/jest": "^29.5.2",
|
|
78
78
|
"@types/sdp-transform": "^2.4.6",
|
|
79
|
-
"@
|
|
80
|
-
"@typescript-eslint/
|
|
81
|
-
"eslint": "^
|
|
79
|
+
"@types/ua-parser-js": "^0.7.36",
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
|
81
|
+
"@typescript-eslint/parser": "^5.59.11",
|
|
82
|
+
"eslint": "^8.42.0",
|
|
82
83
|
"eslint-plugin-jest": "^27.2.1",
|
|
83
84
|
"jest": "^29.5.0",
|
|
84
85
|
"open-cli": "^7.2.0",
|
|
85
86
|
"ts-jest": "^29.1.0",
|
|
86
|
-
"tsc-watch": "^6.0.
|
|
87
|
-
"typescript": "^5.
|
|
87
|
+
"tsc-watch": "^6.0.4",
|
|
88
|
+
"typescript": "^5.1.3"
|
|
88
89
|
}
|
|
89
90
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/handlers/sdp/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,eAAe,EAAE,CAAC;AAGhD,MAAM,MAAM,eAAe,GAC3B;IACC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC"}
|
package/npm-scripts.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
|
-
const process = require('process');
|
|
4
|
-
const os = require('os');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const { execSync } = require('child_process');
|
|
7
|
-
const { version } = require('./package.json');
|
|
8
|
-
|
|
9
|
-
const isWindows = os.platform() === 'win32';
|
|
10
|
-
const task = process.argv.slice(2).join(' ');
|
|
11
|
-
|
|
12
|
-
// mediasoup mayor version.
|
|
13
|
-
const MAYOR_VERSION = version.split('.')[0];
|
|
14
|
-
|
|
15
|
-
console.log(`npm-scripts.js [INFO] running task "${task}"`);
|
|
16
|
-
|
|
17
|
-
switch (task)
|
|
18
|
-
{
|
|
19
|
-
// As per NPM documentation (https://docs.npmjs.com/cli/v9/using-npm/scripts)
|
|
20
|
-
// `prepare` script:
|
|
21
|
-
//
|
|
22
|
-
// - Runs BEFORE the package is packed, i.e. during `npm publish` and `npm pack`.
|
|
23
|
-
// - Runs on local `npm install` without any arguments.
|
|
24
|
-
// - NOTE: If a package being installed through git contains a `prepare` script,
|
|
25
|
-
// its dependencies and devDependencies will be installed, and the `prepare`
|
|
26
|
-
// script will be run, before the package is packaged and installed.
|
|
27
|
-
//
|
|
28
|
-
// So here we compile TypeScript to JavaScript.
|
|
29
|
-
case 'prepare':
|
|
30
|
-
{
|
|
31
|
-
buildTypescript(/* force */ false);
|
|
32
|
-
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
case 'typescript:build':
|
|
37
|
-
{
|
|
38
|
-
installDeps();
|
|
39
|
-
buildTypescript(/* force */ true);
|
|
40
|
-
replaceVersion();
|
|
41
|
-
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
case 'typescript:watch':
|
|
46
|
-
{
|
|
47
|
-
deleteLib();
|
|
48
|
-
|
|
49
|
-
const { TscWatchClient } = require('tsc-watch/client');
|
|
50
|
-
const watch = new TscWatchClient();
|
|
51
|
-
|
|
52
|
-
watch.on('success', replaceVersion);
|
|
53
|
-
watch.start('--pretty');
|
|
54
|
-
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
case 'lint':
|
|
59
|
-
{
|
|
60
|
-
lint();
|
|
61
|
-
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
case 'test':
|
|
66
|
-
{
|
|
67
|
-
buildTypescript(/* force */ false);
|
|
68
|
-
replaceVersion();
|
|
69
|
-
test();
|
|
70
|
-
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
case 'coverage':
|
|
75
|
-
{
|
|
76
|
-
buildTypescript(/* force */ false);
|
|
77
|
-
replaceVersion();
|
|
78
|
-
executeCmd('jest --coverage');
|
|
79
|
-
executeCmd('open-cli coverage/lcov-report/index.html');
|
|
80
|
-
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
case 'install-deps':
|
|
85
|
-
{
|
|
86
|
-
installDeps();
|
|
87
|
-
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
case 'release:check':
|
|
92
|
-
{
|
|
93
|
-
checkRelease();
|
|
94
|
-
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
case 'release':
|
|
99
|
-
{
|
|
100
|
-
checkRelease();
|
|
101
|
-
executeCmd(`git commit -am '${version}'`);
|
|
102
|
-
executeCmd(`git tag -a ${version} -m '${version}'`);
|
|
103
|
-
executeCmd(`git push origin v${MAYOR_VERSION}`);
|
|
104
|
-
executeCmd(`git push origin '${version}'`);
|
|
105
|
-
executeCmd('npm publish');
|
|
106
|
-
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
default:
|
|
111
|
-
{
|
|
112
|
-
throw new TypeError(`unknown task "${task}"`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function replaceVersion()
|
|
117
|
-
{
|
|
118
|
-
console.log('npm-scripts.js [INFO] replaceVersion()');
|
|
119
|
-
|
|
120
|
-
const files = [ 'lib/index.js', 'lib/index.d.ts' ];
|
|
121
|
-
|
|
122
|
-
for (const file of files)
|
|
123
|
-
{
|
|
124
|
-
const text = fs.readFileSync(file, { encoding: 'utf8' });
|
|
125
|
-
const result = text.replace(/__MEDIASOUP_CLIENT_VERSION__/g, version);
|
|
126
|
-
|
|
127
|
-
fs.writeFileSync(file, result, { encoding: 'utf8' });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function deleteLib()
|
|
132
|
-
{
|
|
133
|
-
if (!fs.existsSync('lib'))
|
|
134
|
-
{
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
console.log('npm-scripts.js [INFO] deleteLib()');
|
|
139
|
-
|
|
140
|
-
if (!isWindows)
|
|
141
|
-
{
|
|
142
|
-
executeCmd('rm -rf lib');
|
|
143
|
-
}
|
|
144
|
-
else
|
|
145
|
-
{
|
|
146
|
-
// NOTE: This command fails in Windows if the dir doesn't exist.
|
|
147
|
-
executeCmd('rmdir /s /q "lib"', /* exitOnError */ false);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function buildTypescript(force = false)
|
|
152
|
-
{
|
|
153
|
-
if (!force && fs.existsSync('lib'))
|
|
154
|
-
{
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
console.log('npm-scripts.js [INFO] buildTypescript()');
|
|
159
|
-
|
|
160
|
-
deleteLib();
|
|
161
|
-
|
|
162
|
-
executeCmd('tsc');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function lint()
|
|
166
|
-
{
|
|
167
|
-
console.log('npm-scripts.js [INFO] lint()');
|
|
168
|
-
|
|
169
|
-
executeCmd('eslint -c .eslintrc.js --max-warnings 0 src .eslintrc.js npm-scripts.js');
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function test()
|
|
173
|
-
{
|
|
174
|
-
console.log('npm-scripts.js [INFO] test()');
|
|
175
|
-
|
|
176
|
-
executeCmd('jest');
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function installDeps()
|
|
180
|
-
{
|
|
181
|
-
console.log('npm-scripts.js [INFO] installDeps()');
|
|
182
|
-
|
|
183
|
-
// Install/update deps.
|
|
184
|
-
executeCmd('npm ci --ignore-scripts');
|
|
185
|
-
// Update package-lock.json.
|
|
186
|
-
executeCmd('npm install --package-lock-only --ignore-scripts');
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function checkRelease()
|
|
190
|
-
{
|
|
191
|
-
console.log('npm-scripts.js [INFO] checkRelease()');
|
|
192
|
-
|
|
193
|
-
installDeps();
|
|
194
|
-
buildTypescript(/* force */ true);
|
|
195
|
-
replaceVersion();
|
|
196
|
-
lint();
|
|
197
|
-
test();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function executeCmd(command, exitOnError = true)
|
|
201
|
-
{
|
|
202
|
-
console.log(`npm-scripts.js [INFO] executeCmd(): ${command}`);
|
|
203
|
-
|
|
204
|
-
try
|
|
205
|
-
{
|
|
206
|
-
execSync(command, { stdio: [ 'ignore', process.stdout, process.stderr ] });
|
|
207
|
-
}
|
|
208
|
-
catch (error)
|
|
209
|
-
{
|
|
210
|
-
if (exitOnError)
|
|
211
|
-
{
|
|
212
|
-
console.error(`npm-scripts.js [ERROR] executeCmd() failed, exiting: ${error}`);
|
|
213
|
-
|
|
214
|
-
process.exit(1);
|
|
215
|
-
}
|
|
216
|
-
else
|
|
217
|
-
{
|
|
218
|
-
console.log(`npm-scripts.js [INFO] executeCmd() failed, ignoring: ${error}`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|