wooks 0.2.23 → 0.3.0
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/README.md +1 -1
- package/dist/index.cjs +6 -2
- package/dist/index.d.ts +6 -1
- package/dist/index.mjs +6 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ It utilizes such a technique as you can see in React Hooks or Vue Composables. I
|
|
|
23
23
|
- [@wooksjs/http-static](https://github.com/wooksjs/wooksjs/tree/main/packages/http-static) - to serve static files
|
|
24
24
|
- [@wooksjs/http-proxy](https://github.com/wooksjs/wooksjs/tree/main/packages/http-proxy) - to proxy requests
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Installation
|
|
27
27
|
|
|
28
28
|
`npm install wooks`
|
|
29
29
|
|
package/dist/index.cjs
CHANGED
|
@@ -38,10 +38,14 @@ class Wooks {
|
|
|
38
38
|
return {};
|
|
39
39
|
}
|
|
40
40
|
lookup(method, path) {
|
|
41
|
-
var _a, _b;
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
42
|
const found = this.getRouter().lookup(method, path || '');
|
|
43
43
|
eventCore.useEventContext().store('routeParams').value = ((_a = found === null || found === void 0 ? void 0 : found.ctx) === null || _a === void 0 ? void 0 : _a.params) || {};
|
|
44
|
-
return
|
|
44
|
+
return {
|
|
45
|
+
handlers: ((_b = found === null || found === void 0 ? void 0 : found.route) === null || _b === void 0 ? void 0 : _b.handlers) || null,
|
|
46
|
+
segments: ((_c = found === null || found === void 0 ? void 0 : found.route) === null || _c === void 0 ? void 0 : _c.segments) || null,
|
|
47
|
+
firstStatic: ((_d = found === null || found === void 0 ? void 0 : found.route) === null || _d === void 0 ? void 0 : _d.firstStatic) || null,
|
|
48
|
+
};
|
|
45
49
|
}
|
|
46
50
|
on(method, path, handler) {
|
|
47
51
|
return this.router.on(method, path, handler);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ProstoRouter } from '@prostojs/router';
|
|
2
2
|
import { TConsoleBase } from '@prostojs/logger';
|
|
3
3
|
import { TEventOptions } from '@wooksjs/event-core';
|
|
4
|
+
import { TParsedSegment } from '@prostojs/router';
|
|
4
5
|
import { TProstoLoggerOptions } from '@prostojs/logger';
|
|
5
6
|
import { TProstoRouterPathHandle } from '@prostojs/router';
|
|
6
7
|
|
|
@@ -24,7 +25,11 @@ export declare class Wooks {
|
|
|
24
25
|
getRouter(): ProstoRouter<TWooksHandler<unknown>>;
|
|
25
26
|
getLogger(topic: string): TConsoleBase;
|
|
26
27
|
getLoggerOptions(): TProstoLoggerOptions;
|
|
27
|
-
lookup(method: string, path: string):
|
|
28
|
+
lookup(method: string, path: string): {
|
|
29
|
+
handlers: TWooksHandler<unknown>[] | null;
|
|
30
|
+
segments: TParsedSegment[] | null;
|
|
31
|
+
firstStatic: string | null;
|
|
32
|
+
};
|
|
28
33
|
on<ResType = unknown, ParamsType = Record<string, string | string[]>>(method: string, path: string, handler: TWooksHandler<ResType>): TProstoRouterPathHandle<ParamsType>;
|
|
29
34
|
}
|
|
30
35
|
|
package/dist/index.mjs
CHANGED
|
@@ -37,10 +37,14 @@ class Wooks {
|
|
|
37
37
|
return {};
|
|
38
38
|
}
|
|
39
39
|
lookup(method, path) {
|
|
40
|
-
var _a, _b;
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
41
|
const found = this.getRouter().lookup(method, path || '');
|
|
42
42
|
useEventContext().store('routeParams').value = ((_a = found === null || found === void 0 ? void 0 : found.ctx) === null || _a === void 0 ? void 0 : _a.params) || {};
|
|
43
|
-
return
|
|
43
|
+
return {
|
|
44
|
+
handlers: ((_b = found === null || found === void 0 ? void 0 : found.route) === null || _b === void 0 ? void 0 : _b.handlers) || null,
|
|
45
|
+
segments: ((_c = found === null || found === void 0 ? void 0 : found.route) === null || _c === void 0 ? void 0 : _c.segments) || null,
|
|
46
|
+
firstStatic: ((_d = found === null || found === void 0 ? void 0 : found.route) === null || _d === void 0 ? void 0 : _d.firstStatic) || null,
|
|
47
|
+
};
|
|
44
48
|
}
|
|
45
49
|
on(method, path, handler) {
|
|
46
50
|
return this.router.on(method, path, handler);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "wooks",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@prostojs/router": "^0.1.0",
|
|
35
35
|
"@prostojs/logger": "^0.3.6",
|
|
36
|
-
"@wooksjs/event-core": "0.
|
|
36
|
+
"@wooksjs/event-core": "0.3.0"
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/wooks#readme"
|
|
39
39
|
}
|