@modern-js/plugin-bff 2.68.11 → 2.68.13

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/cjs/cli.js CHANGED
@@ -65,18 +65,17 @@ const bffPlugin = () => ({
65
65
  const { alias: resolveAlias } = modernConfig.resolve;
66
66
  const { babel } = modernConfig.tools;
67
67
  if (sourceDirs.length > 0) {
68
+ const combinedAlias = [].concat(alias !== null && alias !== void 0 ? alias : []).concat(resolveAlias !== null && resolveAlias !== void 0 ? resolveAlias : []);
68
69
  await (0, import_server_utils.compile)(appDirectory, {
69
70
  server,
70
- alias: {
71
- ...alias,
72
- ...resolveAlias
73
- },
71
+ alias: combinedAlias,
74
72
  babelConfig: babel
75
73
  }, {
76
74
  sourceDirs,
77
75
  distDir,
78
76
  tsconfigPath,
79
- moduleType
77
+ moduleType,
78
+ throwErrorInsteadOfExit: true
80
79
  });
81
80
  }
82
81
  };
@@ -78,6 +78,23 @@ class HonoAdapter {
78
78
  const handlers = this.wrapInArray(handler);
79
79
  (_this_apiServer = this.apiServer) === null || _this_apiServer === void 0 ? void 0 : _this_apiServer[method](path, ...handlers);
80
80
  });
81
+ this.apiServer.onError(async (err, c) => {
82
+ try {
83
+ const serverConfig = this.api.useConfigContext();
84
+ const onErrorHandler = serverConfig === null || serverConfig === void 0 ? void 0 : serverConfig.onError;
85
+ if (onErrorHandler) {
86
+ const result = await onErrorHandler(err, c);
87
+ if (result instanceof Response) {
88
+ return result;
89
+ }
90
+ }
91
+ } catch (configError) {
92
+ import_utils.logger.error(`Error in serverConfig.onError handler: ${configError}`);
93
+ }
94
+ return c.json({
95
+ message: (err === null || err === void 0 ? void 0 : err.message) || "[BFF] Internal Server Error"
96
+ }, (err === null || err === void 0 ? void 0 : err.status) || 500);
97
+ });
81
98
  };
82
99
  this.registerMiddleware = async (options) => {
83
100
  const { prefix } = options;
@@ -129,6 +129,9 @@ async function setPackage(files, appDirectory, relativeDistPath) {
129
129
  ]
130
130
  };
131
131
  }, {
132
+ [`${API_DIR}/*`]: [
133
+ toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
134
+ ],
132
135
  [RUNTIME_DIR]: [
133
136
  toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
134
137
  ],
@@ -148,12 +151,18 @@ async function setPackage(files, appDirectory, relativeDistPath) {
148
151
  }
149
152
  };
150
153
  }, {
154
+ [toPosixPath(`./${API_DIR}/*`)]: {
155
+ import: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.js`),
156
+ types: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
157
+ },
151
158
  [toPosixPath(`./${PLUGIN_DIR}`)]: {
159
+ import: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
152
160
  require: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
153
161
  types: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.d.ts`)
154
162
  },
155
163
  [toPosixPath(`./${RUNTIME_DIR}`)]: {
156
164
  import: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
165
+ require: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
157
166
  types: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
158
167
  }
159
168
  });
@@ -71,57 +71,49 @@ const handleResponseMeta = (c, handler) => {
71
71
  return null;
72
72
  };
