@esportsplus/routing 0.0.25 → 0.0.26
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/build/browser.d.ts +4 -1
- package/build/types.d.ts +6 -6
- package/package.json +1 -1
- package/src/browser.ts +2 -2
- package/src/types.ts +6 -7
package/build/browser.d.ts
CHANGED
|
@@ -28,7 +28,10 @@ declare const _default: <T>(instance?: Router<T> | undefined) => {
|
|
|
28
28
|
dispose: () => void;
|
|
29
29
|
reset: () => void;
|
|
30
30
|
nodes: {
|
|
31
|
-
data: import("@esportsplus/reactivity/build/signal").default<
|
|
31
|
+
data: import("@esportsplus/reactivity/build/signal").default<{
|
|
32
|
+
[x: string]: unknown;
|
|
33
|
+
[x: number]: unknown;
|
|
34
|
+
[x: symbol]: unknown;
|
|
32
35
|
parameters?: Record<PropertyKey, unknown> | undefined;
|
|
33
36
|
route?: import("./router/route").Route<T> | undefined;
|
|
34
37
|
}>;
|
package/build/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Prettify } from '@esportsplus/typescript';
|
|
1
2
|
import { Next as N, Stage } from '@esportsplus/pipeline';
|
|
2
3
|
import { Route, Router } from './router';
|
|
3
|
-
type Middleware<T> = Stage<Request<T>,
|
|
4
|
-
type Next<T> = N<Request<T>,
|
|
4
|
+
type Middleware<T> = Stage<Request<T>, T>;
|
|
5
|
+
type Next<T> = N<Request<T>, T>;
|
|
5
6
|
type Options<T> = {
|
|
6
7
|
middleware?: Middleware<T>[];
|
|
7
8
|
name?: string;
|
|
@@ -10,7 +11,7 @@ type Options<T> = {
|
|
|
10
11
|
subdomain?: string;
|
|
11
12
|
};
|
|
12
13
|
type Request<T> = {
|
|
13
|
-
data: Record<PropertyKey, unknown> & ReturnType<Router<T>['match']
|
|
14
|
+
data: Prettify<Record<PropertyKey, unknown> & ReturnType<Router<T>['match']>>;
|
|
14
15
|
href: string;
|
|
15
16
|
hostname: string;
|
|
16
17
|
method: string;
|
|
@@ -21,6 +22,5 @@ type Request<T> = {
|
|
|
21
22
|
query: Record<string, unknown>;
|
|
22
23
|
subdomain?: string;
|
|
23
24
|
};
|
|
24
|
-
type Responder<T> = (request: Request<T>) =>
|
|
25
|
-
|
|
26
|
-
export { Middleware, Next, Options, Request, Responder, Response, Route, Router };
|
|
25
|
+
type Responder<T> = (request: Request<T>) => T;
|
|
26
|
+
export { Middleware, Next, Options, Request, Responder, Route, Router };
|
package/package.json
CHANGED
package/src/browser.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
-
import { Middleware, Request,
|
|
2
|
+
import { Middleware, Request, Router } from './types';
|
|
3
3
|
import pipeline from '@esportsplus/pipeline';
|
|
4
4
|
import factory from './router';
|
|
5
5
|
|
|
@@ -70,7 +70,7 @@ export default <T>(instance?: Router<T>) => {
|
|
|
70
70
|
back,
|
|
71
71
|
forward,
|
|
72
72
|
middleware: (...middleware: Middleware<T>[]) => {
|
|
73
|
-
let instance = pipeline
|
|
73
|
+
let instance = pipeline(...middleware);
|
|
74
74
|
|
|
75
75
|
return {
|
|
76
76
|
pipeline: () => instance(state),
|
package/src/types.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Prettify } from '@esportsplus/typescript';
|
|
1
2
|
import { Next as N, Stage } from '@esportsplus/pipeline';
|
|
2
3
|
import { Route, Router } from './router';
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
type Middleware<T> = Stage<Request<T>,
|
|
6
|
+
type Middleware<T> = Stage<Request<T>, T>;
|
|
6
7
|
|
|
7
|
-
type Next<T> = N<Request<T>,
|
|
8
|
+
type Next<T> = N<Request<T>, T>;
|
|
8
9
|
|
|
9
10
|
type Options<T> = {
|
|
10
11
|
middleware?: Middleware<T>[];
|
|
@@ -15,7 +16,7 @@ type Options<T> = {
|
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
type Request<T> = {
|
|
18
|
-
data: Record<PropertyKey, unknown> & ReturnType<Router<T>['match']
|
|
19
|
+
data: Prettify<Record<PropertyKey, unknown> & ReturnType<Router<T>['match']>>;
|
|
19
20
|
href: string;
|
|
20
21
|
hostname: string;
|
|
21
22
|
method: string;
|
|
@@ -27,9 +28,7 @@ type Request<T> = {
|
|
|
27
28
|
subdomain?: string;
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
type Responder<T> = (request: Request<T>) =>
|
|
31
|
+
type Responder<T> = (request: Request<T>) => T;
|
|
31
32
|
|
|
32
|
-
type Response<T> = T;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
export { Middleware, Next, Options, Request, Responder, Response, Route, Router };
|
|
34
|
+
export { Middleware, Next, Options, Request, Responder, Route, Router };
|