alemonjs 2.1.19 → 2.1.20
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/lib/app/define-router.js
CHANGED
|
@@ -4,13 +4,13 @@ import 'path';
|
|
|
4
4
|
import 'yaml';
|
|
5
5
|
import { showErrorModule } from '../core/utils.js';
|
|
6
6
|
|
|
7
|
-
function isPromise(value) {
|
|
8
|
-
return value !== null && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';
|
|
9
|
-
}
|
|
10
7
|
function isAsyncFunction(fn) {
|
|
11
8
|
const AsyncFunction = (async () => { }).constructor;
|
|
12
9
|
return fn instanceof AsyncFunction;
|
|
13
10
|
}
|
|
11
|
+
function isFunction(value) {
|
|
12
|
+
return isAsyncFunction(value) || typeof value === 'function' || value instanceof Function;
|
|
13
|
+
}
|
|
14
14
|
const createRouteProcessChildren = (valueEvent, select, nextCycle, callHandler) => {
|
|
15
15
|
const processChildren = (nodes, middleware, next) => {
|
|
16
16
|
if (!nodes || nodes.length === 0) {
|
|
@@ -67,7 +67,7 @@ const createRouteProcessChildren = (valueEvent, select, nextCycle, callHandler)
|
|
|
67
67
|
const currents = [];
|
|
68
68
|
for (const item of currentsAndMiddleware) {
|
|
69
69
|
const app = await item();
|
|
70
|
-
if (
|
|
70
|
+
if (isFunction(app)) {
|
|
71
71
|
currents.push(app);
|
|
72
72
|
continue;
|
|
73
73
|
}
|
|
@@ -71,9 +71,9 @@ export declare function createEvent<T extends EventKeys>(options: {
|
|
|
71
71
|
regular?: RegExp;
|
|
72
72
|
prefix?: string;
|
|
73
73
|
exact?: string;
|
|
74
|
-
}):
|
|
74
|
+
}): Events[T] & {
|
|
75
75
|
selects: boolean;
|
|
76
76
|
regular: boolean;
|
|
77
77
|
prefix: boolean;
|
|
78
78
|
exact: boolean;
|
|
79
|
-
}
|
|
79
|
+
};
|