svelte-adapter-uws 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/files/utils.js +20 -11
  2. package/package.json +1 -1
package/files/utils.js CHANGED
@@ -375,17 +375,26 @@ export function computeTopPublishers(stats, intervalSec, thresholds) {
375
375
  // Object.keys / JSON.stringify / spread on userData skip these slots
376
376
  // so they do not leak into client serializations.
377
377
  //
378
- // The symbols are exported from this module so handler.js, vite.js,
379
- // and testing.js share the same identity. Each Symbol() call creates
380
- // a unique value, so the adapter's slot is unreachable from user code
381
- // that does not import this module.
378
+ // The symbols use Symbol.for(...) so handler.js, vite.js, and testing.js
379
+ // (and downstream consumers like svelte-adapter-uws-extensions/redis/registry)
380
+ // all resolve to the SAME global symbol regardless of whether utils.js
381
+ // was bundled into a build artifact or loaded from node_modules at runtime.
382
+ // Plain `Symbol(description)` would create a new unique value per file
383
+ // instance, and a bundler that duplicates utils.js (vite's SSR output
384
+ // bundles handler.js + utils.js into build/) would produce two distinct
385
+ // symbols for the same conceptual slot - the handler would stamp under
386
+ // one symbol and a runtime-loaded extension (e.g. the cluster registry)
387
+ // would read under the other, silently dropping every cross-module lookup.
388
+ // The trade-off is that user code that calls Symbol.for('adapter-uws.ws.*')
389
+ // can now reach these slots; that is a deliberate accept since the
390
+ // alternative was a silent cluster-routing break in production.
382
391
 
383
- export const WS_SUBSCRIPTIONS = Symbol('adapter-uws.ws.subscriptions');
384
- export const WS_COALESCED = Symbol('adapter-uws.ws.coalesced');
385
- export const WS_SESSION_ID = Symbol('adapter-uws.ws.session-id');
386
- export const WS_PENDING_REQUESTS = Symbol('adapter-uws.ws.pending-requests');
387
- export const WS_STATS = Symbol('adapter-uws.ws.stats');
388
- export const WS_PLATFORM = Symbol('adapter-uws.ws.platform');
392
+ export const WS_SUBSCRIPTIONS = Symbol.for('adapter-uws.ws.subscriptions');
393
+ export const WS_COALESCED = Symbol.for('adapter-uws.ws.coalesced');
394
+ export const WS_SESSION_ID = Symbol.for('adapter-uws.ws.session-id');
395
+ export const WS_PENDING_REQUESTS = Symbol.for('adapter-uws.ws.pending-requests');
396
+ export const WS_STATS = Symbol.for('adapter-uws.ws.stats');
397
+ export const WS_PLATFORM = Symbol.for('adapter-uws.ws.platform');
389
398
  /**
390
399
  * Set of capabilities the connected client has advertised via a
391
400
  * `{type:'hello', caps: [...]}` frame. Read by `platform.publishBatched`
@@ -393,7 +402,7 @@ export const WS_PLATFORM = Symbol('adapter-uws.ws.platform');
393
402
  * to N individual frames for that connection. Empty / undefined is
394
403
  * the safe default - assume the client has no opt-in features.
395
404
  */
396
- export const WS_CAPS = Symbol('adapter-uws.ws.caps');
405
+ export const WS_CAPS = Symbol.for('adapter-uws.ws.caps');
397
406
 
398
407
  // - Bounded-by-default capacity caps ---------------------------------------
399
408
  // Single source of truth for the per-connection and module-level Map / Set
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-adapter-uws",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },