@modern-js/plugin-express 2.67.1 → 2.67.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.
@@ -40,12 +40,17 @@ const expressPlugin = () => ({
40
40
  let bffExportsUtils;
41
41
  const { useAppContext } = api;
42
42
  const runtimeModulePath = path.resolve(__dirname, "../runtime");
43
+ const useConfig = api.useConfigContext();
44
+ const appContext = api.useAppContext();
45
+ api.setAppContext({
46
+ ...appContext,
47
+ bffRuntimeFramework: "express"
48
+ });
43
49
  return {
44
50
  config() {
45
51
  var _useConfig_bff;
46
- const appContext = useAppContext();
47
- bffExportsUtils = (0, import_utils.createRuntimeExportsUtils)(appContext.internalDirectory, "server");
48
- const useConfig = api.useConfigContext();
52
+ const appContext2 = useAppContext();
53
+ bffExportsUtils = (0, import_utils.createRuntimeExportsUtils)(appContext2.internalDirectory, "server");
49
54
  const runtimePath = process.env.NODE_ENV === "development" && !(useConfig === null || useConfig === void 0 ? void 0 : (_useConfig_bff = useConfig.bff) === null || _useConfig_bff === void 0 ? void 0 : _useConfig_bff.crossProject) ? require.resolve("@modern-js/plugin-express/runtime") : "@modern-js/plugin-express/runtime";
50
55
  return {
51
56
  source: {
@@ -199,12 +199,12 @@ var plugin_default = () => {
199
199
  (0, import_finalhandler.default)(req, res, {})(null);
200
200
  return resolve();
201
201
  };
202
- res.on("finish", (err) => {
203
- if (err) {
204
- return reject(err);
205
- }
202
+ res.on("finish", () => {
206
203
  return resolve();
207
204
  });
205
+ res.on("error", (err) => {
206
+ return reject(err);
207
+ });
208
208
  return app(req, res, handler2);
209
209
  });
210
210
  return (0, import_node.httpCallBack2HonoMid)(handler);
@@ -1,3 +1,5 @@
1
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
+ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
1
3
  import * as path from "path";
2
4
  import { createRuntimeExportsUtils } from "@modern-js/utils";
3
5
  var expressPlugin = function() {
@@ -7,12 +9,16 @@ var expressPlugin = function() {
7
9
  var bffExportsUtils;
8
10
  var useAppContext = api.useAppContext;
9
11
  var runtimeModulePath = path.resolve(__dirname, "../runtime");
12
+ var useConfig = api.useConfigContext();
13
+ var appContext = api.useAppContext();
14
+ api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
15
+ bffRuntimeFramework: "express"
16
+ }));
10
17
  return {
11
18
  config: function config() {
12
19
  var _useConfig_bff;
13
- var appContext = useAppContext();
14
- bffExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "server");
15
- var useConfig = api.useConfigContext();
20
+ var appContext2 = useAppContext();
21
+ bffExportsUtils = createRuntimeExportsUtils(appContext2.internalDirectory, "server");
16
22
  var runtimePath = process.env.NODE_ENV === "development" && !(useConfig === null || useConfig === void 0 ? void 0 : (_useConfig_bff = useConfig.bff) === null || _useConfig_bff === void 0 ? void 0 : _useConfig_bff.crossProject) ? require.resolve("@modern-js/plugin-express/runtime") : "@modern-js/plugin-express/runtime";
17
23
  return {
18
24
  source: {
@@ -465,12 +465,12 @@ function plugin_default() {
465
465
  finalhandler(req, res, {})(null);
466
466
  return resolve();
467
467
  };
468
- res.on("finish", function(err) {
469
- if (err) {
470
- return reject(err);
471
- }
468
+ res.on("finish", function() {
472
469
  return resolve();
473
470
  });
471
+ res.on("error", function(err) {
472
+ return reject(err);
473
+ });
474
474
  return app(req, res, handler2);
475
475
  });
476
476
  };
@@ -6,12 +6,17 @@ const expressPlugin = () => ({
6
6
  let bffExportsUtils;
7
7
  const { useAppContext } = api;
8
8
  const runtimeModulePath = path.resolve(__dirname, "../runtime");
9
+ const useConfig = api.useConfigContext();
10
+ const appContext = api.useAppContext();
11
+ api.setAppContext({
12
+ ...appContext,
13
+ bffRuntimeFramework: "express"
14
+ });
9
15
  return {
10
16
  config() {
11
17
  var _useConfig_bff;
12
- const appContext = useAppContext();
13
- bffExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, "server");
14
- const useConfig = api.useConfigContext();
18
+ const appContext2 = useAppContext();
19
+ bffExportsUtils = createRuntimeExportsUtils(appContext2.internalDirectory, "server");
15
20
  const runtimePath = process.env.NODE_ENV === "development" && !(useConfig === null || useConfig === void 0 ? void 0 : (_useConfig_bff = useConfig.bff) === null || _useConfig_bff === void 0 ? void 0 : _useConfig_bff.crossProject) ? require.resolve("@modern-js/plugin-express/runtime") : "@modern-js/plugin-express/runtime";
16
21
  return {
17
22
  source: {
@@ -166,12 +166,12 @@ var plugin_default = () => {
166
166
  finalhandler(req, res, {})(null);
167
167
  return resolve();
168
168
  };
169
- res.on("finish", (err) => {
170
- if (err) {
171
- return reject(err);
172
- }
169
+ res.on("finish", () => {
173
170
  return resolve();
174
171
  });
172
+ res.on("error", (err) => {
173
+ return reject(err);
174
+ });
175
175
  return app(req, res, handler2);
176
176
  });
177
177
  return httpCallBack2HonoMid(handler);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.67.1",
18
+ "version": "2.67.3",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "main": "./dist/cjs/cli/index.js",
@@ -51,11 +51,11 @@
51
51
  "formidable": "^1.2.2",
52
52
  "reflect-metadata": "^0.1.13",
53
53
  "type-is": "^1.6.18",
54
- "@modern-js/bff-core": "2.67.1",
55
- "@modern-js/bff-runtime": "2.67.1",
56
- "@modern-js/types": "2.67.1",
57
- "@modern-js/server-core": "2.67.1",
58
- "@modern-js/utils": "2.67.1"
54
+ "@modern-js/bff-core": "2.67.3",
55
+ "@modern-js/bff-runtime": "2.67.3",
56
+ "@modern-js/server-core": "2.67.3",
57
+ "@modern-js/types": "2.67.3",
58
+ "@modern-js/utils": "2.67.3"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/cookie-parser": "^1.4.2",
@@ -71,10 +71,10 @@
71
71
  "supertest": "^6.1.6",
72
72
  "typescript": "^5",
73
73
  "zod": "^3.22.3",
74
- "@modern-js/plugin-v2": "2.67.1",
75
- "@modern-js/app-tools": "2.67.1",
76
- "@modern-js/core": "2.67.1",
74
+ "@modern-js/plugin-v2": "2.67.3",
75
+ "@modern-js/app-tools": "2.67.3",
77
76
  "@scripts/build": "2.66.0",
77
+ "@modern-js/core": "2.67.3",
78
78
  "@scripts/jest-config": "2.66.0"
79
79
  },
80
80
  "peerDependencies": {