wooks 0.7.1 → 0.7.3

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/index.cjs CHANGED
@@ -77,8 +77,9 @@ var Wooks = class {
77
77
  lookup(method, path, ctx = (0, __wooksjs_event_core.current)()) {
78
78
  const found = this.getRouter().lookup(method, path || "");
79
79
  ctx.set(__wooksjs_event_core.routeParamsKey, found?.ctx?.params || {});
80
- if (found?.route?.handlers.length) (0, __wooksjs_event_core.getContextInjector)().hook(method, "Handler:routed", found.route.path);
81
- else (0, __wooksjs_event_core.getContextInjector)().hook(method, "Handler:not_found");
80
+ const ci = (0, __wooksjs_event_core.getContextInjector)();
81
+ if (found?.route?.handlers.length) ci?.hook(method, "Handler:routed", found.route.path);
82
+ else ci?.hook(method, "Handler:not_found");
82
83
  return {
83
84
  handlers: found?.route?.handlers || null,
84
85
  segments: found?.route?.segments || null,
@@ -93,11 +94,12 @@ var Wooks = class {
93
94
  lookupHandlers(method, path, ctx = (0, __wooksjs_event_core.current)()) {
94
95
  const found = this.getRouter().lookup(method, path || "");
95
96
  ctx.set(__wooksjs_event_core.routeParamsKey, found?.ctx?.params || {});
97
+ const ci = (0, __wooksjs_event_core.getContextInjector)();
96
98
  if (found?.route?.handlers.length) {
97
- (0, __wooksjs_event_core.getContextInjector)().hook(method, "Handler:routed", found.route.path);
99
+ ci?.hook(method, "Handler:routed", found.route.path);
98
100
  return found.route.handlers;
99
101
  }
100
- (0, __wooksjs_event_core.getContextInjector)().hook(method, "Handler:not_found");
102
+ ci?.hook(method, "Handler:not_found");
101
103
  return null;
102
104
  }
103
105
  /**
package/dist/index.mjs CHANGED
@@ -54,8 +54,9 @@ var Wooks = class {
54
54
  lookup(method, path, ctx = current()) {
55
55
  const found = this.getRouter().lookup(method, path || "");
56
56
  ctx.set(routeParamsKey, found?.ctx?.params || {});
57
- if (found?.route?.handlers.length) getContextInjector().hook(method, "Handler:routed", found.route.path);
58
- else getContextInjector().hook(method, "Handler:not_found");
57
+ const ci = getContextInjector();
58
+ if (found?.route?.handlers.length) ci?.hook(method, "Handler:routed", found.route.path);
59
+ else ci?.hook(method, "Handler:not_found");
59
60
  return {
60
61
  handlers: found?.route?.handlers || null,
61
62
  segments: found?.route?.segments || null,
@@ -70,11 +71,12 @@ var Wooks = class {
70
71
  lookupHandlers(method, path, ctx = current()) {
71
72
  const found = this.getRouter().lookup(method, path || "");
72
73
  ctx.set(routeParamsKey, found?.ctx?.params || {});
74
+ const ci = getContextInjector();
73
75
  if (found?.route?.handlers.length) {
74
- getContextInjector().hook(method, "Handler:routed", found.route.path);
76
+ ci?.hook(method, "Handler:routed", found.route.path);
75
77
  return found.route.handlers;
76
78
  }
77
- getContextInjector().hook(method, "Handler:not_found");
79
+ ci?.hook(method, "Handler:not_found");
78
80
  return null;
79
81
  }
80
82
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wooks",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "wooks",
5
5
  "keywords": [
6
6
  "api",
@@ -42,13 +42,13 @@
42
42
  "dependencies": {
43
43
  "@prostojs/logger": "^0.4.3",
44
44
  "@prostojs/router": "^0.3.2",
45
- "@wooksjs/event-core": "^0.7.1"
45
+ "@wooksjs/event-core": "^0.7.3"
46
46
  },
47
47
  "devDependencies": {
48
48
  "typescript": "^5.9.3",
49
49
  "vitest": "^3.2.4",
50
- "@wooksjs/http-body": "^0.7.1",
51
- "@wooksjs/event-http": "^0.7.1"
50
+ "@wooksjs/event-http": "^0.7.3",
51
+ "@wooksjs/http-body": "^0.7.3"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "rolldown -c ../../rolldown.config.mjs"