From 024880493bfc3cdf757d0881ed81e6bbe6bb41e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 10 Oct 2024 14:13:25 +0200 Subject: [PATCH 1/4] Export TS types in a separate entry point via 'mediasoup-client/types' ## Details The idea is that, instead of exporting types like this: ```ts import { types as mediasoupClientTypes } from 'mediasoup-client'; ``` We import them this way: ```ts import types as mediasoupClientTypes from 'mediasoup-client/types'; ``` ## TODO 1 I've briefly tested this and it looks like for this to work, the parent application must have in its `tsconfig.json`: ``` "module": "nodenext", "moduleResolution": "nodenext", ``` Is this ok? Any other implications? ## TODO 2 Should we stop exporting `types` from 'mediasoup-client' and instead force applications to import them from 'mediasoup-client/types'? ## TODO 3 We should export `HandlerInterface` type so applications do not need to do this ugly thing: ```ts import { HandlerFactory as MediasoupClientHandlerFactory } from 'mediasoup-client/lib/handlers/HandlerInterface'; ``` --- package.json | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a833c6a1..61735ecf 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,21 @@ "type": "opencollective", "url": "https://opencollective.com/mediasoup" }, - "main": "lib/index.js", - "types": "lib/index.d.ts", + "main": "./lib/index.js", + "types": "./lib/index.d.ts", + "exports": { + ".": { + "import": "./lib/index.js", + "types": "./lib/index.d.ts" + }, + "./types": { + "import": "./lib/types.js", + "types": "./lib/types.d.ts" + } + }, "files": [ - "npm-scripts.mjs", - "lib" + "./npm-scripts.mjs", + "./lib" ], "engines": { "node": ">=18" From b5cf85507ea4c48e18e79ac1be0494bc88db2489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 10 Oct 2024 14:15:51 +0200 Subject: [PATCH 2/4] fix format --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 61735ecf..d00719d4 100644 --- a/package.json +++ b/package.json @@ -19,14 +19,14 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "exports": { - ".": { - "import": "./lib/index.js", - "types": "./lib/index.d.ts" - }, - "./types": { - "import": "./lib/types.js", - "types": "./lib/types.d.ts" - } + ".": { + "import": "./lib/index.js", + "types": "./lib/index.d.ts" + }, + "./types": { + "import": "./lib/types.js", + "types": "./lib/types.d.ts" + } }, "files": [ "./npm-scripts.mjs", From 5f68568a74e7d86688d5e34dec23e716280e52f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Fri, 11 Oct 2024 12:55:40 +0200 Subject: [PATCH 3/4] remove "main" and "types" fields in package.json since they are replaced by the new "exports" --- package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/package.json b/package.json index d00719d4..481ab297 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,6 @@ "type": "opencollective", "url": "https://opencollective.com/mediasoup" }, - "main": "./lib/index.js", - "types": "./lib/index.d.ts", "exports": { ".": { "import": "./lib/index.js", From 01d55c88e9b90a08f48e0b17758bd9ec9b8d070b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 17 Oct 2024 17:46:50 +0200 Subject: [PATCH 4/4] CI: deprecate node12 --- .github/workflows/mediasoup-client.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mediasoup-client.yaml b/.github/workflows/mediasoup-client.yaml index e2a923a3..da4399c3 100644 --- a/.github/workflows/mediasoup-client.yaml +++ b/.github/workflows/mediasoup-client.yaml @@ -19,9 +19,11 @@ jobs: node: 20 - os: ubuntu-24.04 node: 22 - - os: macos-12 - node: 20 + - os: macos-13 + node: 18 - os: macos-14 + node: 20 + - os: macos-15 node: 22 - os: windows-2022 node: 22