cross-tab-worker-databus 0.21.0 → 0.21.1

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,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.21.1] - 2026-09-22
4
+
5
+ ### Added
6
+ - `pnpm build:examples` bundles the React example page's framework dependencies (`react`, `react-dom/client`) out of the local install into `examples/react/vendor/react.esm.js`, which is gitignored and regenerated by `pnpm examples` and `pnpm test:e2e`. React ships no browser ESM build, so the page used to import React from `esm.sh` — which meant it could not load where CI has no network, and it was pinned to React 18 while the library's own React tests run against 19.
7
+
8
+ ### Changed
9
+ - `e2e/adapters.spec.ts` now drives both example pages with one set of cases (fan-out, reactive rebind, delivery after the owning tab closes, and the cleared-topic-box fallback), because the two pages expose the same surface: `#topicInput`/`#publishButton`/`#messageList` ids, a `?topic=` override, and a `__vueBus`/`__reactBus` diagnostics hook. The React page gained those ids, the query override, a topic badge and the hook — it hand-wires the core API rather than importing `cross-tab-worker-databus/hooks`, so a failure that shows up for one page and not the other localizes to the adapter instead of to the library. All four cases pass against both pages, and the fallback leg was verified by mutation on each.
10
+ - `docs/getting-started.md` (en + zh) records that both adapter pages are browser-covered and need no network.
11
+ - One correction to the `0.21.0` entry above: it named the React adapter `cross-tab-worker-databus/react`, which is not an export this package has (`cross-tab-worker-databus/hooks` is). The published `0.21.0` release notes keep the original wording — npm versions and GitHub releases are not rewritten — so this fixes it for anyone reading between tags.
12
+
3
13
  ## [0.21.0] - 2026-09-22
4
14
 
5
15
  ### Breaking
@@ -7,7 +17,7 @@
7
17
 
8
18
  ### Changed
9
19
  - `examples/react` and `examples/vue` now resolve their topic as `topicInput.trim() || <default>`, matching what `examples/demo` already did, because their boxes feed a reactive subscription and would otherwise hand `""` straight to the bus. The failure mode the fallback prevents is measured rather than assumed: with it removed, the Vue page keeps rendering its *previous* topic while a `TypeError` escapes to `pageerror`, and the demo page lands on 错误 with an error-feed row that never mentions the field the user just emptied. Both pages are now driven in real browser tabs (`e2e/adapters.spec.ts`, `e2e/demo.spec.ts`), each arm of the guard killing a different mutant.
10
- - `docs/getting-started.md` (en + zh) claimed the browser suite covers both adapter pages. It covers the Vue page only — the React page loads React from `esm.sh`, so it cannot run where CI has no network, and it hand-wires the demo page's pattern rather than using the shipped `cross-tab-worker-databus/react` adapter (covered in jsdom by `tests/hooks.test.tsx`). The paragraph now says exactly that.
20
+ - `docs/getting-started.md` (en + zh) claimed the browser suite covers both adapter pages. It covers the Vue page only — the React page loads React from `esm.sh`, so it cannot run where CI has no network, and it hand-wires the demo page's pattern rather than using the shipped `cross-tab-worker-databus/hooks` adapter (covered in jsdom by `tests/hooks.test.tsx`). The paragraph now says exactly that.
11
21
 
12
22
  ## [0.20.97] - 2026-09-22
13
23
 
