Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: support CJS #883

Merged
merged 15 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion infra/link.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_agent.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_agent_dispatch.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_analytics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_egress.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_ingress.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_internal.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_models.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_room.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_rtc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_sip.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion livekit/livekit_webhook.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.9",
"@livekit/changesets-changelog-github": "^0.0.4"
"@livekit/changesets-changelog-github": "^0.0.4",
"esbuild": "^0.24.0"
}
}
2 changes: 1 addition & 1 deletion packages/javascript/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
dist/
src/gen
!src/gen/version.d.ts
28 changes: 17 additions & 11 deletions packages/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,38 @@
"version": "1.27.1",
"description": "",
"type": "module",
nbsp marked this conversation as resolved.
Show resolved Hide resolved
"main": "src/index.js",
"types": "src/index.d.ts",
"main": "dist/index.js",
"import": "dist/index.cjs",
"types": "dist/index.d.ts",
"files": [
"src"
"dist"
],
"exports": {
".": {
"types": "./src/index.d.ts",
"default": "./src/index.js"
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./*": {
"types": "./src/gen/livekit_*_pb.d.ts",
"default": "./src/gen/livekit_*_pb.js"
"types": "./dist/gen/livekit_*_pb.d.ts",
"import": "./dist/gen/livekit_*_pb.js",
"require": "./dist/gen/livekit_*_pb.cjs"
}
},
"scripts": {
"generate:version": "genversion --esm --semi src/gen/version.js",
"generate:proto": "protoc --es_out src/gen --es_opt target=js+dts -I=../../protobufs ../../protobufs/livekit_*.proto",
"build": "pnpm generate:version && pnpm generate:proto"
"generate:version": "genversion --esm --semi src/gen/version.ts",
"generate:proto": "mkdir src/gen && protoc --es_out src/gen --es_opt target=ts -I=../../protobufs ../../protobufs/livekit_*.proto",
"prebuild": "pnpm generate:version && pnpm generate:proto",
"build": "pnpm prebuild && tsup --onSuccess \"tsc --declaration --emitDeclarationOnly\""
},
"keywords": [],
"author": "LiveKit",
"license": "Apache-2.0",
"devDependencies": {
"@bufbuild/protoc-gen-es": "^1.10.0",
"genversion": "^3.2.0"
"genversion": "^3.2.0",
"tsup": "^8.3.5",
"typescript": "^5.7.2"
},
"dependencies": {
"@bufbuild/protobuf": "^1.10.0"
Expand Down
1 change: 0 additions & 1 deletion packages/javascript/src/gen/version.d.ts

This file was deleted.

13 changes: 0 additions & 13 deletions packages/javascript/src/index.js

This file was deleted.

File renamed without changes.
13 changes: 13 additions & 0 deletions packages/javascript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
"skipLibCheck": true,
"sourceMap": true,
"outDir": "dist",
},
"include": ["src/**/*.ts"],
}
19 changes: 19 additions & 0 deletions packages/javascript/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Options } from 'tsup';

const defaultOptions: Options = {
entry: ['src/**/*.ts'],
format: ['cjs', 'esm'],
splitting: false,
sourcemap: true,
// for the type maps to work, we use tsc's declaration-only command
dts: false,
clean: true,
target: 'node16',
bundle: false,
esbuildOptions: (options, context) => {
if (context.format === 'esm') {
options.packages = 'external';
}
},
};
export default defaultOptions;
Loading
Loading