73
73
  const createHonoHandler = (handler) => {
74
- return async (c, next) => {
75
- try {
76
- const input = await getHonoInput(c);
77
- if ((0, import_bff_core.isWithMetaHandler)(handler)) {
78
- try {
79
- const response = handleResponseMeta(c, handler);
80
- if (response) {
81
- return response;
82
- }
83
- if (c.finalized)
84
- return;
85
- const result = await handler(input);
86
- if (result instanceof Response) {
87
- return result;
88
- }
89
- return result && typeof result === "object" ? c.json(result) : c.body(result);
90
- } catch (error) {
91
- if (error instanceof import_bff_core.ValidationError) {
92
- c.status(error.status);
93
- return c.json({
94
- message: error.message
95
- });
96
- }
97
- throw error;
74
+ return async (c) => {
75
+ const input = await getHonoInput(c);
76
+ if ((0, import_bff_core.isWithMetaHandler)(handler)) {
77
+ try {
78
+ const response = handleResponseMeta(c, handler);
79
+ if (response) {
80
+ return response;
98
81
  }
99
- } else {
100
- var _routePath_match;
101
- const routePath = c.req.routePath;
102
- const paramNames = ((_routePath_match = routePath.match(/:\w+/g)) === null || _routePath_match === void 0 ? void 0 : _routePath_match.map((s) => s.slice(1))) || [];
103
- const params = Object.fromEntries(paramNames.map((name) => [
104
- name,
105
- input.params[name]
106
- ]));
107
- const args = Object.values(params).concat(input);
108
- try {
109
- const body = await handler(...args);
110
- if (c.finalized) {
111
- return await Promise.resolve();
112
- }
113
- if (typeof body !== "undefined") {
114
- if (body instanceof Response) {
115
- return body;
116
- }
117
- return c.json(body);
118
- }
119
- } catch {
120
- return next();
82
+ if (c.finalized)
83
+ return;
84
+ const result = await handler(input);
85
+ if (result instanceof Response) {
86
+ return result;
87
+ }
88
+ return result && typeof result === "object" ? c.json(result) : c.body(result);
89
+ } catch (error) {
90
+ if (error instanceof import_bff_core.ValidationError) {
91
+ c.status(error.status);
92
+ return c.json({
93
+ message: error.message
94
+ });
95
+ }
96
+ throw error;
97
+ }
98
+ } else {
99
+ var _routePath_match;
100
+ const routePath = c.req.routePath;
101
+ const paramNames = ((_routePath_match = routePath.match(/:\w+/g)) === null || _routePath_match === void 0 ? void 0 : _routePath_match.map((s) => s.slice(1))) || [];
102
+ const params = Object.fromEntries(paramNames.map((name) => [
103
+ name,
104
+ input.params[name]
105
+ ]));
106
+ const args = Object.values(params).concat(input);
107
+ const body = await handler(...args);
108
+ if (c.finalized) {
109
+ return await Promise.resolve();
110
+ }
111
+ if (typeof body !== "undefined") {
112
+ if (body instanceof Response) {
113
+ return body;
121
114
  }
115
+ return c.json(body);
122
116
  }
123
- } catch (error) {
124
- next();
125
117
  }
126
118
  };
127
119
  };
package/dist/esm/cli.js CHANGED
@@ -22,7 +22,7 @@ var bffPlugin = function() {
22
22
  setup: function(api) {
23
23
  var compileApi = function() {
24
24
  var _ref = _async_to_generator(function() {
25
- var _api_useAppContext, appDirectory, distDirectory, apiDirectory, sharedDirectory, moduleType, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, sourceDirs, server, alias, _modernConfig_resolve, resolveAlias, babel;
25
+ var _api_useAppContext, appDirectory, distDirectory, apiDirectory, sharedDirectory, moduleType, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, sourceDirs, server, alias, _modernConfig_resolve, resolveAlias, babel, combinedAlias;
26
26
  return _ts_generator(this, function(_state) {
27
27
  switch (_state.label) {
28
28
  case 0:
@@ -58,17 +58,19 @@ var bffPlugin = function() {
58
58
  3,
59
59
  4
60
60
  ];
61
+ combinedAlias = [].concat(alias !== null && alias !== void 0 ? alias : []).concat(resolveAlias !== null && resolveAlias !== void 0 ? resolveAlias : []);
61
62
  return [
62
63
  4,
63
64
  compile(appDirectory, {
64
65
  server,
65
- alias: _object_spread({}, alias, resolveAlias),
66
+ alias: combinedAlias,
66
67
  babelConfig: babel
67
68
  }, {
68
69
  sourceDirs,
69
70
  distDir,
70
71
  tsconfigPath,
71
- moduleType
72
+ moduleType,
73
+ throwErrorInsteadOfExit: true
72
74
  })
73
75
  ];
74
76
  case 3:
@@ -1,9 +1,10 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
2
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
3
+ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
3
4
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
4
5
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
6
  import { Hono } from "@modern-js/server-core";
6
- import { isProd } from "@modern-js/utils";
7
+ import { isProd, logger } from "@modern-js/utils";
7
8
  import createHonoRoutes from "../../utils/createHonoRoutes";
8
9
  var before = [
9
10
  "custom-server-hook",
@@ -61,6 +62,64 @@ var HonoAdapter = /* @__PURE__ */ function() {
61
62
  path
62
63
  ].concat(_to_consumable_array(handlers)));
63
64
  });
65
+ _this.apiServer.onError(function() {
66
+ var _ref = _async_to_generator(function(err, c) {
67
+ var serverConfig, onErrorHandler, result, configError;
68
+ return _ts_generator(this, function(_state2) {
69
+ switch (_state2.label) {
70
+ case 0:
71
+ _state2.trys.push([
72
+ 0,
73
+ 3,
74
+ ,
75
+ 4
76
+ ]);
77
+ serverConfig = _this.api.useConfigContext();
78
+ onErrorHandler = serverConfig === null || serverConfig === void 0 ? void 0 : serverConfig.onError;
79
+ if (!onErrorHandler)
80
+ return [
81
+ 3,
82
+ 2
83
+ ];
84
+ return [
85
+ 4,
86
+ onErrorHandler(err, c)
87
+ ];
88
+ case 1:
89
+ result = _state2.sent();
90
+ if (_instanceof(result, Response)) {
91
+ return [
92
+ 2,
93
+ result
94
+ ];
95
+ }
96
+ _state2.label = 2;
97
+ case 2:
98
+ return [
99
+ 3,
100
+ 4
101
+ ];
102
+ case 3:
103
+ configError = _state2.sent();
104
+ logger.error("Error in serverConfig.onError handler: ".concat(configError));
105
+ return [
106
+ 3,
107
+ 4
108
+ ];
109
+ case 4:
110
+ return [
111
+ 2,
112
+ c.json({
113
+ message: (err === null || err === void 0 ? void 0 : err.message) || "[BFF] Internal Server Error"
114
+ }, (err === null || err === void 0 ? void 0 : err.status) || 500)
115
+ ];
116
+ }
117
+ });
118
+ });
119
+ return function(err, c) {
120
+ return _ref.apply(this, arguments);
121
+ };
122
+ }());
64
123
  return [
65
124
  2
66
125
  ];
@@ -252,7 +252,9 @@ function _setPackage() {
252
252
  return _object_spread_props(_object_spread({}, acc), _define_property({}, toPosixPath("".concat(TYPE_PREFIX).concat(file.exportKey)), [
253
253
  typeFilePath
254
254
  ]));
255
- }, (_obj = {}, _define_property(_obj, RUNTIME_DIR, [
255
+ }, (_obj = {}, _define_property(_obj, "".concat(API_DIR, "/*"), [
256
+ toPosixPath("./".concat(relativeDistPath, "/").concat(CLIENT_DIR, "/*.d.ts"))
257
+ ]), _define_property(_obj, RUNTIME_DIR, [
256
258
  toPosixPath("./".concat(relativeDistPath, "/").concat(RUNTIME_DIR, "/index.d.ts"))
257
259
  ]), _define_property(_obj, PLUGIN_DIR, [
258
260
  toPosixPath("./".concat(relativeDistPath, "/").concat(PLUGIN_DIR, "/index.d.ts"))
@@ -265,11 +267,16 @@ function _setPackage() {
265
267
  import: jsFilePath,
266
268
  types: toPosixPath(jsFilePath.replace(/\.js$/, ".d.ts"))
267
269
  }));
268
- }, (_obj1 = {}, _define_property(_obj1, toPosixPath("./".concat(PLUGIN_DIR)), {
270
+ }, (_obj1 = {}, _define_property(_obj1, toPosixPath("./".concat(API_DIR, "/*")), {
271
+ import: toPosixPath("./".concat(relativeDistPath, "/").concat(CLIENT_DIR, "/*.js")),
272
+ types: toPosixPath("./".concat(relativeDistPath, "/").concat(CLIENT_DIR, "/*.d.ts"))
273
+ }), _define_property(_obj1, toPosixPath("./".concat(PLUGIN_DIR)), {
274
+ import: toPosixPath("./".concat(relativeDistPath, "/").concat(PLUGIN_DIR, "/index.js")),
269
275
  require: toPosixPath("./".concat(relativeDistPath, "/").concat(PLUGIN_DIR, "/index.js")),
270
276
  types: toPosixPath("./".concat(relativeDistPath, "/").concat(PLUGIN_DIR, "/index.d.ts"))
271
277
  }), _define_property(_obj1, toPosixPath("./".concat(RUNTIME_DIR)), {
272
278
  import: toPosixPath("./".concat(relativeDistPath, "/").concat(RUNTIME_DIR, "/index.js")),
279
+ require: toPosixPath("./".concat(relativeDistPath, "/").concat(RUNTIME_DIR, "/index.js")),
273
280
  types: toPosixPath("./".concat(relativeDistPath, "/").concat(RUNTIME_DIR, "/index.d.ts"))
274
281
  }), _obj1));
275
282
  mergePackageJson(packageJson, addFiles, typesVersions, exports);
@@ -79,17 +79,11 @@ var handleResponseMeta = function(c, handler) {
79
79
  };
80
80
  var createHonoHandler = function(handler) {
81
81
  return function() {
82
- var _ref = _async_to_generator(function(c, next) {
83
- var input, response, result, error, _routePath_match, routePath, paramNames, params, args, body, e, error1;
82
+ var _ref = _async_to_generator(function(c) {
83
+ var input, response, result, error, _routePath_match, routePath, paramNames, params, args, body;
84
84
  return _ts_generator(this, function(_state) {
85
85
  switch (_state.label) {
86
86
  case 0:
87
- _state.trys.push([
88
- 0,
89
- 13,
90
- ,
91
- 14
92
- ]);
93
87
  return [
94
88
  4,
95
89
  getHonoInput(c)
@@ -151,7 +145,7 @@ var createHonoHandler = function(handler) {
151
145
  case 5:
152
146
  return [
153
147
  3,
154
- 12
148
+ 10
155
149
  ];
156
150
  case 6:
157
151
  routePath = c.req.routePath;
@@ -165,35 +159,27 @@ var createHonoHandler = function(handler) {
165
159
  ];
166
160
  }));
167
161
  args = Object.values(params).concat(input);
168
- _state.label = 7;
169
- case 7:
170
- _state.trys.push([
171
- 7,
172
- 11,
173
- ,
174
- 12
175
- ]);
176
162
  return [
177
163
  4,
178
164
  handler.apply(void 0, _to_consumable_array(args))
179
165
  ];
180
- case 8:
166
+ case 7:
181
167
  body = _state.sent();
182
168
  if (!c.finalized)
183
169
  return [
184
170
  3,
185
- 10
171
+ 9
186
172
  ];
187
173
  return [
188
174
  4,
189
175
  Promise.resolve()
190
176
  ];
191
- case 9:
177
+ case 8:
192
178
  return [
193
179
  2,
194
180
  _state.sent()
195
181
  ];
196
- case 10:
182
+ case 9:
197
183
  if (typeof body !== "undefined") {
198
184
  if (_instanceof(body, Response)) {
199
185
  return [
@@ -206,36 +192,15 @@ var createHonoHandler = function(handler) {
206
192
  c.json(body)
207
193
  ];
208
194
  }
209
- return [
210
- 3,
211
- 12
212
- ];
213
- case 11:
214
- e = _state.sent();
215
- return [
216
- 2,
217
- next()
218
- ];
219
- case 12:
220
- return [
221
- 3,
222
- 14
223
- ];
224
- case 13:
225
- error1 = _state.sent();
226
- next();
227
- return [
228
- 3,
229
- 14
230
- ];
231
- case 14:
195
+ _state.label = 10;
196
+ case 10:
232
197
  return [
233
198
  2
234
199
  ];
235
200
  }
236
201
  });
237
202
  });
238
- return function(c, next) {
203
+ return function(c) {
239
204
  return _ref.apply(this, arguments);
240
205
  };
241
206
  }();
@@ -31,18 +31,17 @@ const bffPlugin = () => ({
31
31
  const { alias: resolveAlias } = modernConfig.resolve;
32
32
  const { babel } = modernConfig.tools;
33
33
  if (sourceDirs.length > 0) {
34
+ const combinedAlias = [].concat(alias !== null && alias !== void 0 ? alias : []).concat(resolveAlias !== null && resolveAlias !== void 0 ? resolveAlias : []);
34
35
  await compile(appDirectory, {
35
36
  server,
36
- alias: {
37
- ...alias,
38
- ...resolveAlias
39
- },
37
+ alias: combinedAlias,
40
38
  babelConfig: babel
41
39
  }, {
42
40
  sourceDirs,
43
41
  distDir,
44
42
  tsconfigPath,
45
- moduleType
43
+ moduleType,
44
+ throwErrorInsteadOfExit: true
46
45
  });
47
46
  }
48
47
  };
@@ -1,5 +1,5 @@
1
1
  import { Hono } from "@modern-js/server-core";
2
- import { isProd } from "@modern-js/utils";
2
+ import { isProd, logger } from "@modern-js/utils";
3
3
  import createHonoRoutes from "../../utils/createHonoRoutes";
4
4
  const before = [
5
5
  "custom-server-hook",
@@ -45,6 +45,23 @@ class HonoAdapter {
45
45
  const handlers = this.wrapInArray(handler);
46
46
  (_this_apiServer = this.apiServer) === null || _this_apiServer === void 0 ? void 0 : _this_apiServer[method](path, ...handlers);
47
47
  });
48
+ this.apiServer.onError(async (err, c) => {
49
+ try {
50
+ const serverConfig = this.api.useConfigContext();
51
+ const onErrorHandler = serverConfig === null || serverConfig === void 0 ? void 0 : serverConfig.onError;
52
+ if (onErrorHandler) {
53
+ const result = await onErrorHandler(err, c);
54
+ if (result instanceof Response) {
55
+ return result;
56
+ }
57
+ }
58
+ } catch (configError) {
59
+ logger.error(`Error in serverConfig.onError handler: ${configError}`);
60
+ }
61
+ return c.json({
62
+ message: (err === null || err === void 0 ? void 0 : err.message) || "[BFF] Internal Server Error"
63
+ }, (err === null || err === void 0 ? void 0 : err.status) || 500);
64
+ });
48
65
  };
49
66
  this.registerMiddleware = async (options) => {
50
67
  const { prefix } = options;
@@ -94,6 +94,9 @@ async function setPackage(files, appDirectory, relativeDistPath) {
94
94
  ]
95
95
  };
96
96
  }, {
97
+ [`${API_DIR}/*`]: [
98
+ toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
99
+ ],
97
100
  [RUNTIME_DIR]: [
98
101
  toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
99
102
  ],
@@ -113,12 +116,18 @@ async function setPackage(files, appDirectory, relativeDistPath) {
113
116
  }
114
117
  };
115
118
  }, {
119
+ [toPosixPath(`./${API_DIR}/*`)]: {
120
+ import: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.js`),
121
+ types: toPosixPath(`./${relativeDistPath}/${CLIENT_DIR}/*.d.ts`)
122
+ },
116
123
  [toPosixPath(`./${PLUGIN_DIR}`)]: {
124
+ import: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
117
125
  require: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.js`),
118
126
  types: toPosixPath(`./${relativeDistPath}/${PLUGIN_DIR}/index.d.ts`)
119
127
  },
120
128
  [toPosixPath(`./${RUNTIME_DIR}`)]: {
121
129
  import: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
130
+ require: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.js`),
122
131
  types: toPosixPath(`./${relativeDistPath}/${RUNTIME_DIR}/index.d.ts`)
123
132
  }
124
133
  });
@@ -37,57 +37,49 @@ const handleResponseMeta = (c, handler) => {
37
37
  return null;
38
38
  };
39
39
  const createHonoHandler = (handler) => {
40
- return async (c, next) => {
41
- try {
42
- const input = await getHonoInput(c);
43
- if (isWithMetaHandler(handler)) {
44
- try {
45
- const response = handleResponseMeta(c, handler);
46
- if (response) {
47
- return response;
48
- }
49
- if (c.finalized)
50
- return;
51
- const result = await handler(input);
52
- if (result instanceof Response) {
53
- return result;
54
- }
55
- return result && typeof result === "object" ? c.json(result) : c.body(result);
56
- } catch (error) {
57
- if (error instanceof ValidationError) {
58
- c.status(error.status);
59
- return c.json({
60
- message: error.message
61
- });
62
- }
63
- throw error;
40
+ return async (c) => {
41
+ const input = await getHonoInput(c);
42
+ if (isWithMetaHandler(handler)) {
43
+ try {
44
+ const response = handleResponseMeta(c, handler);
45
+ if (response) {
46
+ return response;
64
47
  }
65
- } else {
66
- var _routePath_match;
67
- const routePath = c.req.routePath;
68
- const paramNames = ((_routePath_match = routePath.match(/:\w+/g)) === null || _routePath_match === void 0 ? void 0 : _routePath_match.map((s) => s.slice(1))) || [];
69
- const params = Object.fromEntries(paramNames.map((name) => [
70
- name,
71
- input.params[name]
72
- ]));
73
- const args = Object.values(params).concat(input);
74
- try {
75
- const body = await handler(...args);
76
- if (c.finalized) {
77
- return await Promise.resolve();
78
- }
79
- if (typeof body !== "undefined") {
80
- if (body instanceof Response) {
81
- return body;
82
- }
83
- return c.json(body);
84
- }
85
- } catch {
86
- return next();
48
+ if (c.finalized)
49
+ return;
50
+ const result = await handler(input);
51
+ if (result instanceof Response) {
52
+ return result;
53
+ }
54
+ return result && typeof result === "object" ? c.json(result) : c.body(result);
55
+ } catch (error) {
56
+ if (error instanceof ValidationError) {
57
+ c.status(error.status);
58
+ return c.json({
59
+ message: error.message
60
+ });
61
+ }
62
+ throw error;
63
+ }
64
+ } else {
65
+ var _routePath_match;
66
+ const routePath = c.req.routePath;
67
+ const paramNames = ((_routePath_match = routePath.match(/:\w+/g)) === null || _routePath_match === void 0 ? void 0 : _routePath_match.map((s) => s.slice(1))) || [];
68
+ const params = Object.fromEntries(paramNames.map((name) => [
69
+ name,
70
+ input.params[name]
71
+ ]));
72
+ const args = Object.values(params).concat(input);
73
+ const body = await handler(...args);
74
+ if (c.finalized) {
75
+ return await Promise.resolve();
76
+ }
77
+ if (typeof body !== "undefined") {
78
+ if (body instanceof Response) {
79
+ return body;
87
80
  }
81
+ return c.json(body);
88
82
  }
89
- } catch (error) {
90
- next();
91
83
  }
92
84
  };
93
85
  };
@@ -1,10 +1,10 @@
1
1
  import type { APIHandlerInfo } from '@modern-js/bff-core';
2
- import type { Context, Next } from '@modern-js/server-core';
2
+ import type { Context } from '@modern-js/server-core';
3
3
  type Handler = APIHandlerInfo['handler'];
4
4
  declare const createHonoRoutes: (handlerInfos?: APIHandlerInfo[]) => {
5
5
  method: any;
6
6
  path: string;
7
- handler: any[] | ((c: Context, next: Next) => Promise<void | Response>);
7
+ handler: any[] | ((c: Context) => Promise<void | Response>);
8
8
  }[];
9
- export declare const createHonoHandler: (handler: Handler) => (c: Context, next: Next) => Promise<void | Response>;
9
+ export declare const createHonoHandler: (handler: Handler) => (c: Context) => Promise<void | Response>;
10
10
  export default createHonoRoutes;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.68.11",
18
+ "version": "2.68.13",
19
19
  "jsnext:source": "./src/cli.ts",
20
20
  "types": "./dist/types/cli.d.ts",
21
21
  "main": "./dist/cjs/cli.js",
@@ -76,13 +76,14 @@
76
76
  "@babel/core": "^7.26.0",
77
77
  "@swc/helpers": "^0.5.17",
78
78
  "type-is": "^1.6.18",
79
- "@modern-js/bff-core": "2.68.11",
80
- "@modern-js/create-request": "2.68.11",
81
- "@modern-js/server-core": "2.68.11",
82
- "@modern-js/server-utils": "2.68.11",
83
- "@modern-js/utils": "2.68.11"
79
+ "@modern-js/bff-core": "2.68.13",
80
+ "@modern-js/create-request": "2.68.13",
81
+ "@modern-js/server-core": "2.68.13",
82
+ "@modern-js/server-utils": "2.68.13",
83
+ "@modern-js/utils": "2.68.13"
84
84
  },
85
85
  "devDependencies": {
86
+ "@rsbuild/core": "1.5.6",
86
87
  "@types/babel__core": "^7.20.5",
87
88
  "@types/jest": "^29",
88
89
  "@types/node": "^18",
@@ -91,14 +92,14 @@
91
92
  "memfs": "^3.5.3",
92
93
  "ts-jest": "^29.1.0",
93
94
  "typescript": "^5",
94
- "webpack": "^5.101.0",
95
+ "webpack": "^5.101.3",
95
96
  "zod": "^3.22.3",
96
- "@modern-js/app-tools": "2.68.11",
97
- "@modern-js/bff-runtime": "2.68.11",
98
- "@modern-js/core": "2.68.11",
99
- "@modern-js/plugin-v2": "2.68.11",
100
- "@modern-js/types": "2.68.11",
101
- "@modern-js/runtime": "2.68.11",
97
+ "@modern-js/app-tools": "2.68.13",
98
+ "@modern-js/bff-runtime": "2.68.13",
99
+ "@modern-js/core": "2.68.13",
100
+ "@modern-js/plugin-v2": "2.68.13",
101
+ "@modern-js/runtime": "2.68.13",
102
+ "@modern-js/types": "2.68.13",
102
103
  "@scripts/build": "2.66.0",
103
104
  "@scripts/jest-config": "2.66.0"
104
105
  },