fimo-vite 2.10.4-staging.2 → 2.11.0-staging.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.
@@ -201,6 +201,14 @@ export default function translationsPlugin() {
201
201
  devServer = server;
202
202
  closed = false;
203
203
  server.watcher.add([resolveFimoConfigPath(rootDir), join(rootDir, '.env'), join(rootDir, '.env.local')]);
204
+ // A page that loaded the old labels before listening for updates missed
205
+ // the broadcast, so it asks for the current labels once it listens.
206
+ server.ws.on('fimo:labels-sync', (data, client) => {
207
+ const payload = labelUpdatePayload(bundle);
208
+ if (!hasSignature(data, payload.signature)) {
209
+ client.send('fimo:labels-updated', payload);
210
+ }
211
+ });
204
212
  void refreshLabels(true).catch(() => undefined);
205
213
  startFallbackPolling();
206
214
  void connectEvents();
@@ -419,6 +427,9 @@ function labelUpdatePayload(bundle) {
419
427
  signature: labelSignature(bundle),
420
428
  };
421
429
  }
430
+ function hasSignature(data, signature) {
431
+ return typeof data === 'object' && data !== null && 'signature' in data && data.signature === signature;
432
+ }
422
433
  /**
423
434
  * Reads every configured locale dictionary from the tenant API.
424
435
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimo-vite",
3
- "version": "2.10.4-staging.2",
3
+ "version": "2.11.0-staging.1",
4
4
  "description": "Framework-neutral Fimo Vite plugin. Pairs with the fimo package at the same version.",
5
5
  "files": [
6
6
  "dist/",
@@ -31,16 +31,16 @@
31
31
  "oxc-parser": "^0.118.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@fimo/tsconfig": "2.10.4-staging.2",
34
+ "@fimo/tsconfig": "2.11.0-staging.1",
35
35
  "@types/node": "22.18.6",
36
- "fimo": "2.10.4-staging.2",
36
+ "fimo": "2.11.0-staging.1",
37
37
  "typescript": "7.0.2",
38
38
  "vite": "8.3.5",
39
39
  "vite7": "npm:vite@^7.1.7",
40
40
  "vitest": "5.0.5"
41
41
  },
42
42
  "peerDependencies": {
43
- "fimo": "2.10.4-staging.2",
43
+ "fimo": "2.11.0-staging.1",
44
44
  "vite": "^7.0.0 || ^8.0.0"
45
45
  },
46
46
  "engines": {