diff --git a/packages/livekit-server-sdk/package.json b/packages/livekit-server-sdk/package.json index 181ec7f4..b7feb437 100644 --- a/packages/livekit-server-sdk/package.json +++ b/packages/livekit-server-sdk/package.json @@ -5,15 +5,20 @@ "main": "dist/index.js", "require": "dist/index.cjs", "types": "dist/index.d.ts", - "repository": "git@github.com:livekit/server-sdk-js.git", + "repository": "github:livekit/server-sdk-js", "author": "David Zhao ", "license": "Apache-2.0", "type": "module", "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } } }, "files": [ diff --git a/packages/livekit-server-sdk/src/AccessToken.test.ts b/packages/livekit-server-sdk/src/AccessToken.test.ts index ba1e353f..c1f7036f 100644 --- a/packages/livekit-server-sdk/src/AccessToken.test.ts +++ b/packages/livekit-server-sdk/src/AccessToken.test.ts @@ -9,8 +9,8 @@ import { } from '@livekit/protocol'; import * as jose from 'jose'; import { describe, expect, it } from 'vitest'; -import { AccessToken, TokenVerifier } from './AccessToken'; -import type { ClaimGrants } from './grants'; +import { AccessToken, TokenVerifier } from './AccessToken.js'; +import type { ClaimGrants } from './grants.js'; const testApiKey = 'abcdefg'; const testSecret = 'abababa'; @@ -143,10 +143,10 @@ describe('room configuration with agents and egress', () => { expect(decoded.roomConfig?.name).toEqual('test-room'); expect(decoded.roomConfig?.maxParticipants).toEqual(10); expect(decoded.roomConfig?.agents).toHaveLength(2); - expect(decoded.roomConfig?.agents?.[0].agentName).toEqual('agent1'); - expect(decoded.roomConfig?.agents?.[0].metadata).toEqual('metadata-1'); - expect(decoded.roomConfig?.agents?.[1].agentName).toEqual('agent2'); - expect(decoded.roomConfig?.agents?.[1].metadata).toEqual('metadata-2'); + expect(decoded.roomConfig?.agents?.[0]?.agentName).toEqual('agent1'); + expect(decoded.roomConfig?.agents?.[0]?.metadata).toEqual('metadata-1'); + expect(decoded.roomConfig?.agents?.[1]?.agentName).toEqual('agent2'); + expect(decoded.roomConfig?.agents?.[1]?.metadata).toEqual('metadata-2'); expect(decoded.roomConfig?.egress?.room?.roomName).toEqual('test-room'); }); }); diff --git a/packages/livekit-server-sdk/src/grants.test.ts b/packages/livekit-server-sdk/src/grants.test.ts index 2e494b47..912d4cfd 100644 --- a/packages/livekit-server-sdk/src/grants.test.ts +++ b/packages/livekit-server-sdk/src/grants.test.ts @@ -3,8 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 import { TrackSource } from '@livekit/protocol'; import { describe, expect, it } from 'vitest'; -import type { ClaimGrants, VideoGrant } from './grants'; -import { claimsToJwtPayload } from './grants'; +import type { ClaimGrants, VideoGrant } from './grants.js'; +import { claimsToJwtPayload } from './grants.js'; describe('ClaimGrants are parsed correctly', () => { it('parses TrackSource correctly to strings', () => { diff --git a/tsup.config.ts b/tsup.config.ts index d92f937f..dc23a680 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,12 +1,12 @@ -import { Options } from 'tsup'; +import type { Options } from 'tsup'; const defaultOptions: Options = { - entry: ['src/**/*.ts'], + entry: ['src/**/*.ts', '!src/**/*.test.ts'], format: ['cjs', 'esm'], splitting: false, sourcemap: true, // for the type maps to work, we use tsc's declaration-only command - dts: false, + dts: true, clean: true, bundle: false, target: 'node16',