@real-router/svelte 0.15.12 → 0.15.13
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.
- package/dist/dom-utils/link-utils.js +12 -27
- package/package.json +3 -3
|
@@ -5,39 +5,24 @@ export function shouldNavigate(evt) {
|
|
|
5
5
|
!evt.ctrlKey &&
|
|
6
6
|
!evt.shiftKey);
|
|
7
7
|
}
|
|
8
|
-
// Matches a single percent-escape triple (`%` + two hex digits). Used as
|
|
9
|
-
// the "already-encoded" probe in `encodeFragmentInline` below — see the
|
|
10
|
-
// idempotency rationale there.
|
|
11
|
-
const PERCENT_ESCAPE_PROBE = /%[\dA-Fa-f]{2}/;
|
|
12
8
|
/**
|
|
13
9
|
* RFC 3986 fragment encoding: preserve sub-delims (`&`, `=`, `?`, `:`),
|
|
14
10
|
* encode space, `%`, control chars, non-ASCII via encodeURI; defensively
|
|
15
|
-
* escape `#` (encodeURI does not).
|
|
16
|
-
* `shared/browser-env/url-context.ts` — duplicated
|
|
17
|
-
* shared/dom-utils symlink graph does not reach shared/browser-env
|
|
11
|
+
* escape `#` (encodeURI does not). Kept BYTE-FOR-BYTE identical to
|
|
12
|
+
* `encodeHashFragment` in `shared/browser-env/url-context.ts` — duplicated
|
|
13
|
+
* because the shared/dom-utils symlink graph does not reach shared/browser-env;
|
|
14
|
+
* a sync test (`link-utils` functional suite) asserts the two stay identical.
|
|
18
15
|
*
|
|
19
|
-
* **
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* fall through to plain `encodeURI`, which never throws.
|
|
16
|
+
* **STRICTLY-DECODED contract (#1211 / D1=A).** The `<Link hash>` value is a
|
|
17
|
+
* DECODED fragment (no leading `#`) and is encoded verbatim. This OVERTURNS
|
|
18
|
+
* audit-2026-05-17 §5 E.1 — the earlier percent-escape probe (decode + re-encode
|
|
19
|
+
* for copy-from-`location.hash` tolerance) is REMOVED, so both the adapter and
|
|
20
|
+
* the plugin layer obey one contract: `<Link hash="a%20b">` renders `#a%2520b`
|
|
21
|
+
* (the literal fragment `a%20b`) under every runtime. Consumers who want the
|
|
22
|
+
* fragment `a b` pass `hash="a b"`; passing raw `location.hash` (percent-encoded)
|
|
23
|
+
* is no longer supported — it was the source of the plugin↔adapter divergence.
|
|
28
24
|
*/
|
|
29
25
|
function encodeFragmentInline(decoded) {
|
|
30
|
-
if (PERCENT_ESCAPE_PROBE.test(decoded)) {
|
|
31
|
-
try {
|
|
32
|
-
const roundtrip = decodeURIComponent(decoded);
|
|
33
|
-
return encodeURI(roundtrip).replaceAll("#", "%23");
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
// Malformed `%XX` — fall through to the plain encoding path.
|
|
37
|
-
// encodeURI does not throw on malformed escapes; it treats the
|
|
38
|
-
// `%` as a literal and percent-encodes it (`%2` → `%252`).
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
26
|
return encodeURI(decoded).replaceAll("#", "%23");
|
|
42
27
|
}
|
|
43
28
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/svelte",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Svelte 5 integration for Real-Router",
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -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.18.
|
|
66
|
+
"@real-router/browser-plugin": "^0.18.17"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"svelte": ">=5.7.0"
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"test:stress": "vitest run --config vitest.config.stress.mts",
|
|
75
75
|
"type-check": "svelte-check --tsconfig ./tsconfig.json",
|
|
76
76
|
"lint": "eslint --cache src/ tests/ --fix --max-warnings 0",
|
|
77
|
-
"bundle": "svelte-package -i src -o dist && rimraf dist/dom-utils/
|
|
77
|
+
"bundle": "svelte-package -i src -o dist && rimraf dist/dom-utils/CLAUDE.md"
|
|
78
78
|
}
|
|
79
79
|
}
|