From ddd9cbc2436f5aeb32b0f9a3a2855980e0df2b2e Mon Sep 17 00:00:00 2001 From: mektpoy Date: Wed, 21 Oct 2026 13:56:11 +0800 Subject: [PATCH] chore(build): split the liveshare protocol compiler faces The package carried one Host-based tsconfig that both aggregates registered, so the browser carrier was compiled under the Host face while the wire codecs that use Buffer were compiled under the same config. It now follows the repository's double-face template: a solution-only package root, a Host leaf (wire codecs, identity contract, shared vocabulary, and the root barrel that re-exports the carrier), and a browser leaf for the viewer carrier and the pure types it shares. The two repository aggregates register the matching leaf, and the carrier stays in the Host file list because the root barrel re-exports it for the Relay's script generation. The tsdown comment now states the two compiler faces and why only the Host face publishes runtime modules. --- .../liveshare-protocol/tsconfig.client.json | 13 +++++++++++ .../liveshare-protocol/tsconfig.host.json | 23 +++++++++++++++++++ .../liveshare-protocol/tsconfig.json | 13 +++-------- .../liveshare-protocol/tsdown.config.ts | 7 +++++- tsconfig.client.json | 2 +- tsconfig.host.json | 2 +- 6 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 packages/experimental/liveshare-protocol/tsconfig.client.json create mode 100644 packages/experimental/liveshare-protocol/tsconfig.host.json diff --git a/packages/experimental/liveshare-protocol/tsconfig.client.json b/packages/experimental/liveshare-protocol/tsconfig.client.json new file mode 100644 index 0000000000..abfaf50195 --- /dev/null +++ b/packages/experimental/liveshare-protocol/tsconfig.client.json @@ -0,0 +1,13 @@ +{ + "extends": "../../../tsconfig.base.client.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib/types", + "tsBuildInfoFile": "lib/tsconfig.client.tsbuildinfo" + }, + "files": [ + "src/viewer-carrier.ts", + "src/viewer-states.ts", + "src/identity/types.ts" + ] +} diff --git a/packages/experimental/liveshare-protocol/tsconfig.host.json b/packages/experimental/liveshare-protocol/tsconfig.host.json new file mode 100644 index 0000000000..f5a809fc26 --- /dev/null +++ b/packages/experimental/liveshare-protocol/tsconfig.host.json @@ -0,0 +1,23 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "lib/types", + "tsBuildInfoFile": "lib/tsconfig.host.tsbuildinfo" + }, + "files": [ + "src/index.ts", + "src/tunnel-protocol.ts", + "src/viewer-carrier.ts", + "src/viewer-states.ts", + "src/identity/index.ts", + "src/identity/keys.ts", + "src/identity/mock.ts", + "src/identity/types.ts" + ], + "references": [ + { + "path": "../../util/brand" + } + ] +} diff --git a/packages/experimental/liveshare-protocol/tsconfig.json b/packages/experimental/liveshare-protocol/tsconfig.json index 49c9b83b15..2a0b0e33f7 100644 --- a/packages/experimental/liveshare-protocol/tsconfig.json +++ b/packages/experimental/liveshare-protocol/tsconfig.json @@ -1,14 +1,7 @@ { - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types", - "tsBuildInfoFile": "lib/tsconfig.tsbuildinfo" - }, - "include": [ - "src" - ], + "files": [], "references": [ - { "path": "../../util/brand" } + { "path": "./tsconfig.host.json" }, + { "path": "./tsconfig.client.json" } ] } diff --git a/packages/experimental/liveshare-protocol/tsdown.config.ts b/packages/experimental/liveshare-protocol/tsdown.config.ts index c85992b686..3c0c1ca7b5 100644 --- a/packages/experimental/liveshare-protocol/tsdown.config.ts +++ b/packages/experimental/liveshare-protocol/tsdown.config.ts @@ -1,7 +1,12 @@ import type { UserConfig } from 'tsdown' import { defineConfig } from 'tsdown' -/** Dependency-free Host code shared by the owner bundle and the Relay: no browser face. */ +/** + * Dependency-free code shared by the owner bundle and the Relay. The package carries two compiler + * faces — a Host leaf for the wire codecs and identity contract, and a browser leaf for the viewer + * carrier — but only the Host face publishes runtime modules; the carrier reaches a browser as + * generated source text, so it needs no client bundle. + */ export default defineConfig(({ env }) => { if (env?.DSH_BUILD_FACE === 'client') return { entry: '' } satisfies UserConfig return { diff --git a/tsconfig.client.json b/tsconfig.client.json index 91cfdb1075..7e4eb91773 100644 --- a/tsconfig.client.json +++ b/tsconfig.client.json @@ -89,7 +89,7 @@ { "path": "./packages/client/ui-primitives" }, { "path": "./packages/client/modules" }, { "path": "./packages/experimental/inspector/tsconfig.client.json" }, - { "path": "./packages/experimental/liveshare-protocol" }, + { "path": "./packages/experimental/liveshare-protocol/tsconfig.client.json" }, { "path": "./packages/experimental/session-inspector" }, { "path": "./packages/client/hmr" }, { "path": "./packages/client/connection/tsconfig.client.json" }, diff --git a/tsconfig.host.json b/tsconfig.host.json index df6820bd48..a8196f66f8 100644 --- a/tsconfig.host.json +++ b/tsconfig.host.json @@ -528,7 +528,7 @@ { "path": "./packages/experimental/agent-team" }, { "path": "./packages/experimental/agent-team-profile" }, { "path": "./packages/experimental/inspector-profile" }, - { "path": "./packages/experimental/liveshare-protocol" }, + { "path": "./packages/experimental/liveshare-protocol/tsconfig.host.json" }, { "path": "./packages/experimental/tool-agent-team" }, { "path": "./packages/workflow/workflow" }, { "path": "./packages/workflow/workflow-ptc" },