@real-router/svelte 0.17.49 → 0.17.51

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.
@@ -4,9 +4,6 @@ export { createScrollRestoration } from "./scroll-restore.js";
4
4
  export { createScrollSpy } from "./scroll-spy.js";
5
5
  export { createViewTransitions } from "./view-transitions.js";
6
6
  export { shouldNavigate, buildHref, buildActiveClassName, navigateWithHash, resolveLinkTarget, shallowEqual, applyLinkA11y, } from "./link-utils.js";
7
- export type { ResolvedLinkTarget } from "./link-utils.js";
8
7
  export type { RouteAnnouncerOptions } from "./route-announcer.js";
9
- export type { ScrollRestorationOptions, ScrollRestorationMode, } from "./scroll-restore.js";
8
+ export type { ScrollRestorationOptions } from "./scroll-restore.js";
10
9
  export type { ScrollSpy, ScrollSpyOptions } from "./scroll-spy.js";
11
- export type { DirectionTracker } from "./direction-tracker.js";
12
- export type { ViewTransitions } from "./view-transitions.js";
@@ -8,7 +8,8 @@
8
8
  * re-pointed `keys` skips option validation entirely.
9
9
  *
10
10
  * ⚠ Capture narrows the window from "any time after boot" to "before this module
11
- * loads". It does not close it (#1798).
11
+ * loads". It does not close it — a shim evaluated ahead of core still wins
12
+ * (#1798), which is the doctrine's own caveat and travels with it.
12
13
  */
13
14
  const objectKeys = Object.keys;
14
15
  /**
@@ -190,8 +191,8 @@ export function navigateWithHash(router, routeName, routeParams, routeSearch, ha
190
191
  const WHITESPACE_PROBE = /\s/;
191
192
  const WHITESPACE_SPLIT = /\S+/g;
192
193
  // `value` is always a truthy class string: both call sites narrow it first
193
- // (`if (isActive && activeClassName)` / `if (!baseClassName) return …`), so the
194
- // former `if (!value) return []` guard was unreachable dead code (#809).
194
+ // (`if (isActive && activeClassName)` / `if (!baseClassName) return …`), so an
195
+ // `if (!value) return []` guard here would be unreachable (#809).
195
196
  function parseTokens(value) {
196
197
  // Hot-path fast-path (audit-2026-05-17 §8b #1): >99% of active-class
197
198
  // inputs at `<Link>` emit are single-token strings like `"active"` or
@@ -257,16 +258,25 @@ export function shallowEqual(prev, next) {
257
258
  return false;
258
259
  }
259
260
  const prevKeys = objectKeys(prev);
260
- if (prevKeys.length !== objectKeys(next).length) {
261
+ const nextKeys = objectKeys(next);
262
+ if (prevKeys.length !== nextKeys.length) {
261
263
  return false;
262
264
  }
263
265
  const prevRecord = prev;
264
266
  const nextRecord = next;
265
267
  for (const key of prevKeys) {
266
- // hasOwnProperty guard: without it, a key missing in `next` reads as
267
- // `undefined` and falsely matches `prev[key] === undefined`. Same shape
268
- // as React's shallowEqual (packages/shared/shallowEqual.js).
269
- if (!Object.prototype.hasOwnProperty.call(next, key) ||
268
+ // ⚑ Membership is decided from the LIST the count produced, never from a
269
+ // second question put to the record (#2064; #1815 settled the same question
270
+ // for `recordsShallowEqual` in core). `Object.keys` is own AND enumerable
271
+ // while `hasOwnProperty` is own only — and on a Proxy it is whatever the
272
+ // `getOwnPropertyDescriptor` trap answers.
273
+ //
274
+ // ⚠ `key in next`, `Object.hasOwn` and `propertyIsEnumerable` are the same
275
+ // family, and none of them is the fix: each leaves a cell of this file's
276
+ // own suites red. `lint:membership` is the ratchet over the class.
277
+ //
278
+ // The second array is free: the count already built it and threw it away.
279
+ if (!nextKeys.includes(key) ||
270
280
  !Object.is(prevRecord[key], nextRecord[key])) {
271
281
  return false;
272
282
  }
@@ -10,7 +10,8 @@ const objectCreate = Object.create;
10
10
  * re-pointed `keys` skips option validation entirely.
11
11
  *
12
12
  * ⚠ Capture narrows the window from "any time after boot" to "before this module
13
- * loads". It does not close it (#1798).
13
+ * loads". It does not close it — a shim evaluated ahead of core still wins
14
+ * (#1798), which is the doctrine's own caveat and travels with it.
14
15
  */
15
16
  const objectKeys = Object.keys;
16
17
  const DEFAULT_STORAGE_KEY = "real-router:scroll";
@@ -61,10 +62,10 @@ export function createScrollRestoration(router, options) {
61
62
  // is a small per-mount cache read a few times per navigation, so the tax is
62
63
  // expected to be negligible and no primitive needs importing.
63
64
  //
64
- // ⚠ "Expected", not measured — and the distinction is written here because
65
- // the sibling claim in `putField`'s docblock was published as "not
66
- // measurable" and then refuted by a better instrument. Nothing benches this
67
- // cache; if that changes, measure before repeating the word.
65
+ // ⚠ "Expected", not measured, and the word is chosen: nothing benches this
66
+ // cache. Its sibling in `putField`'s docblock is the reason to be careful —
67
+ // "not measurable" there turned out to be a statement about the instrument,
68
+ // not the cost. Measure before repeating the word.
68
69
  //
69
70
  // ⚠ `JSON.parse` DEFINES, so a stored `"__proto__"` key arrives as ordinary
70
71
  // data either way; what this closes is the ambient half.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/svelte",
3
- "version": "0.17.49",
3
+ "version": "0.17.51",
4
4
  "type": "module",
5
5
  "description": "Svelte 5 integration for Real-Router",
6
6
  "svelte": "./dist/index.js",
@@ -48,11 +48,12 @@
48
48
  "license": "MIT",
49
49
  "sideEffects": false,
50
50
  "dependencies": {
51
- "@real-router/core": "^0.126.0",
51
+ "@real-router/core": "^0.126.6",
52
52
  "@real-router/route-utils": "^0.3.1",
53
- "@real-router/sources": "^0.14.30"
53
+ "@real-router/sources": "^0.14.32"
54
54
  },
55
55
  "devDependencies": {
56
+ "@real-router/browser-plugin": "^0.22.12",
56
57
  "@sveltejs/package": "2.5.8",
57
58
  "@sveltejs/vite-plugin-svelte": "6.2.4",
58
59
  "@testing-library/jest-dom": "~6.9.1",
@@ -62,8 +63,7 @@
62
63
  "rimraf": "6.1.3",
63
64
  "svelte": "~5.56.4",
64
65
  "svelte-check": "4.6.0",
65
- "svelte-eslint-parser": "1.8.0",
66
- "@real-router/browser-plugin": "^0.22.12"
66
+ "svelte-eslint-parser": "1.8.0"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "svelte": ">=5.7.0"