@hoardodile/host-web 0.1.9 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoardodile/host-web",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "license": "MIT",
5
5
  "description": "Browser-side hoardodile host runtime: host-core protocol router and the offline mock host.",
6
6
  "keywords": [
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "zod": "^4.4.3",
44
- "@hoardodile/host": "0.1.9",
45
- "@hoardodile/sdk-web": "0.1.9",
46
- "@hoardodile/sdk-types": "0.1.9"
44
+ "@hoardodile/host": "0.1.11",
45
+ "@hoardodile/sdk-types": "0.1.11",
46
+ "@hoardodile/sdk-web": "0.1.11"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^26.2.0",
@@ -169,6 +169,33 @@ describe("createMockHost bridge", () => {
169
169
  }
170
170
  })
171
171
 
172
+ test("onPrefChanged and onCacheChanged fire on writes (recorder contract)", async () => {
173
+ const onPrefChanged = vi.fn()
174
+ const onCacheChanged = vi.fn()
175
+ const host = createMockHost({
176
+ targetWindow: window,
177
+ files: createInMemoryFileBackend(),
178
+ onPrefChanged,
179
+ onCacheChanged,
180
+ })
181
+ host.register(window, { pluginId: "test-plugin", resId: "r-1" })
182
+ try {
183
+ ensureHostBridge()
184
+ const api = createIframeHostAPI(buildContext())
185
+
186
+ api.setPref("theme", "dark")
187
+ await vi.waitFor(() =>
188
+ expect(onPrefChanged).toHaveBeenCalledWith("theme", "dark"),
189
+ )
190
+ api.setCache("scroll", "42")
191
+ await vi.waitFor(() =>
192
+ expect(onCacheChanged).toHaveBeenCalledWith("r-1", "scroll", "42"),
193
+ )
194
+ } finally {
195
+ host.dispose()
196
+ }
197
+ })
198
+
172
199
  test("requests from unregistered sources are dropped", async () => {
173
200
  const host = createMockHost({
174
201
  targetWindow: window,