@waline/vercel 1.31.1 → 1.31.2
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/package.json +1 -1
- package/src/config/config.js +1 -1
- package/src/controller/rest.js +3 -2
- package/src/extend/think.js +11 -7
package/package.json
CHANGED
package/src/config/config.js
CHANGED
package/src/controller/rest.js
CHANGED
|
@@ -54,12 +54,13 @@ module.exports = class extends think.Controller {
|
|
|
54
54
|
plugins.unshift(fn);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
for(let i = 0; i < plugins.length; i++) {
|
|
57
|
+
for (let i = 0; i < plugins.length; i++) {
|
|
58
58
|
if (!think.isFunction(plugins[i])) {
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
const resp = await plugins[i].call(this, ...args);
|
|
63
|
+
|
|
63
64
|
if (resp) {
|
|
64
65
|
return resp;
|
|
65
66
|
}
|
package/src/extend/think.js
CHANGED
|
@@ -120,16 +120,16 @@ module.exports = {
|
|
|
120
120
|
if (!think.isArray(plugins)) {
|
|
121
121
|
return fns;
|
|
122
122
|
}
|
|
123
|
-
|
|
124
123
|
|
|
125
124
|
for (let i = 0; i < plugins.length; i++) {
|
|
126
125
|
const plugin = plugins[i];
|
|
127
|
-
|
|
126
|
+
|
|
128
127
|
if (!plugin || !plugin[type]) {
|
|
129
128
|
continue;
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
const res = callback(plugin[type]);
|
|
132
|
+
|
|
133
133
|
if (!res) {
|
|
134
134
|
continue;
|
|
135
135
|
}
|
|
@@ -144,15 +144,19 @@ module.exports = {
|
|
|
144
144
|
if (think.isFunction(middleware)) {
|
|
145
145
|
return middleware;
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
if (think.isArray(middleware)) {
|
|
149
|
-
|
|
149
|
+
return middleware.filter((m) => think.isFunction(m));
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
return middlewares.flat();
|
|
154
154
|
},
|
|
155
155
|
getPluginHook(hookName) {
|
|
156
|
-
return think
|
|
157
|
-
|
|
156
|
+
return think
|
|
157
|
+
.pluginMap('hooks', (hook) =>
|
|
158
|
+
think.isFunction(hook[hookName]) ? hook[hookName] : undefined
|
|
159
|
+
)
|
|
160
|
+
.filter((v) => v);
|
|
161
|
+
},
|
|
158
162
|
};
|