diff --git a/REUSE.toml b/REUSE.toml index 140d77d..f1363b9 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -21,7 +21,7 @@ SPDX-License-Identifier = "Apache-2.0" # project configuration files [[annotations]] -path = ["packages/livekit-rtc/.npmignore", ".prettierrc", ".prettierignore", ".eslintrc", "**.json", ".npmrc"] +path = ["packages/livekit-rtc/.npmignore", ".prettierrc", ".prettierignore", ".eslintrc", "**.json", ".npmrc", "**/tsup.config.ts"] SPDX-FileCopyrightText = "2024 LiveKit, Inc." SPDX-License-Identifier = "Apache-2.0" diff --git a/packages/livekit-rtc/package.json b/packages/livekit-rtc/package.json index 934ab41..76da2e3 100644 --- a/packages/livekit-rtc/package.json +++ b/packages/livekit-rtc/package.json @@ -9,9 +9,9 @@ "types": "dist/index.d.ts", "exports": { ".": { - "types": "dist/index.d.ts", - "import": "dist/index.js", - "require": "dist/index.cjs" + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs" } }, "type": "module", @@ -65,9 +65,9 @@ }, "scripts": { "prebuild": "node -p \"'export const SDK_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts", - "build:tsc": "pnpm prebuild && tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\" && cp -r src/napi dist/", - "build": "pnpm build:tsc && napi build --platform --release --dts native.d.ts --js native.cjs --pipe \"prettier -w\" src/napi", - "artifacts": "pnpm build:tsc && napi artifacts", + "build:ts": "pnpm prebuild && tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\" && cp -r src/napi dist/ && cp -r src/napi/* dist/", + "build": "pnpm build:ts && napi build --platform --release --dts native.d.ts --js native.cjs --pipe \"prettier -w\" src/napi", + "artifacts": "pnpm build:ts && napi artifacts", "build:debug": "napi build --platform", "lint": "eslint -f unix \"src/**/*.ts\" --ignore-pattern \"src/proto/*\"", "universal": "napi universal", diff --git a/packages/livekit-rtc/src/video_source.ts b/packages/livekit-rtc/src/video_source.ts index 07e9173..9ac4170 100644 --- a/packages/livekit-rtc/src/video_source.ts +++ b/packages/livekit-rtc/src/video_source.ts @@ -48,7 +48,11 @@ export class VideoSource { this.ffiHandle = new FfiHandle(res.source!.handle!.id); } - captureFrame(frame: VideoFrame, timestampUs = BigInt(0), rotation = VideoRotation.VIDEO_ROTATION_0) { + captureFrame( + frame: VideoFrame, + timestampUs = BigInt(0), + rotation = VideoRotation.VIDEO_ROTATION_0, + ) { const req = create(CaptureVideoFrameRequestSchema, { sourceHandle: this.ffiHandle.handle, buffer: frame.protoInfo(), diff --git a/packages/livekit-server-sdk/tsup.config.js b/packages/livekit-rtc/tsup.config.ts similarity index 74% rename from packages/livekit-server-sdk/tsup.config.js rename to packages/livekit-rtc/tsup.config.ts index 8ca2096..753158c 100644 --- a/packages/livekit-server-sdk/tsup.config.js +++ b/packages/livekit-rtc/tsup.config.ts @@ -4,4 +4,5 @@ import defaults from '../../tsup.config'; export default defineConfig({ ...defaults, + external: [/\.\/.*\.cjs/, /\.\/.*.node/], }); diff --git a/packages/livekit-server-sdk/package.json b/packages/livekit-server-sdk/package.json index bc9aea0..319d176 100644 --- a/packages/livekit-server-sdk/package.json +++ b/packages/livekit-server-sdk/package.json @@ -11,9 +11,9 @@ "require": "dist/index.cjs", "exports": { ".": { - "types": "dist/index.d.ts", - "import": "dist/index.js", - "require": "dist/index.cjs" + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs" } }, "files": [ diff --git a/packages/livekit-rtc/tsup.config.js b/packages/livekit-server-sdk/tsup.config.ts similarity index 100% rename from packages/livekit-rtc/tsup.config.js rename to packages/livekit-server-sdk/tsup.config.ts diff --git a/tsconfig.json b/tsconfig.json index 3ca4edb..2fa1dd7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { - "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, - "module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, + "target": "es2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, + "module": "es2015" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, "declaration": true, "declarationMap": true, "sourceMap": true, diff --git a/tsup.config.ts b/tsup.config.ts index 1c18e2e..0ddde49 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -8,8 +8,7 @@ const defaultOptions: Options = { // for the type maps to work, we use tsc's declaration-only command dts: false, clean: true, - target: 'es6', - external: [/\.\/.*.node/], + target: 'node16', esbuildOptions: (options, context) => { if (context.format === 'esm') { options.packages = 'external';