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

Dual package support without typescript #907

Merged
merged 6 commits into from
Nov 29, 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
5 changes: 5 additions & 0 deletions .changeset/good-adults-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/protocol": patch
---

Fix treehaking possibility of individual imports
2 changes: 1 addition & 1 deletion .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ jobs:
- name: Add changes
uses: EndBug/add-and-commit@v9
with:
add: '["livekit", "rpc", "infra"]'
add: '["livekit", "rpc", "infra", "packages/javascript/src/gen"]'
default_author: github_actions
message: generated protobuf
5 changes: 3 additions & 2 deletions packages/javascript/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
src/gen
dist
src/gen/*

11 changes: 11 additions & 0 deletions packages/javascript/build.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @ts-check

import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
declaration: true,
sourcemap: true,
rollup: {
emitCJS: true,
},
});
34 changes: 16 additions & 18 deletions packages/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,36 @@
"version": "1.29.2",
"description": "",
"type": "module",
"main": "dist/index.js",
"import": "dist/index.cjs",
"types": "dist/index.d.ts",
"require": "dist/index.cjs",
"files": [
"src",
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./*": {
"types": "./dist/gen/livekit_*_pb.d.ts",
"import": "./dist/gen/livekit_*_pb.js",
"require": "./dist/gen/livekit_*_pb.cjs"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"main": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"scripts": {
"generate:version": "genversion --esm --semi src/gen/version.ts",
"generate:proto": "mkdir -p 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\""
"generate:proto": "mkdir -p src/gen && protoc --es_out src/gen --es_opt target=dts+js -I=../../protobufs ../../protobufs/livekit_*.proto",
"generate:version": "genversion --esm --semi src/gen/version.js",
"build": "pnpm generate:version && pnpm generate:proto && unbuild"
},
"keywords": [],
"author": "LiveKit",
"license": "Apache-2.0",
"devDependencies": {
"@bufbuild/protoc-gen-es": "^1.10.0",
"genversion": "^3.2.0",
"tsup": "^8.3.5",
"typescript": "5.2"
"genversion": "^3.2.0"
},
"dependencies": {
"@bufbuild/protobuf": "^1.10.0"
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions packages/javascript/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check
export { protoInt64 } from "@bufbuild/protobuf";
export * from "./gen/livekit_agent_dispatch_pb.js";
export * from "./gen/livekit_agent_pb.js";
export * from "./gen/livekit_egress_pb.js";
export * from "./gen/livekit_ingress_pb.js";
export * from "./gen/livekit_metrics_pb.js";
export * from "./gen/livekit_models_pb.js";
export * from "./gen/livekit_room_pb.js";
export * from "./gen/livekit_rtc_pb.js";
export * from "./gen/livekit_sip_pb.js";
export * from "./gen/livekit_webhook_pb.js";
export * from "./gen/version.js";
14 changes: 0 additions & 14 deletions packages/javascript/tsconfig.json

This file was deleted.

43 changes: 0 additions & 43 deletions packages/javascript/tsup.config.ts

This file was deleted.

Loading
Loading