From 0873f1704df5c198dc24866bbd5c164350bda15d Mon Sep 17 00:00:00 2001 From: aoife cassidy Date: Thu, 14 Nov 2024 00:41:50 +0200 Subject: [PATCH] move to mjs by default --- packages/javascript/package.json | 7 +++--- packages/javascript/src/index.cjs | 28 ++++++++++++++++++++++ packages/javascript/src/index.js | 39 ++++++++++--------------------- packages/javascript/src/index.mjs | 13 ----------- 4 files changed, 44 insertions(+), 43 deletions(-) create mode 100644 packages/javascript/src/index.cjs delete mode 100644 packages/javascript/src/index.mjs diff --git a/packages/javascript/package.json b/packages/javascript/package.json index 8abee212..749831ea 100644 --- a/packages/javascript/package.json +++ b/packages/javascript/package.json @@ -2,8 +2,9 @@ "name": "@livekit/protocol", "version": "1.27.1", "description": "", + "type": "module", "main": "src/index.js", - "module": "src/index.mjs", + "import": "src/index.cjs", "types": "src/index.d.ts", "files": [ "src" @@ -11,8 +12,8 @@ "exports": { ".": { "types": "./src/index.d.ts", - "import": "./src/index.mjs", - "require": "./src/index.js" + "import": "./src/index.js", + "require": "./src/index.cjs" }, "./*": { "types": "./src/gen/dts/livekit_*_pb.d.ts", diff --git a/packages/javascript/src/index.cjs b/packages/javascript/src/index.cjs new file mode 100644 index 00000000..603ce8eb --- /dev/null +++ b/packages/javascript/src/index.cjs @@ -0,0 +1,28 @@ +// @ts-check +const { protoInt64 } = require("@bufbuild/protobuf"); +const agentDispatch = require("./gen/cjs/livekit_agent_dispatch_pb.js"); +const agent = require("./gen/cjs/livekit_agent_pb.js"); +const egress = require("./gen/cjs/livekit_egress_pb.js"); +const ingress = require("./gen/cjs/livekit_ingress_pb.js"); +const metrics = require("./gen/cjs/livekit_metrics_pb.js"); +const models = require("./gen/cjs/livekit_models_pb.js"); +const room = require("./gen/cjs/livekit_room_pb.js"); +const rtc = require("./gen/cjs/livekit_rtc_pb.js"); +const sip = require("./gen/cjs/livekit_sip_pb.js"); +const webhook = require("./gen/cjs/livekit_webhook_pb.js"); +const version = require("./gen/cjs/version.js"); + +module.exports = { + protoInt64, + ...agentDispatch, + ...agent, + ...egress, + ...ingress, + ...metrics, + ...models, + ...room, + ...rtc, + ...sip, + ...webhook, + version, +} diff --git a/packages/javascript/src/index.js b/packages/javascript/src/index.js index f7557618..d377cabe 100644 --- a/packages/javascript/src/index.js +++ b/packages/javascript/src/index.js @@ -1,28 +1,13 @@ // @ts-check -const { protoInt64 } = require("@bufbuild/protobuf"); -const agentDispatch = require("./gen/esm/livekit_agent_dispatch_pb.js"); -const agent = require("./gen/esm/livekit_agent_pb.js"); -const egress = require("./gen/esm/livekit_egress_pb.js"); -const ingress = require("./gen/esm/livekit_ingress_pb.js"); -const metrics = require("./gen/esm/livekit_metrics_pb.js"); -const models = require("./gen/esm/livekit_models_pb.js"); -const room = require("./gen/esm/livekit_room_pb.js"); -const rtc = require("./gen/esm/livekit_rtc_pb.js"); -const sip = require("./gen/esm/livekit_sip_pb.js"); -const webhook = require("./gen/esm/livekit_webhook_pb.js"); -const version = require("./gen/esm/version.js"); - -module.exports = { - protoInt64, - ...agentDispatch, - ...agent, - ...egress, - ...ingress, - ...metrics, - ...models, - ...room, - ...rtc, - ...sip, - ...webhook, - ...version, -} +export { protoInt64 } from "@bufbuild/protobuf"; +export * from "./gen/esm/livekit_agent_dispatch_pb.js"; +export * from "./gen/esm/livekit_agent_pb.js"; +export * from "./gen/esm/livekit_egress_pb.js"; +export * from "./gen/esm/livekit_ingress_pb.js"; +export * from "./gen/esm/livekit_metrics_pb.js"; +export * from "./gen/esm/livekit_models_pb.js"; +export * from "./gen/esm/livekit_room_pb.js"; +export * from "./gen/esm/livekit_rtc_pb.js"; +export * from "./gen/esm/livekit_sip_pb.js"; +export * from "./gen/esm/livekit_webhook_pb.js"; +export * from "./gen/esm/version.js"; diff --git a/packages/javascript/src/index.mjs b/packages/javascript/src/index.mjs deleted file mode 100644 index d377cabe..00000000 --- a/packages/javascript/src/index.mjs +++ /dev/null @@ -1,13 +0,0 @@ -// @ts-check -export { protoInt64 } from "@bufbuild/protobuf"; -export * from "./gen/esm/livekit_agent_dispatch_pb.js"; -export * from "./gen/esm/livekit_agent_pb.js"; -export * from "./gen/esm/livekit_egress_pb.js"; -export * from "./gen/esm/livekit_ingress_pb.js"; -export * from "./gen/esm/livekit_metrics_pb.js"; -export * from "./gen/esm/livekit_models_pb.js"; -export * from "./gen/esm/livekit_room_pb.js"; -export * from "./gen/esm/livekit_rtc_pb.js"; -export * from "./gen/esm/livekit_sip_pb.js"; -export * from "./gen/esm/livekit_webhook_pb.js"; -export * from "./gen/esm/version.js";