sv-router 0.16.1 → 0.16.2

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/package.json CHANGED
@@ -1,21 +1,24 @@
1
1
  {
2
2
  "name": "sv-router",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Type-safe routing for Svelte SPAs",
5
5
  "keywords": [
6
- "svelte",
7
6
  "router",
8
- "spa"
7
+ "spa",
8
+ "svelte"
9
9
  ],
10
10
  "homepage": "https://github.com/colinlienard/sv-router",
11
11
  "bugs": {
12
12
  "url": "https://github.com/colinlienard/sv-router/issues"
13
13
  },
14
+ "license": "MIT",
14
15
  "repository": {
15
16
  "type": "git",
16
17
  "url": "git+https://github.com/colinlienard/sv-router.git"
17
18
  },
18
- "license": "MIT",
19
+ "files": [
20
+ "src"
21
+ ],
19
22
  "type": "module",
20
23
  "exports": {
21
24
  ".": {
@@ -28,9 +31,6 @@
28
31
  "types": "./src/vite-plugin/index.d.ts"
29
32
  }
30
33
  },
31
- "files": [
32
- "src"
33
- ],
34
34
  "dependencies": {
35
35
  "esm-env": "^1.2.2"
36
36
  },
@@ -50,9 +50,7 @@
50
50
  "eslint-plugin-unicorn": "^64.0.0",
51
51
  "globals": "^17.6.0",
52
52
  "happy-dom": "^20.9.0",
53
- "prettier": "^3.8.3",
54
- "prettier-plugin-jsdoc": "^1.8.0",
55
- "prettier-plugin-svelte": "^3.5.1",
53
+ "oxfmt": "^0.49.0",
56
54
  "svelte-check": "^4.4.8",
57
55
  "type-testing": "^0.2.0",
58
56
  "typescript": "^6.0.3",
@@ -74,8 +72,8 @@
74
72
  "check": "svelte-check && pnpm -r check",
75
73
  "lint": "eslint . --max-warnings 0",
76
74
  "lint:fix": "eslint . --fix",
77
- "format": "prettier . --check",
78
- "format:fix": "prettier . --write",
75
+ "format": "oxfmt --check",
76
+ "format:fix": "oxfmt",
79
77
  "changeset": "changeset"
80
78
  },
81
79
  "bin": {
@@ -345,6 +345,8 @@ export function onGlobalClick(event) {
345
345
  const path = base.name === '#' ? url.hash : url.pathname;
346
346
  const hash = base.name === '#' ? undefined : url.hash;
347
347
 
348
+ if (base.name && base.name !== '#' && !path.startsWith(base.name)) return;
349
+
348
350
  event.preventDefault();
349
351
  const { replace, state, scrollToTop, viewTransition } = anchor.dataset;
350
352
 
@@ -68,7 +68,7 @@ function resolveRouteComponent(input) {
68
68
 
69
69
  /**
70
70
  * @param {unknown} input
71
- * @returns {input is import('../index.d.ts').LazyRouteComponent}
71
+ * @returns {input is import("../index.d.ts").LazyRouteComponent}
72
72
  */
73
73
  export function isLazyImport(input) {
74
74
  return (
@@ -66,8 +66,11 @@ export function syncSearchParams(search) {
66
66
  return;
67
67
  }
68
68
  const newSearch = new URLSearchParams(search);
69
- for (const [key, value] of newSearch) {
70
- searchParams.set(key, value);
69
+ for (const key of newSearch.keys()) {
70
+ searchParams.delete(key);
71
+ for (const value of newSearch.getAll(key)) {
72
+ searchParams.append(key, value);
73
+ }
71
74
  }
72
75
  // eslint-disable-next-line unicorn/no-useless-spread
73
76
  for (const key of [...searchParams.keys()]) {