@esmx/router 3.0.0-rc.16 → 3.0.0-rc.18
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/history/abstract.d.ts +1 -1
- package/dist/history/base.d.ts +1 -1
- package/dist/history/html.d.ts +9 -1
- package/dist/history/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/matcher/create-matcher.mjs +3 -3
- package/dist/router.d.ts +1 -1
- package/dist/router.mjs +1 -1
- package/dist/task-pipe/task.mjs +1 -1
- package/dist/types/index.d.ts +694 -0
- package/dist/types/index.mjs +6 -0
- package/dist/utils/guards.d.ts +1 -1
- package/dist/utils/path.mjs +2 -1
- package/package.json +3 -3
- package/src/matcher/create-matcher.ts +3 -4
- package/src/task-pipe/task.ts +1 -1
- package/src/types/index.ts +858 -0
- package/src/utils/path.ts +2 -1
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@biomejs/biome": "1.9.4",
|
|
37
|
-
"@esmx/lint": "3.0.0-rc.
|
|
37
|
+
"@esmx/lint": "3.0.0-rc.18",
|
|
38
38
|
"@gez/lint": "3.0.0-rc.9",
|
|
39
39
|
"@types/node": "22.13.10",
|
|
40
40
|
"@types/url-parse": "^1.4.11",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"unbuild": "2.0.0",
|
|
45
45
|
"vitest": "3.0.8"
|
|
46
46
|
},
|
|
47
|
-
"version": "3.0.0-rc.
|
|
47
|
+
"version": "3.0.0-rc.18",
|
|
48
48
|
"type": "module",
|
|
49
49
|
"private": false,
|
|
50
50
|
"exports": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"template",
|
|
64
64
|
"public"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "79ceb323f985dd88dbd7f1349f61f341b6d522c4"
|
|
67
67
|
}
|
|
@@ -176,8 +176,7 @@ function createRouteMatches(
|
|
|
176
176
|
...createRouteMatch(
|
|
177
177
|
{
|
|
178
178
|
...route,
|
|
179
|
-
path:
|
|
180
|
-
route.path instanceof Array ? route.path : [route.path]
|
|
179
|
+
path: Array.isArray(route.path) ? route.path : [route.path]
|
|
181
180
|
},
|
|
182
181
|
parent
|
|
183
182
|
)
|
|
@@ -201,7 +200,7 @@ function createRouteMatch(
|
|
|
201
200
|
route: RouteConfig,
|
|
202
201
|
parent?: RouteMatch
|
|
203
202
|
): RouteMatch | RouteMatch[] {
|
|
204
|
-
const pathList = route.path
|
|
203
|
+
const pathList = Array.isArray(route.path) ? route.path : [route.path];
|
|
205
204
|
const routeMatches: RouteMatch[] = pathList.reduce<RouteMatch[]>(
|
|
206
205
|
(acc, item, index) => {
|
|
207
206
|
const { children } = route;
|
|
@@ -287,7 +286,7 @@ function createRouteMatch(
|
|
|
287
286
|
},
|
|
288
287
|
[]
|
|
289
288
|
);
|
|
290
|
-
return route.path
|
|
289
|
+
return Array.isArray(route.path)
|
|
291
290
|
? routeMatches
|
|
292
291
|
: routeMatches[routeMatches.length - 1];
|
|
293
292
|
}
|
package/src/task-pipe/task.ts
CHANGED
|
@@ -22,7 +22,7 @@ export class Tasks<T extends func = func> {
|
|
|
22
22
|
protected handlers: T[] = [];
|
|
23
23
|
|
|
24
24
|
public add(handler: T | T[]) {
|
|
25
|
-
const params: T[] = handler
|
|
25
|
+
const params: T[] = Array.isArray(handler) ? handler : [handler];
|
|
26
26
|
this.handlers.push(...params);
|
|
27
27
|
}
|
|
28
28
|
|