@esportsplus/routing 0.0.40 → 0.0.41

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.js CHANGED
@@ -16,7 +16,6 @@ function forward() {
16
16
  }
17
17
  function href() {
18
18
  let data = new URL(window.location?.href || ''), path = data.hash ? data.hash.slice(1).split('?') : ['/', ''], request = {
19
- data: {},
20
19
  href: data.href,
21
20
  hostname: data.hostname,
22
21
  method: 'GET',
@@ -81,8 +80,10 @@ function middleware(request, router) {
81
80
  state.root.dispose();
82
81
  }
83
82
  return (0, reactivity_1.root)((root) => {
84
- request.data.parameters = state.parameters;
85
- request.data.route = state.route;
83
+ request.data = {
84
+ parameters: state.parameters,
85
+ route: state.route
86
+ };
86
87
  state.root = root;
87
88
  return next(request);
88
89
  }, scheduler);
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.40"
21
+ "version": "0.0.41"
22
22
  }
package/src/browser.ts CHANGED
@@ -16,11 +16,10 @@ function forward() {
16
16
  window.history.forward();
17
17
  }
18
18
 
19
- function href<T>(): Request<T> {
19
+ function href<T>() {
20
20
  let data = new URL( window.location?.href || '' ),
21
21
  path = data.hash ? data.hash.slice(1).split('?') : ['/', ''],
22
- request: Request<T> = {
23
- data: {},
22
+ request = {
24
23
  href: data.href,
25
24
  hostname: data.hostname,
26
25
  method: 'GET',
@@ -28,7 +27,7 @@ function href<T>(): Request<T> {
28
27
  path: path[0],
29
28
  port: data.port,
30
29
  protocol: data.protocol,
31
- query: {}
30
+ query: {} as Record<PropertyKey, unknown>
32
31
  };
33
32
 
34
33
  if (path[1]) {
@@ -37,7 +36,7 @@ function href<T>(): Request<T> {
37
36
  }
38
37
  }
39
38
 
40
- return request;
39
+ return request as Request<T>;
41
40
  }
42
41
 
43
42
  function match<T>(request: Request<T>, router: Router<T>, subdomain?: string) {
@@ -101,9 +100,10 @@ function middleware<T>(request: Request<T>, router: Router<T>) {
101
100
  }
102
101
 
103
102
  return root((root) => {
104
- request.data.parameters = state.parameters;
105
- request.data.route = state.route;
106
-
103
+ request.data = {
104
+ parameters: state.parameters,
105
+ route: state.route
106
+ };
107
107
  state.root = root;
108
108
 
109
109
  return next(request);