@real-router/svelte 0.17.18 → 0.17.20

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.
@@ -37,12 +37,31 @@ export function createScrollRestoration(router, options) {
37
37
  if (store !== undefined) {
38
38
  return store;
39
39
  }
40
+ // ⚑ A PROTOTYPE-LESS record, and here that is the cheap fix rather than the
41
+ // expensive one (#1852). The key is `${route}:${json}`, so both the
42
+ // skip-same-value READ and the write below consult a chain under a name the
43
+ // page never chose; with no chain there is nothing to consult. Core pays for
44
+ // the same guarantee with `putField` because its bags are read on every
45
+ // render and V8 keeps a prototype-less object in dictionary mode — this one
46
+ // is a small per-mount cache read a few times per navigation, so the tax is
47
+ // expected to be negligible and no primitive needs importing.
48
+ //
49
+ // ⚠ "Expected", not measured — and the distinction is written here because
50
+ // the sibling claim in `putField`'s docblock was published as "not
51
+ // measurable" and then refuted by a better instrument. Nothing benches this
52
+ // cache; if that changes, measure before repeating the word.
53
+ //
54
+ // ⚠ `JSON.parse` DEFINES, so a stored `"__proto__"` key arrives as ordinary
55
+ // data either way; what this closes is the ambient half.
40
56
  try {
41
57
  const raw = sessionStorage.getItem(storageKey);
42
- store = raw ? JSON.parse(raw) : {};
58
+ const parsed = raw
59
+ ? JSON.parse(raw)
60
+ : undefined;
61
+ store = Object.assign(Object.create(null), parsed);
43
62
  }
44
63
  catch {
45
- store = {};
64
+ store = Object.create(null);
46
65
  }
47
66
  return store;
48
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/svelte",
3
- "version": "0.17.18",
3
+ "version": "0.17.20",
4
4
  "type": "module",
5
5
  "description": "Svelte 5 integration for Real-Router",
6
6
  "svelte": "./dist/index.js",
@@ -48,9 +48,9 @@
48
48
  "license": "MIT",
49
49
  "sideEffects": false,
50
50
  "dependencies": {
51
- "@real-router/core": "^0.98.0",
51
+ "@real-router/core": "^0.100.0",
52
52
  "@real-router/route-utils": "^0.3.0",
53
- "@real-router/sources": "^0.14.0"
53
+ "@real-router/sources": "^0.14.2"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@sveltejs/package": "2.5.8",
@@ -63,7 +63,7 @@
63
63
  "svelte": "~5.56.4",
64
64
  "svelte-check": "4.6.0",
65
65
  "svelte-eslint-parser": "1.8.0",
66
- "@real-router/browser-plugin": "^0.20.13"
66
+ "@real-router/browser-plugin": "^0.20.15"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "svelte": ">=5.7.0"