@@ -5,7 +5,7 @@ import {
5
5
  parseDataBusPublication,
6
6
  publicationMetadata,
7
7
  selectWorkerBackend
8
- } from "./chunk-EJDXU4DK.js";
8
+ } from "./chunk-2E2FBACL.js";
9
9
  import {
10
10
  CENTRIFUGE_INPUT_TYPE,
11
11
  CENTRIFUGE_OUTPUT_TYPE,
@@ -2346,7 +2346,7 @@ var DedupManager = class {
2346
2346
  };
2347
2347
 
2348
2348
  // src/core/version.ts
2349
- var SDK_VERSION = true ? "0.21.0" : "";
2349
+ var SDK_VERSION = true ? "0.21.1" : "";
2350
2350
 
2351
2351
  // src/core/data-bus.ts
2352
2352
  var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
@@ -3547,4 +3547,4 @@ export {
3547
3547
  parseDataBusPublication,
3548
3548
  selectWorkerBackend
3549
3549
  };
3550
- //# sourceMappingURL=chunk-EJDXU4DK.js.map
3550
+ //# sourceMappingURL=chunk-2E2FBACL.js.map
@@ -2474,7 +2474,7 @@ var DedupManager = class {
2474
2474
  };
2475
2475
 
2476
2476
  // src/core/version.ts
2477
- var SDK_VERSION = true ? "0.21.0" : "";
2477
+ var SDK_VERSION = true ? "0.21.1" : "";
2478
2478
 
2479
2479
  // src/core/data-bus.ts
2480
2480
  var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
@@ -2472,7 +2472,7 @@ var DedupManager = class {
2472
2472
  };
2473
2473
 
2474
2474
  // src/core/version.ts
2475
- var SDK_VERSION = true ? "0.21.0" : "";
2475
+ var SDK_VERSION = true ? "0.21.1" : "";
2476
2476
 
2477
2477
  // src/core/data-bus.ts
2478
2478
  var DEFAULT_REPLAY_MAX_PER_TOPIC = 100;
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  selectRebalanceTarget,
21
21
  selectWorkerBackend,
22
22
  topicMatchesPattern
23
- } from "./chunk-EJDXU4DK.js";
23
+ } from "./chunk-2E2FBACL.js";
24
24
  import {
25
25
  DEFAULT_STORAGE_PREFIX,
26
26
  PRUNE_STRATEGY,
@@ -2,20 +2,20 @@
2
2
 
3
3
  # Browser Benchmark Trend
4
4
 
5
- > Data through 2026-09-22, from the 46 archived `bench-results/browser-*.json` reports (run `pnpm bench:browser` to add one; regenerate this doc with `node scripts/bench-trend.mjs`).
5
+ > Data through 2026-09-22, from the 49 archived `bench-results/browser-*.json` reports (run `pnpm bench:browser` to add one; regenerate this doc with `node scripts/bench-trend.mjs`).
6
6
 
7
7
  The comparison baseline for release gating is `pnpm bench:compare --fail-above-pct 50`, which compares the newest report against the median of the same metric in the preceding reports (50% ceiling absorbs shared-runner noise; a single previous report was a fragile baseline because the in-page hot-path metrics alternate between a fast and a slow mode on identical code). This doc records the long-run picture: values are per-metric latencies where lower is better, and the last column is the best run inside the most recent 5 reports — not an all-time record, because the in-page matrix changed measurement semantics in early September 2026 and older reports are not comparable.
8
8
 
9
9
  <!-- BENCH-TREND:BEGIN (machine-generated table) -->
10
10
  | Metric | Previous (ms) | Latest (ms) | Δ | Best of last 5 runs (ms) |
11
11
  |---|---|---|---|---|
12
- | publish per-message (ms, lower is better) — dedicated | 55.7209 | 55.1633 | -0.56 | 46.6942 |
13
- | publish per-message (ms, lower is better) — shared | 37.1139 | 39.5561 | +2.44 | 33.7528 |
14
- | wildcard dispatch ×1000 (ms, lower is better) | 6.5 | 7 | +0.50 | 6.5 |
15
- | publishBatch ×1000 (ms, lower is better) | 4.5 | 5.1 | +0.60 | 4.5 |
16
- | dedup ×1000 (ms, lower is better) | 16.6 | 12.1 | -4.50 | 12.1 |
17
- | trace + publish ×1000 (ms, lower is better) | 5.3 | 4.8 | -0.50 | 4.8 |
18
- | first-packet cold dispatch (ms, lower is better) | 0.1 | 0 | -0.10 | 0 |
12
+ | publish per-message (ms, lower is better) — dedicated | 63.4052 | 51.1936 | -12.21 | 51.1936 |
13
+ | publish per-message (ms, lower is better) — shared | 66.7386 | 38.8451 | -27.89 | 37.1139 |
14
+ | wildcard dispatch ×1000 (ms, lower is better) | 6.8 | 6.7 | -0.10 | 6.2 |
15
+ | publishBatch ×1000 (ms, lower is better) | 4.7 | 4.6 | -0.10 | 4.1 |
16
+ | dedup ×1000 (ms, lower is better) | 14.7 | 12.8 | -1.90 | 12.1 |
17
+ | trace + publish ×1000 (ms, lower is better) | 5.3 | 4.9 | -0.40 | 4.8 |
18
+ | first-packet cold dispatch (ms, lower is better) | 0 | 0 | +0.00 | 0 |
19
19
  <!-- BENCH-TREND:END -->
20
20
 
21
21
  Notes:
@@ -150,7 +150,7 @@ Open `http://localhost:4173/examples/demo/` and open it in multiple browser Tabs
150
150
  - Data flow animations, event stream, distribution latency metrics, and cluster Worker routing status
151
151
  - SDK capability, transport configuration, active/standby Worker, and visible/hidden Tab state
152
152
 
153
- Two more pages are served next to the demo. `http://localhost:4173/examples/react/` wires the framework-agnostic core by hand (effect, `subscribe`, status), while `http://localhost:4173/examples/vue/` uses nothing but the shipped `cross-tab-worker-databus/vue` composables. Both point at the same local demo endpoint, so a publication from one is received by a tab on any of the three pages that uses the same Topic. Only the Vue page is driven by the browser suite (`e2e/adapters.spec.ts`): the React page loads React itself from `esm.sh`, so it needs the network access CI does not have, and it hand-rolls the same effect/`subscribe`/status wiring the demo page uses rather than the `cross-tab-worker-databus/react` adapter — the shipped React hooks are covered by `tests/hooks.test.tsx` in jsdom instead.
153
+ Two more pages are served next to the demo. `http://localhost:4173/examples/react/` wires the framework-agnostic core by hand (effect, `subscribe`, status), while `http://localhost:4173/examples/vue/` uses nothing but the shipped `cross-tab-worker-databus/vue` composables. Both point at the same local demo endpoint, so a publication from one is received by a tab on any of the three pages that uses the same Topic — and both are driven by the browser suite (`e2e/adapters.spec.ts`), because neither needs network access: Vue is served from the local install and React is bundled from it by `pnpm build:examples`, which `pnpm examples` and `pnpm test:e2e` both run. The React page hand-wires the core API rather than importing the shipped React adapter; those hooks are covered by `tests/hooks.test.tsx` in jsdom.
154
154
 
155
155
  When consuming the repository directly through a Git dependency, use a pinned commit. The repository ships `dist` so consumers do not need to build the SDK during installation.
156
156
 
package/docs/roadmap.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Roadmap
2
2
 
3
- 0.21.0 was released on September 22, 2026. The project is intentionally continuing through reliability-focused releases before a 1.0.0 stability freeze.
3
+ 0.21.1 was released on September 22, 2026. The project is intentionally continuing through reliability-focused releases before a 1.0.0 stability freeze.
4
+
5
+ ## 0.21.1 delivered scope
6
+
7
+ - No library behavior changed; the shipped delta is the example, test and documentation surface. `pnpm build:examples` bundles `react` + `react-dom/client` out of the local install into a gitignored vendor module, replacing the `esm.sh` imports that had kept `examples/react` unloadable on a network-less CI runner — and had it running React 18 while the adapter tests run 19.
8
+ - One set of four browser cases now drives both example pages (fan-out, reactive rebind that leaves the old channel with no server subscriber, delivery after the owning tab closes, and the cleared-topic-box fallback), because the React page gained the ids, the `?topic=` override and the `__reactBus` diagnostics hook the Vue page already exposed. A failure that hits one page and not the other now localizes to the adapter rather than to the library, and the fallback leg is mutation-checked on each page.
9
+ - `docs/getting-started.md` (en + zh) states which pages the browser suite covers, and the `0.21.0` release notes' reference to a `cross-tab-worker-databus/react` export — one this package never had, the real subpath being `cross-tab-worker-databus/hooks` — is corrected in `Unreleased`, since published notes are not rewritten.
4
10
 
5
11
  ## 0.21.0 delivered scope
6
12
 
@@ -2,20 +2,20 @@
2
2
 
3
3
  # 浏览器基准趋势
4
4
 
5
- > 数据截至 2026-09-22,基于 46 份归档的 `bench-results/browser-*.json` 报告(运行 `pnpm bench:browser` 追加一份;用 `node scripts/bench-trend.mjs` 重新生成本文档)。
5
+ > 数据截至 2026-09-22,基于 49 份归档的 `bench-results/browser-*.json` 报告(运行 `pnpm bench:browser` 追加一份;用 `node scripts/bench-trend.mjs` 重新生成本文档)。
6
6
 
7
7
  发布门禁的对比基线是 `pnpm bench:compare --fail-above-pct 50`:将最新报告与其之前若干报告中同一指标的中位数比较(50% 上限用于吸收共享 runner 的噪声;此前只看"上一份报告"并不稳定,因为页内热路径指标在同一份代码上会在快/慢两档之间来回跳)。本文记录长期趋势:数值为逐指标延迟,越低越好;最后一列是最近 5 份报告内的最优值,而不是历史纪录——页内基准矩阵在 2026 年 9 月初变更过测量语义,更早的报告不可比。
8
8
 
9
9
  <!-- BENCH-TREND:BEGIN (machine-generated table) -->
10
10
  | 指标 | 上次 (ms) | 本次 (ms) | Δ | 近 5 次最优 (ms) |
11
11
  |---|---|---|---|---|
12
- | publish per-message (ms, lower is better) — dedicated | 55.7209 | 55.1633 | -0.56 | 46.6942 |
13
- | publish per-message (ms, lower is better) — shared | 37.1139 | 39.5561 | +2.44 | 33.7528 |
14
- | wildcard dispatch ×1000 (ms, lower is better) | 6.5 | 7 | +0.50 | 6.5 |
15
- | publishBatch ×1000 (ms, lower is better) | 4.5 | 5.1 | +0.60 | 4.5 |
16
- | dedup ×1000 (ms, lower is better) | 16.6 | 12.1 | -4.50 | 12.1 |
17
- | trace + publish ×1000 (ms, lower is better) | 5.3 | 4.8 | -0.50 | 4.8 |
18
- | first-packet cold dispatch (ms, lower is better) | 0.1 | 0 | -0.10 | 0 |
12
+ | publish per-message (ms, lower is better) — dedicated | 63.4052 | 51.1936 | -12.21 | 51.1936 |
13
+ | publish per-message (ms, lower is better) — shared | 66.7386 | 38.8451 | -27.89 | 37.1139 |
14
+ | wildcard dispatch ×1000 (ms, lower is better) | 6.8 | 6.7 | -0.10 | 6.2 |
15
+ | publishBatch ×1000 (ms, lower is better) | 4.7 | 4.6 | -0.10 | 4.1 |
16
+ | dedup ×1000 (ms, lower is better) | 14.7 | 12.8 | -1.90 | 12.1 |
17
+ | trace + publish ×1000 (ms, lower is better) | 5.3 | 4.9 | -0.40 | 4.8 |
18
+ | first-packet cold dispatch (ms, lower is better) | 0 | 0 | +0.00 | 0 |
19
19
  <!-- BENCH-TREND:END -->
20
20
 
21
21
  说明:
@@ -150,7 +150,7 @@ pnpm examples
150
150
  - 数据流动画、事件流、分发延迟指标和集群 Worker 路由状态
151
151
  - SDK 能力、transport 配置、活跃/等待 Worker 与可见/隐藏 Tab 状态
152
152
 
153
- 演示页之外还有两个页面:`http://localhost:4173/examples/react/` 手写接入与框架无关的核心 API(effect、`subscribe`、状态),`http://localhost:4173/examples/vue/` 则只使用已发布的 `cross-tab-worker-databus/vue` 组合式 API。二者都连到同一个本地 demo 端点,因此其中一个页面发布的数据会被三个页面里任何使用同一 Topic 的标签页收到。浏览器测试(`e2e/adapters.spec.ts`)只驱动 Vue 页:React 页的 React 本身来自 `esm.sh`,需要 CI 不具备的网络访问;而且它手写的是 demo 页那套 effect/`subscribe`/状态接入,并未使用 `cross-tab-worker-databus/react` 适配器——已发布的 React hooks 由 `tests/hooks.test.tsx` 在 jsdom 中覆盖。
153
+ 演示页之外还有两个页面:`http://localhost:4173/examples/react/` 手写接入与框架无关的核心 API(effect、`subscribe`、状态),`http://localhost:4173/examples/vue/` 则只使用已发布的 `cross-tab-worker-databus/vue` 组合式 API。二者都连到同一个本地 demo 端点,因此其中一个页面发布的数据会被三个页面里任何使用同一 Topic 的标签页收到;两个页面也都被浏览器测试覆盖(`e2e/adapters.spec.ts`),因为它们都不需要外网:Vue 直接由本地安装提供,React 则由 `pnpm build:examples` 从本地安装打包,而 `pnpm examples` 与 `pnpm test:e2e` 都会先跑这一步。React 页手写接入的是核心 API,并没有使用已发布的 `cross-tab-worker-databus/hooks` 适配器;那些 hooks 由 `tests/hooks.test.tsx` 在 jsdom 中覆盖。
154
154
 
155
155
  通过 Git 依赖直接接入仓库时,应固定到具体 commit。仓库随代码提供 `dist`,消费方安装时无需构建 SDK。
156
156
 
@@ -1,6 +1,12 @@
1
1
  # 路线图
2
2
 
3
- 0.21.0 已于 2026 年 9 月 22 日发布。项目会先持续完成可靠性发布,再进入 1.0.0 稳定性冻结。
3
+ 0.21.1 已于 2026 年 9 月 22 日发布。项目会先持续完成可靠性发布,再进入 1.0.0 稳定性冻结。
4
+
5
+ ## 0.21.1 已完成范围
6
+
7
+ - 库行为没有任何变化;本次发布的增量全在示例、测试与文档面。`pnpm build:examples` 从本地安装打包 `react` + `react-dom/client`,产出被 git 忽略的 vendor 模块,取代原先让 `examples/react` 在无网络 CI 上根本加载不出来的 `esm.sh` 引用——并且那个页面跑的是 React 18,而适配层测试跑的是 19。
8
+ - 现在同一组四个浏览器用例驱动两个示例页(扇出、响应式换 topic 后旧 channel 在服务端订阅数归零、owner 标签关闭后仍能送达、清空 topic 输入框后的回退),因为 React 页补齐了 Vue 页早已具备的 id、`?topic=` 覆盖与 `__reactBus` 诊断钩子。只命中某一个页面的失败因此能定位到适配层而不是库,而且回退那条断言在两个页面上都经过变异验证。
9
+ - `docs/getting-started.md`(中英双语)写清了浏览器套件到底覆盖哪些页面;`0.21.0` 发布说明里提到的 `cross-tab-worker-databus/react` 导出其实并不存在(真实子路径是 `cross-tab-worker-databus/hooks`),已发布的文本不会被改写,因此在 `Unreleased` 中更正。
4
10
 
5
11
  ## 0.21.0 已完成范围
6
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cross-tab-worker-databus",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "Framework-agnostic cross-tab data bus with Dedicated/Shared Worker clustering and Centrifuge support.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -89,8 +89,9 @@
89
89
  ],
90
90
  "scripts": {
91
91
  "build": "node scripts/build.mjs",
92
+ "build:examples": "node scripts/build-example-vendor.mjs",
92
93
  "check": "pnpm typecheck && pnpm build && pnpm test && pnpm test:perf",
93
- "examples": "node scripts/serve-examples.mjs",
94
+ "examples": "pnpm build:examples && node scripts/serve-examples.mjs",
94
95
  "lint": "eslint .",
95
96
  "test": "vitest run",
96
97
  "test:perf": "DATABUS_PERF_GATES=1 vitest run tests/perf-gate.test.ts",
@@ -103,7 +104,7 @@
103
104
  "verify:pack": "node scripts/verify-packed-consumer.mjs",
104
105
  "verify:compat": "node scripts/verify-version-compat.mjs",
105
106
  "verify:published": "node scripts/verify-published-consumer.mjs",
106
- "test:e2e": "pnpm build && playwright test",
107
+ "test:e2e": "pnpm build && pnpm build:examples && playwright test",
107
108
  "typecheck": "tsc --noEmit",
108
109
  "prepublishOnly": "pnpm check"
109
110
  },