sv-router 0.10.0 → 0.10.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,6 +1,6 @@
1
1
  {
2
2
  "name": "sv-router",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Modern Svelte Routing",
5
5
  "keywords": [
6
6
  "svelte",
@@ -36,28 +36,28 @@
36
36
  "esm-env": "^1.2.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@changesets/cli": "^2.29.5",
40
- "@eslint/js": "^9.32.0",
41
- "@sveltejs/vite-plugin-svelte": "^6.1.0",
42
- "@testing-library/jest-dom": "^6.6.4",
39
+ "@changesets/cli": "^2.29.7",
40
+ "@eslint/js": "^9.36.0",
41
+ "@sveltejs/vite-plugin-svelte": "^6.2.1",
42
+ "@testing-library/jest-dom": "^6.9.0",
43
43
  "@testing-library/svelte": "^5.2.8",
44
44
  "@testing-library/user-event": "^14.6.1",
45
- "@types/node": "^24.2.0",
46
- "eslint": "^9.32.0",
45
+ "@types/node": "^24.6.0",
46
+ "eslint": "^9.36.0",
47
47
  "eslint-config-prettier": "^10.1.8",
48
48
  "eslint-plugin-simple-import-sort": "^12.1.1",
49
- "eslint-plugin-svelte": "^3.11.0",
49
+ "eslint-plugin-svelte": "^3.12.4",
50
50
  "eslint-plugin-unicorn": "^61.0.2",
51
- "globals": "^16.3.0",
52
- "happy-dom": "^18.0.1",
51
+ "globals": "^16.4.0",
52
+ "happy-dom": "^20.0.0",
53
53
  "prettier": "^3.6.2",
54
54
  "prettier-plugin-jsdoc": "^1.3.3",
55
55
  "prettier-plugin-svelte": "^3.4.0",
56
- "svelte-check": "^4.3.1",
56
+ "svelte-check": "^4.3.2",
57
57
  "type-testing": "^0.2.0",
58
58
  "typescript": "^5.9.2",
59
- "typescript-eslint": "^8.39.0",
60
- "vite": "^7.1.0",
59
+ "typescript-eslint": "^8.45.0",
60
+ "vite": "^7.1.7",
61
61
  "vitest": "^3.2.4"
62
62
  },
63
63
  "peerDependencies": {
@@ -242,7 +242,12 @@ export function onGlobalClick(event) {
242
242
  const anchor = /** @type {HTMLElement} */ (event.target).closest('a');
243
243
  if (!anchor) return;
244
244
 
245
- if (anchor.hasAttribute('target') || anchor.hasAttribute('download')) return;
245
+ if (
246
+ anchor.hasAttribute('target') ||
247
+ anchor.hasAttribute('download') ||
248
+ !anchor.hasAttribute('href')
249
+ )
250
+ return;
246
251
 
247
252
  const url = new URL(anchor.href);
248
253
  const currentOrigin = globalThis.location.origin;
@@ -216,7 +216,7 @@ export function createRouterCode(routes, routesPath, { allLazy = false, js = fal
216
216
  `import { createRouter } from 'sv-router';`,
217
217
  ...imports,
218
218
  '',
219
- `const routes = ${stringifiedRoutes};`,
219
+ `export const routes = ${stringifiedRoutes};`,
220
220
  ...(js ? [] : ['export type Routes = typeof routes;']),
221
221
  'export const { p, navigate, isActive, preload, route } = createRouter(routes);',
222
222
  '',
@@ -152,7 +152,7 @@ export function parseSearch(value) {
152
152
  if (typeof value === 'string') {
153
153
  const searchParams = new URLSearchParams(value);
154
154
  return Object.fromEntries(
155
- searchParams.entries().map(([key, value]) => [key, parseSearchValue(value)]),
155
+ [...searchParams.entries()].map(([key, value]) => [key, parseSearchValue(value)]),
156
156
  );
157
157
  }
158
158
 
package/src/index.d.ts CHANGED
@@ -263,12 +263,12 @@ export type SearchParams = Omit<
263
263
  > & {
264
264
  append(name: string, value: string | number | boolean, options?: { replace?: boolean }): void;
265
265
  delete(name: string, value?: string | number | boolean, options?: { replace?: boolean }): void;
266
- entries(): IterableIterator<[string, string | number | boolean]>;
266
+ entries(): [string, string | number | boolean][];
267
267
  get(name: string): string | number | boolean | null;
268
268
  getAll(name: string): (string | number | boolean)[];
269
269
  set(name: string, value: string | number | boolean, options?: { replace?: boolean }): void;
270
270
  sort(options?: { replace?: boolean }): void;
271
- values(): IterableIterator<string | number | boolean>;
271
+ values(): (string | number | boolean)[];
272
272
  };
273
273
 
274
274
  type NavigateArgs<T extends string> =
@@ -14,7 +14,7 @@ const shell = {
14
14
  updateUrlSearchParams(options);
15
15
  },
16
16
  entries() {
17
- return searchParams.entries().map(([key, value]) => [key, parseSearchValue(value)]);
17
+ return [...searchParams.entries()].map(([key, value]) => [key, parseSearchValue(value)]);
18
18
  },
19
19
  forEach(...args) {
20
20
  return searchParams.forEach(...args);
@@ -45,7 +45,7 @@ const shell = {
45
45
  return searchParams.toString();
46
46
  },
47
47
  values() {
48
- return searchParams.values().map(parseSearchValue);
48
+ return [...searchParams.values()].map(parseSearchValue);
49
49
  },
50
50
  get size() {
51
51
  return searchParams.size;