Skip to content

Commit

Permalink
Enable verbatimModuleSyntax and isolatedModules (#341)
Browse files Browse the repository at this point in the history
* Enable verbatimModuleSyntax and isolatedModules

* Create silver-rocks-listen.md

* include lib check
  • Loading branch information
lukasIO authored Nov 28, 2024
1 parent 13a7d34 commit 16a2a10
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 31 deletions.
6 changes: 6 additions & 0 deletions .changeset/silver-rocks-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@livekit/rtc-node": patch
"livekit-server-sdk": patch
---

Enable verbatimModuleSyntax and isolatedModules
8 changes: 4 additions & 4 deletions packages/livekit-rtc/src/ffi_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import {
livekitRetrievePtr,
} from './napi/native.js';
import {
FfiEvent,
type FfiEvent,
FfiEventSchema,
FfiRequest,
type FfiRequest,
FfiRequestSchema,
FfiResponse,
type FfiResponse,
FfiResponseSchema,
} from './proto/ffi_pb.js';
import { SDK_VERSION } from './version.js';

export { FfiHandle, FfiEvent, FfiResponse, FfiRequest, livekitDispose as dispose };
export { FfiHandle, type FfiEvent, type FfiResponse, type FfiRequest, livekitDispose as dispose };

export type FfiClientCallbacks = {
ffi_event: (event: FfiEvent) => void;
Expand Down
22 changes: 14 additions & 8 deletions packages/livekit-rtc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,39 @@ import {
import { TrackSource } from './proto/track_pb.js';
import { VideoCodec } from './proto/video_frame_pb.js';

export { Room, RoomEvent, ConnectError, RoomOptions, RtcConfiguration } from './room.js';
export { Room, RoomEvent, ConnectError, type RoomOptions, type RtcConfiguration } from './room.js';
export { Participant, RemoteParticipant, LocalParticipant } from './participant.js';
export {
Track,
LocalTrack,
RemoteTrack,
VideoTrack,
type LocalTrack,
type RemoteTrack,
type VideoTrack,
LocalAudioTrack,
LocalVideoTrack,
RemoteAudioTrack,
RemoteVideoTrack,
AudioTrack,
type AudioTrack,
} from './track.js';
export { VideoFrame } from './video_frame.js';
export { AudioFrame, combineAudioFrames } from './audio_frame.js';
export { AudioStream } from './audio_stream.js';
export { AudioResampler, AudioResamplerQuality } from './audio_resampler.js';
export { VideoStream, VideoFrameEvent } from './video_stream.js';
export { VideoStream, type VideoFrameEvent } from './video_stream.js';
export { AudioSource } from './audio_source.js';
export { VideoSource } from './video_source.js';
export {
TrackPublication,
RemoteTrackPublication,
LocalTrackPublication,
} from './track_publication.js';
export { Transcription, TranscriptionSegment } from './transcription.js';
export { E2EEManager, E2EEOptions, KeyProviderOptions, KeyProvider, FrameCryptor } from './e2ee.js';
export { type Transcription, type TranscriptionSegment } from './transcription.js';
export {
E2EEManager,
type E2EEOptions,
type KeyProviderOptions,
KeyProvider,
FrameCryptor,
} from './e2ee.js';

export {
ConnectionQuality,
Expand Down
10 changes: 5 additions & 5 deletions packages/livekit-rtc/src/napi/native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

/* auto-generated by NAPI-RS */

export function livekitInitialize(
export declare function livekitInitialize(
callback: (data: Uint8Array) => void,
captureLogs: boolean,
sdkVersion: string,
): void;
export function livekitFfiRequest(data: Uint8Array): Uint8Array;
export function livekitRetrievePtr(handle: Uint8Array): bigint;
export function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
export function livekitDispose(): Promise<void>;
export declare function livekitFfiRequest(data: Uint8Array): Uint8Array;
export declare function livekitRetrievePtr(handle: Uint8Array): bigint;
export declare function livekitCopyBuffer(ptr: bigint, len: number): Uint8Array;
export declare function livekitDispose(): Promise<void>;
export declare class FfiHandle {
constructor(handle: bigint);
dispose(): void;
Expand Down
13 changes: 2 additions & 11 deletions packages/livekit-rtc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "ES2015",
"esModuleInterop": true,
"allowJs": true,
"declaration": true,
"declarationMap": true,
"target": "es2015",
"lib": ["es2015"],
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"strict": true,
"noUncheckedIndexedAccess": true
"declarationDir": "dist"
},
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts", "vite.config.ts"]
Expand Down
4 changes: 3 additions & 1 deletion packages/livekit-server-sdk/src/AccessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export class AccessToken {
}
if (!apiKey || !apiSecret) {
throw Error('api-key and api-secret must be set');
} else if (typeof document !== 'undefined') {
}
// @ts-expect-error we're not including dom lib for the server sdk so document is not defined
else if (typeof document !== 'undefined') {
// check against document rather than window because deno provides window
console.error(
'You should not include your API secret in your web client bundle.\n\n' +
Expand Down
2 changes: 1 addition & 1 deletion packages/livekit-server-sdk/src/TwirpRPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class TwirpRpc {
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}: ${response.statusText}`);
}
const parsedResp = await response.json();
const parsedResp = (await response.json()) as Record<string, unknown>;
const camelcaseKeys = await import('camelcase-keys').then((mod) => mod.default);
return camelcaseKeys(parsedResp, { deep: true });
}
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
{
"compilerOptions": {
"lib": ["es2015"],
"target": "es2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "node16" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"moduleResolution": "node16",
"strict": true /* Enable all strict type-checking options. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"skipLibCheck": true /* Skip type checking of declaration files. */,
"skipLibCheck": false /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"verbatimModuleSyntax": true,
"isolatedModules": true,
"noUncheckedIndexedAccess": true
}
}

0 comments on commit 16a2a10

Please sign in to comment.