@couch-kit/display 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @couch-kit/display
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#141](https://github.com/faluciano/react-native-couch-kit/pull/141) [`5142ccd`](https://github.com/faluciano/react-native-couch-kit/commit/5142ccdb2ef37ab85cc57eac1e50f99b567cde70) Thanks [@faluciano](https://github.com/faluciano)! - Relay connections now address the room in the URL: the socket opens against
8
+ `<relayUrl>/r/<roomId>` instead of `<relayUrl>`, and the new `relayRoomUrl()`
9
+ helper builds it.
10
+
11
+ The `CREATE_ROOM` / `JOIN_ROOM` handshake is unchanged, so relays that hold
12
+ every room in one process (the Bun reference server in `services/relay`) ignore
13
+ the path and keep working. Putting the room in the URL lets a relay route a
14
+ connection _before_ reading any frames, which is what per-room hosting — such as
15
+ a Cloudflare Durable Object — requires.
16
+
17
+ No consumer code changes: both `createRelayTransport` and `RelayDisplayHost`
18
+ already take `roomId`, and build the URL themselves.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`5142ccd`](https://github.com/faluciano/react-native-couch-kit/commit/5142ccdb2ef37ab85cc57eac1e50f99b567cde70)]:
23
+ - @couch-kit/client@0.10.0
24
+
25
+ ## 0.1.2
26
+
27
+ ### Patch Changes
28
+
29
+ - [#136](https://github.com/faluciano/react-native-couch-kit/pull/136) [`973805a`](https://github.com/faluciano/react-native-couch-kit/commit/973805af754a8e22c1c6c81de4c858ffa353556c) Thanks [@faluciano](https://github.com/faluciano)! - **Bundle & tree-shaking**
30
+
31
+ - Fix `RelayDisplayHost` resolving as "not exported" for consumers on
32
+ `moduleResolution: NodeNext`/`Node16`. The package is `type: module`, so the
33
+ emitted `.d.ts` is read in strict-ESM mode where an extensionless relative
34
+ re-export (`export * from "./relay-display-host"`) is not resolved. Add the
35
+ `.js` extension to the barrel specifier, matching the other ESM packages.
36
+
3
37
  ## 0.1.1
4
38
 
5
39
  ### Patch Changes
package/dist/index.js CHANGED
@@ -5,7 +5,8 @@ import {
5
5
  DEFAULT_MAX_MESSAGE_BYTES
6
6
  } from "@couch-kit/runtime";
7
7
  import {
8
- RelayMessageTypes
8
+ RelayMessageTypes,
9
+ relayRoomUrl
9
10
  } from "@couch-kit/client";
10
11
 
11
12
  class RelayDisplayHost {
@@ -17,7 +18,7 @@ class RelayDisplayHost {
17
18
  const { url, roomId, ...runtimeConfig } = options;
18
19
  this.roomId = roomId;
19
20
  this.runtime = new GameHostRuntime(runtimeConfig);
20
- this.ws = new WebSocket(url);
21
+ this.ws = new WebSocket(relayRoomUrl(url, roomId));
21
22
  this.ws.onopen = () => {
22
23
  this.ws.send(JSON.stringify({
23
24
  type: RelayMessageTypes.CREATE_ROOM,
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./relay-display-host";
1
+ export * from "./relay-display-host.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"relay-display-host.d.ts","sourceRoot":"","sources":["../src/relay-display-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,qBAAqB,EAE3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAe,MAAM,iBAAiB,CAAC;AAMxE;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO,CAC9E,SAAQ,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC;I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,qBAAa,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO;IACnE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,uDAAuD;IACvD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAE3C,YAAY,OAAO,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,EAoCjD;IAED,wCAAwC;IACxC,QAAQ,QAAO,CAAC,CAA4B;IAE5C,gFAAgF;IAChF,SAAS,aAAc,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CACb;IAEnC,8CAA8C;IAC9C,QAAQ,WAAY,CAAC,KAAG,IAAI,CAAkC;IAE9D,8CAA8C;IAC9C,IAAI,IAAI,IAAI,CAIX;IAED,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,kBAAkB;CAqC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@couch-kit/display",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -47,16 +47,15 @@
47
47
  "verify-build": "node -e \"if(!require('fs').readFileSync('./dist/index.js','utf8').includes('class RelayDisplayHost'))throw new Error('dist/index.js is missing RelayDisplayHost — empty bundle');\"",
48
48
  "prepublishOnly": "bun run build",
49
49
  "test": "bun test",
50
- "lint": "eslint src/",
51
50
  "typecheck": "tsc --noEmit",
52
51
  "clean": "rm -rf dist lib"
53
52
  },
54
53
  "dependencies": {
55
- "@couch-kit/client": "0.9.0",
54
+ "@couch-kit/client": "0.10.0",
56
55
  "@couch-kit/core": "0.9.3",
57
56
  "@couch-kit/runtime": "0.1.0"
58
57
  },
59
58
  "devDependencies": {
60
- "typescript": "^6.0.0"
59
+ "typescript": "^7.0.0"
61
60
  }
62
61
  }
package/src/index.ts CHANGED
@@ -1,4 +1,6 @@
1
- // A single `export *` barrel: a named re-export (`export { X } from`) combined
2
- // with `sideEffects: false` lets bun's bundler tree-shake the sole class out of
3
- // the built entry, publishing an empty `dist/index.js`. `export *` keeps it.
4
- export * from "./relay-display-host";
1
+ // Use an `export *` barrel (a named `export { X } from` lets bun tree-shake the
2
+ // sole class out under `sideEffects: false`, publishing an empty bundle) AND a
3
+ // `.js` extension on the specifier: the package is `type: module`, so consumers
4
+ // on `moduleResolution: NodeNext` resolve the emitted `.d.ts` in strict-ESM mode
5
+ // and an extensionless re-export fails to find `relay-display-host.d.ts`.
6
+ export * from "./relay-display-host.js";
@@ -8,6 +8,7 @@ import {
8
8
  import type { IGameState, IAction, HostMessage } from "@couch-kit/core";
9
9
  import {
10
10
  RelayMessageTypes,
11
+ relayRoomUrl,
11
12
  type RelayServerMessage,
12
13
  } from "@couch-kit/client";
13
14
 
@@ -54,7 +55,7 @@ export class RelayDisplayHost<S extends IGameState, A extends IAction> {
54
55
  const { url, roomId, ...runtimeConfig } = options;
55
56
  this.roomId = roomId;
56
57
  this.runtime = new GameHostRuntime<S, A>(runtimeConfig);
57
- this.ws = new WebSocket(url);
58
+ this.ws = new WebSocket(relayRoomUrl(url, roomId));
58
59
 
59
60
  this.ws.onopen = () => {
60
61
  this.ws.send(