@real-router/svelte 0.17.50 → 0.17.52
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
|
|
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";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { putField } from "@real-router/core/utils";
|
|
1
2
|
/**
|
|
2
3
|
* Intrinsics captured at module load (#1971).
|
|
3
4
|
*
|
|
@@ -8,7 +9,8 @@
|
|
|
8
9
|
* re-pointed `keys` skips option validation entirely.
|
|
9
10
|
*
|
|
10
11
|
* ⚠ Capture narrows the window from "any time after boot" to "before this module
|
|
11
|
-
* loads". It does not close it
|
|
12
|
+
* loads". It does not close it — a shim evaluated ahead of core still wins
|
|
13
|
+
* (#1798), which is the doctrine's own caveat and travels with it.
|
|
12
14
|
*/
|
|
13
15
|
const objectKeys = Object.keys;
|
|
14
16
|
/**
|
|
@@ -124,7 +126,17 @@ export function buildHref(router, routeName, routeParams, routeSearch, hash) {
|
|
|
124
126
|
export function navigateWithHash(router, routeName, routeParams, routeSearch, hash, extraOptions) {
|
|
125
127
|
const opts = { ...extraOptions };
|
|
126
128
|
if (hash !== undefined) {
|
|
127
|
-
opts.hash =
|
|
129
|
+
// ⚑ `putField`, not `opts.hash = …` (#2141 / #1852). The spread above produces
|
|
130
|
+
// no own key for this slot unless the caller's extra options carried one, so
|
|
131
|
+
// a plain assignment walks the prototype: an ambient accessor an application
|
|
132
|
+
// or a polyfill put on `Object.prototype` takes the value and the navigation
|
|
133
|
+
// runs without the fragment it was asked for, or — getter-only — throws.
|
|
134
|
+
//
|
|
135
|
+
// ⚠ This dir is shared, so one unguarded write here multiplies by its whole
|
|
136
|
+
// consumer set — `packages/react` is the coverage and authority owner
|
|
137
|
+
// (#1838) and owns that count. Its scan classifies COMPUTED-key writes only,
|
|
138
|
+
// which is why a literal slot like this one sat outside it.
|
|
139
|
+
putField(opts, "hash", hash);
|
|
128
140
|
}
|
|
129
141
|
const current = router.getState();
|
|
130
142
|
// What the navigation gets — the caller's `routeSearch` unless the bypass
|
|
@@ -190,8 +202,8 @@ export function navigateWithHash(router, routeName, routeParams, routeSearch, ha
|
|
|
190
202
|
const WHITESPACE_PROBE = /\s/;
|
|
191
203
|
const WHITESPACE_SPLIT = /\S+/g;
|
|
192
204
|
// `value` is always a truthy class string: both call sites narrow it first
|
|
193
|
-
// (`if (isActive && activeClassName)` / `if (!baseClassName) return …`), so
|
|
194
|
-
//
|
|
205
|
+
// (`if (isActive && activeClassName)` / `if (!baseClassName) return …`), so an
|
|
206
|
+
// `if (!value) return []` guard here would be unreachable (#809).
|
|
195
207
|
function parseTokens(value) {
|
|
196
208
|
// Hot-path fast-path (audit-2026-05-17 §8b #1): >99% of active-class
|
|
197
209
|
// inputs at `<Link>` emit are single-token strings like `"active"` or
|
|
@@ -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
|
|
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
|
|
65
|
-
//
|
|
66
|
-
// measurable"
|
|
67
|
-
//
|
|
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.
|
|
3
|
+
"version": "0.17.52",
|
|
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.
|
|
51
|
+
"@real-router/core": "^0.126.12",
|
|
52
52
|
"@real-router/route-utils": "^0.3.1",
|
|
53
|
-
"@real-router/sources": "^0.14.
|
|
53
|
+
"@real-router/sources": "^0.14.32"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@real-router/browser-plugin": "^0.22.13",
|
|
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",
|
|
@@ -60,10 +61,9 @@
|
|
|
60
61
|
"@testing-library/user-event": "~14.6.1",
|
|
61
62
|
"eslint-plugin-svelte": "3.19.0",
|
|
62
63
|
"rimraf": "6.1.3",
|
|
63
|
-
"svelte": "~5.
|
|
64
|
+
"svelte": "~5.57.0",
|
|
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"
|
|
@@ -75,6 +75,8 @@
|
|
|
75
75
|
"type-check": "svelte-check --tsconfig ./tsconfig.json",
|
|
76
76
|
"lint": "eslint --cache src/ tests/ --max-warnings 0",
|
|
77
77
|
"lint:fix": "eslint --cache src/ tests/ --fix --max-warnings 0",
|
|
78
|
+
"lint:package": "publint",
|
|
79
|
+
"lint:types": "attw --pack . --ignore-rules no-resolution cjs-resolves-to-esm internal-resolution-error",
|
|
78
80
|
"bundle": "svelte-package -i src -o dist && rimraf dist/dom-utils/CLAUDE.md"
|
|
79
81
|
}
|
|
80
82
|
}
|