@esportsplus/routing 0.0.33 → 0.0.34

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.
@@ -1,10 +1,15 @@
1
- import { Router } from './types';
1
+ import { Scheduler } from '@esportsplus/reactivity';
2
+ import { Middleware, Next, NeverAsync, Request, Route, Router } from './types';
2
3
  declare function back(): void;
3
4
  declare function forward(): void;
4
5
  declare const _default: <T>(instance?: Router<T> | undefined) => {
5
6
  back: typeof back;
6
7
  forward: typeof forward;
7
- middleware: void;
8
+ middleware: {
9
+ (...middleware: Middleware<T>[]): () => NeverAsync<T>;
10
+ dispatch(request: Request<T>): NeverAsync<T>;
11
+ match(fallback: Route<T>, scheduler: Scheduler, subdomain?: string | undefined): (request: Request<T>, next: Next<T>) => import("@esportsplus/template/build/types").Template;
12
+ };
8
13
  redirect: (path: string, values?: unknown[]) => void;
9
14
  router: Router<T>;
10
15
  uri: (path: string, values?: unknown[]) => string;
package/build/browser.js CHANGED
@@ -74,6 +74,7 @@ function middleware(request, router) {
74
74
  }}`;
75
75
  };
76
76
  };
77
+ return host;
77
78
  }
78
79
  function normalize(uri) {
79
80
  if (uri[0] === '/') {
package/package.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "prepublishOnly": "npm run build"
19
19
  },
20
20
  "types": "./build/index.d.ts",
21
- "version": "0.0.33"
21
+ "version": "0.0.34"
22
22
  }
package/src/browser.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { effect, reactive, root, Scheduler } from '@esportsplus/reactivity';
2
2
  import { html } from '@esportsplus/template';
3
- import { Middleware, Next, Request, Route, Router } from './types';
3
+ import { Middleware, Next, NeverAsync, Request, Route, Router } from './types';
4
4
  import pipeline from '@esportsplus/pipeline';
5
5
  import factory from './router';
6
6
 
@@ -55,7 +55,7 @@ function middleware<T>(request: Request<T>, router: Router<T>) {
55
55
  return () => instance(request);
56
56
  };
57
57
 
58
- host.dispatch = (request: Request<T>) => {
58
+ host.dispatch = (request: Request<T>): NeverAsync<T> => {
59
59
  let { route } = request.data;
60
60
 
61
61
  if (route === undefined) {
@@ -97,6 +97,8 @@ function middleware<T>(request: Request<T>, router: Router<T>) {
97
97
  }}`;
98
98
  };
99
99
  };
100
+
101
+ return host;
100
102
  }
101
103
 
102
104
  function normalize(uri: string) {