@kitbag/router 0.22.0 → 0.22.1

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.
Files changed (41) hide show
  1. package/dist/components/routerLink.d.ts +2 -2
  2. package/dist/errors/invalidRouteParamValueError.d.ts +11 -0
  3. package/dist/kitbag-router.js +2107 -2016
  4. package/dist/kitbag-router.umd.cjs +3 -3
  5. package/dist/main.d.ts +2 -0
  6. package/dist/services/combineUrl.d.ts +4 -0
  7. package/dist/services/createResolvedRoute.d.ts +1 -1
  8. package/dist/services/createUrl.d.ts +2 -0
  9. package/dist/services/getMatchesForUrl.d.ts +4 -2
  10. package/dist/services/getRoutesForRouter.d.ts +7 -2
  11. package/dist/services/routeRegex.d.ts +17 -12
  12. package/dist/services/urlParser.d.ts +17 -1
  13. package/dist/services/zod.d.ts +1 -1
  14. package/dist/types/createRouteOptions.d.ts +9 -12
  15. package/dist/types/params.d.ts +8 -36
  16. package/dist/types/redirects.d.ts +4 -4
  17. package/dist/types/resolved.d.ts +10 -10
  18. package/dist/types/route.d.ts +4 -24
  19. package/dist/types/routeWithParams.d.ts +2 -2
  20. package/dist/types/router.d.ts +6 -0
  21. package/dist/types/routerRoute.d.ts +1 -1
  22. package/dist/types/url.d.ts +86 -0
  23. package/dist/types/urlString.d.ts +0 -9
  24. package/dist/utilities/testHelpers.d.ts +1520 -298
  25. package/dist/utilities/trailingSlashes.d.ts +8 -0
  26. package/package.json +6 -5
  27. package/dist/services/createResolvedRouteForUrl.d.ts +0 -3
  28. package/dist/services/paramValidation.d.ts +0 -4
  29. package/dist/services/routeMatchRules.d.ts +0 -5
  30. package/dist/services/routeMatchScore.d.ts +0 -7
  31. package/dist/services/urlAssembly.d.ts +0 -10
  32. package/dist/services/urlAssembly.spec.d.ts +0 -1
  33. package/dist/services/urlCombine.d.ts +0 -2
  34. package/dist/services/urlCombine.spec.d.ts +0 -1
  35. package/dist/services/urlCreator.d.ts +0 -2
  36. package/dist/services/urlCreator.spec.d.ts +0 -1
  37. package/dist/types/routeMatchRule.d.ts +0 -2
  38. /package/dist/services/{createResolvedRouteForUrl.browser.spec.d.ts → combineUrl.spec.d.ts} +0 -0
  39. /package/dist/services/{paramValidation.spec.d.ts → createResolvedRoute.spec.d.ts} +0 -0
  40. /package/dist/services/{routeMatchRules.spec.d.ts → createUrl.spec.d.ts} +0 -0
  41. /package/dist/{services/routeMatchScore.spec.d.ts → utilities/trailingSlashes.spec.d.ts} +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Removes any trailing slashes from the path of a URL (e.g. `/foo/bar/` → `/foo/bar`). Path `/` is unchanged.
3
+ */
4
+ export declare function removeTrailingSlashesFromPath(url: string): string;
5
+ /**
6
+ * Returns true when the path part of the URL has trailing slashes that would be removed by removeTrailingSlashesFromUrl.
7
+ */
8
+ export declare function pathHasTrailingSlash(url: string): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kitbag/router",
3
3
  "private": false,
4
- "version": "0.22.0",
4
+ "version": "0.22.1",
5
5
  "license": "MIT",
6
6
  "bugs": {
7
7
  "url": "https://github.com/kitbagjs/router/issues"
@@ -17,6 +17,7 @@
17
17
  "homepage": "https://github.com/kitbagjs/router#readme",
18
18
  "scripts": {
19
19
  "build": "vite build",
20
+ "build:watch": "vite build --watch --minify=false",
20
21
  "dev": "vite build --watch --minify=false",
21
22
  "test": "vitest",
22
23
  "lint": "eslint ./src",
@@ -45,8 +46,8 @@
45
46
  "@vitejs/plugin-vue": "^6.0.3",
46
47
  "@vue/test-utils": "^2.4.6",
47
48
  "eslint": "^9.39.2",
48
- "globals": "^17.0.0",
49
- "happy-dom": "^20.3.3",
49
+ "globals": "^17.1.0",
50
+ "happy-dom": "^20.3.9",
50
51
  "typedoc": "^0.28.16",
51
52
  "typedoc-plugin-markdown": "^4.9.0",
52
53
  "typedoc-vitepress-theme": "^1.1.2",
@@ -55,8 +56,8 @@
55
56
  "vite": "^7.3.1",
56
57
  "vite-plugin-dts": "^4.5.4",
57
58
  "vitepress": "^1.6.4",
58
- "vitest": "^4.0.17",
59
- "vue-tsc": "^3.2.2",
59
+ "vitest": "^4.0.18",
60
+ "vue-tsc": "^3.2.3",
60
61
  "zod": "4.0.0"
61
62
  },
62
63
  "peerDependencies": {
@@ -1,3 +0,0 @@
1
- import { ResolvedRoute } from '../types/resolved';
2
- import { Routes } from '../types/route';
3
- export declare function createResolvedRouteForUrl(routes: Routes, url: string, state?: Partial<unknown>): ResolvedRoute | undefined;
@@ -1,4 +0,0 @@
1
- import { Route } from '../types/route';
2
- import { RouteMatchRule } from '../types/routeMatchRule';
3
- export declare const routeParamsAreValid: RouteMatchRule;
4
- export declare const getRouteParamValues: (route: Route, url: string) => Record<string, unknown>;
@@ -1,5 +0,0 @@
1
- import { RouteMatchRule } from '../types/routeMatchRule';
2
- export declare const routeHostMatches: RouteMatchRule;
3
- export declare const routePathMatches: RouteMatchRule;
4
- export declare const routeQueryMatches: RouteMatchRule;
5
- export declare const routeHashMatches: RouteMatchRule;
@@ -1,7 +0,0 @@
1
- import { Route } from '../types/route';
2
- import { QuerySource } from '../types/querySource';
3
- type RouteSortMethod = (aRoute: Route, bRoute: Route) => number;
4
- export declare function getRouteScoreSortMethod(url: string): RouteSortMethod;
5
- export declare function countExpectedPathParams(route: Route, actualPath: string): number;
6
- export declare function countExpectedQueryParams(route: Route, actualQuery: QuerySource): number;
7
- export {};
@@ -1,10 +0,0 @@
1
- import { Route } from '../types/route';
2
- import { UrlString } from '../types/urlString';
3
- import { QuerySource } from '../types/querySource';
4
- type AssembleUrlOptions = {
5
- params?: Record<string, unknown>;
6
- query?: QuerySource;
7
- hash?: string;
8
- };
9
- export declare function assembleUrl(route: Route, options?: AssembleUrlOptions): UrlString;
10
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { UrlString, UrlParts } from '../types/urlString';
2
- export declare function combineUrl(previous: UrlString | Partial<UrlParts>, updated: UrlString | Partial<UrlParts>): UrlString;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { UrlString, UrlParts } from '../types/urlString';
2
- export declare function createUrl({ protocol, host, pathname, search, searchParams, hash }: Partial<UrlParts>): UrlString;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { Route } from './route';
2
- export type RouteMatchRule = (route: Route, url: string) => boolean;