@modern-js/plugin-bff 2.57.1-alpha.0 → 2.58.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/dist/cjs/cli.js +15 -5
- package/dist/cjs/server.js +6 -6
- package/dist/esm/cli.js +29 -21
- package/dist/esm/server.js +44 -91
- package/dist/esm-node/cli.js +16 -6
- package/dist/esm-node/server.js +6 -6
- package/package.json +13 -14
package/dist/cjs/cli.js
CHANGED
|
@@ -36,11 +36,13 @@ var import_path = __toESM(require("path"));
|
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
37
|
var import_server_utils = require("@modern-js/server-utils");
|
|
38
38
|
var import_bff_core = require("@modern-js/bff-core");
|
|
39
|
+
var import_helper = require("./helper");
|
|
39
40
|
const DEFAULT_API_PREFIX = "/api";
|
|
40
41
|
const TS_CONFIG_FILENAME = "tsconfig.json";
|
|
41
42
|
const bffPlugin = () => ({
|
|
42
43
|
name: "@modern-js/plugin-bff",
|
|
43
44
|
setup: (api) => {
|
|
45
|
+
let unRegisterResolveRuntimePath = null;
|
|
44
46
|
return {
|
|
45
47
|
config() {
|
|
46
48
|
return {
|
|
@@ -127,18 +129,27 @@ const bffPlugin = () => ({
|
|
|
127
129
|
plugins
|
|
128
130
|
};
|
|
129
131
|
},
|
|
132
|
+
async beforeBuild() {
|
|
133
|
+
if ((0, import_utils.isProd)()) {
|
|
134
|
+
const { internalDirectory } = api.useAppContext();
|
|
135
|
+
unRegisterResolveRuntimePath = (0, import_helper.registerModernRuntimePath)(internalDirectory);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
130
138
|
async afterBuild() {
|
|
131
|
-
|
|
139
|
+
if (unRegisterResolveRuntimePath) {
|
|
140
|
+
unRegisterResolveRuntimePath();
|
|
141
|
+
}
|
|
142
|
+
const { appDirectory, distDirectory, apiDirectory, sharedDirectory } = api.useAppContext();
|
|
132
143
|
const modernConfig = api.useResolvedConfigContext();
|
|
133
144
|
const distDir = import_path.default.resolve(distDirectory);
|
|
134
145
|
const apiDir = apiDirectory || import_path.default.resolve(appDirectory, import_utils.API_DIR);
|
|
135
146
|
const sharedDir = sharedDirectory || import_path.default.resolve(appDirectory, import_utils.SHARED_DIR);
|
|
136
147
|
const tsconfigPath = import_path.default.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
137
148
|
const sourceDirs = [];
|
|
138
|
-
if (
|
|
149
|
+
if (import_utils.fs.existsSync(apiDir)) {
|
|
139
150
|
sourceDirs.push(apiDir);
|
|
140
151
|
}
|
|
141
|
-
if (
|
|
152
|
+
if (import_utils.fs.existsSync(sharedDir)) {
|
|
142
153
|
sourceDirs.push(sharedDir);
|
|
143
154
|
}
|
|
144
155
|
const { server } = modernConfig;
|
|
@@ -152,8 +163,7 @@ const bffPlugin = () => ({
|
|
|
152
163
|
}, {
|
|
153
164
|
sourceDirs,
|
|
154
165
|
distDir,
|
|
155
|
-
tsconfigPath
|
|
156
|
-
moduleType
|
|
166
|
+
tsconfigPath
|
|
157
167
|
});
|
|
158
168
|
}
|
|
159
169
|
}
|
package/dist/cjs/server.js
CHANGED
|
@@ -63,7 +63,7 @@ var server_default = () => ({
|
|
|
63
63
|
const root = (0, import_utils.isProd)() ? distDirectory : appDirectory;
|
|
64
64
|
const apiPath = import_path.default.resolve(root || process.cwd(), import_utils.API_DIR);
|
|
65
65
|
apiAppPath = import_path.default.resolve(apiPath, import_constants.API_APP_NAME);
|
|
66
|
-
const apiMod =
|
|
66
|
+
const apiMod = (0, import_utils.requireExistModule)(apiAppPath);
|
|
67
67
|
if (apiMod && typeof apiMod === "function") {
|
|
68
68
|
apiMod(transformAPI);
|
|
69
69
|
}
|
|
@@ -115,10 +115,10 @@ var server_default = () => ({
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
|
|
118
|
+
reset({ event }) {
|
|
119
119
|
storage.reset();
|
|
120
120
|
const appContext = api.useAppContext();
|
|
121
|
-
const newApiModule =
|
|
121
|
+
const newApiModule = (0, import_utils.requireExistModule)(apiAppPath);
|
|
122
122
|
if (newApiModule && typeof newApiModule === "function") {
|
|
123
123
|
newApiModule(transformAPI);
|
|
124
124
|
}
|
|
@@ -128,7 +128,7 @@ var server_default = () => ({
|
|
|
128
128
|
apiMiddlewares: middlewares
|
|
129
129
|
});
|
|
130
130
|
if (event.type === "file-change") {
|
|
131
|
-
const apiHandlerInfos =
|
|
131
|
+
const apiHandlerInfos = apiRouter.getApiHandlers();
|
|
132
132
|
const appContext2 = api.useAppContext();
|
|
133
133
|
api.setAppContext({
|
|
134
134
|
...appContext2,
|
|
@@ -136,7 +136,7 @@ var server_default = () => ({
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
|
-
|
|
139
|
+
prepareApiServer(props, next) {
|
|
140
140
|
const { pwd, prefix, httpMethodDecider } = props;
|
|
141
141
|
const apiDir = import_path.default.resolve(pwd, import_utils.API_DIR);
|
|
142
142
|
const appContext = api.useAppContext();
|
|
@@ -149,7 +149,7 @@ var server_default = () => ({
|
|
|
149
149
|
httpMethodDecider
|
|
150
150
|
});
|
|
151
151
|
const apiMode = apiRouter.getApiMode();
|
|
152
|
-
const apiHandlerInfos =
|
|
152
|
+
const apiHandlerInfos = apiRouter.getApiHandlers();
|
|
153
153
|
api.setAppContext({
|
|
154
154
|
...appContext,
|
|
155
155
|
apiRouter,
|
package/dist/esm/cli.js
CHANGED
|
@@ -4,15 +4,17 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
4
4
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
5
5
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
6
6
|
import path from "path";
|
|
7
|
-
import { fs, API_DIR, normalizeOutputPath, SHARED_DIR } from "@modern-js/utils";
|
|
7
|
+
import { fs, API_DIR, normalizeOutputPath, SHARED_DIR, isProd } from "@modern-js/utils";
|
|
8
8
|
import { compile } from "@modern-js/server-utils";
|
|
9
9
|
import { ApiRouter } from "@modern-js/bff-core";
|
|
10
|
+
import { registerModernRuntimePath } from "./helper";
|
|
10
11
|
var DEFAULT_API_PREFIX = "/api";
|
|
11
12
|
var TS_CONFIG_FILENAME = "tsconfig.json";
|
|
12
13
|
var bffPlugin = function() {
|
|
13
14
|
return {
|
|
14
15
|
name: "@modern-js/plugin-bff",
|
|
15
16
|
setup: function(api) {
|
|
17
|
+
var unRegisterResolveRuntimePath = null;
|
|
16
18
|
return {
|
|
17
19
|
config: function config() {
|
|
18
20
|
return {
|
|
@@ -104,33 +106,40 @@ var bffPlugin = function() {
|
|
|
104
106
|
plugins
|
|
105
107
|
};
|
|
106
108
|
},
|
|
109
|
+
beforeBuild: function beforeBuild() {
|
|
110
|
+
return _async_to_generator(function() {
|
|
111
|
+
var internalDirectory;
|
|
112
|
+
return _ts_generator(this, function(_state) {
|
|
113
|
+
if (isProd()) {
|
|
114
|
+
internalDirectory = api.useAppContext().internalDirectory;
|
|
115
|
+
unRegisterResolveRuntimePath = registerModernRuntimePath(internalDirectory);
|
|
116
|
+
}
|
|
117
|
+
return [
|
|
118
|
+
2
|
|
119
|
+
];
|
|
120
|
+
});
|
|
121
|
+
})();
|
|
122
|
+
},
|
|
107
123
|
afterBuild: function afterBuild() {
|
|
108
124
|
return _async_to_generator(function() {
|
|
109
|
-
var _api_useAppContext, appDirectory, distDirectory, apiDirectory, sharedDirectory,
|
|
125
|
+
var _api_useAppContext, appDirectory, distDirectory, apiDirectory, sharedDirectory, modernConfig, distDir, apiDir, sharedDir, tsconfigPath, sourceDirs, server, alias, babel;
|
|
110
126
|
return _ts_generator(this, function(_state) {
|
|
111
127
|
switch (_state.label) {
|
|
112
128
|
case 0:
|
|
113
|
-
|
|
129
|
+
if (unRegisterResolveRuntimePath) {
|
|
130
|
+
unRegisterResolveRuntimePath();
|
|
131
|
+
}
|
|
132
|
+
_api_useAppContext = api.useAppContext(), appDirectory = _api_useAppContext.appDirectory, distDirectory = _api_useAppContext.distDirectory, apiDirectory = _api_useAppContext.apiDirectory, sharedDirectory = _api_useAppContext.sharedDirectory;
|
|
114
133
|
modernConfig = api.useResolvedConfigContext();
|
|
115
134
|
distDir = path.resolve(distDirectory);
|
|
116
135
|
apiDir = apiDirectory || path.resolve(appDirectory, API_DIR);
|
|
117
136
|
sharedDir = sharedDirectory || path.resolve(appDirectory, SHARED_DIR);
|
|
118
137
|
tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
119
138
|
sourceDirs = [];
|
|
120
|
-
|
|
121
|
-
4,
|
|
122
|
-
fs.pathExists(apiDir)
|
|
123
|
-
];
|
|
124
|
-
case 1:
|
|
125
|
-
if (_state.sent()) {
|
|
139
|
+
if (fs.existsSync(apiDir)) {
|
|
126
140
|
sourceDirs.push(apiDir);
|
|
127
141
|
}
|
|
128
|
-
|
|
129
|
-
4,
|
|
130
|
-
fs.pathExists(sharedDir)
|
|
131
|
-
];
|
|
132
|
-
case 2:
|
|
133
|
-
if (_state.sent()) {
|
|
142
|
+
if (fs.existsSync(sharedDir)) {
|
|
134
143
|
sourceDirs.push(sharedDir);
|
|
135
144
|
}
|
|
136
145
|
server = modernConfig.server;
|
|
@@ -139,7 +148,7 @@ var bffPlugin = function() {
|
|
|
139
148
|
if (!(sourceDirs.length > 0))
|
|
140
149
|
return [
|
|
141
150
|
3,
|
|
142
|
-
|
|
151
|
+
2
|
|
143
152
|
];
|
|
144
153
|
return [
|
|
145
154
|
4,
|
|
@@ -150,14 +159,13 @@ var bffPlugin = function() {
|
|
|
150
159
|
}, {
|
|
151
160
|
sourceDirs,
|
|
152
161
|
distDir,
|
|
153
|
-
tsconfigPath
|
|
154
|
-
moduleType
|
|
162
|
+
tsconfigPath
|
|
155
163
|
})
|
|
156
164
|
];
|
|
157
|
-
case
|
|
165
|
+
case 1:
|
|
158
166
|
_state.sent();
|
|
159
|
-
_state.label =
|
|
160
|
-
case
|
|
167
|
+
_state.label = 2;
|
|
168
|
+
case 2:
|
|
161
169
|
return [
|
|
162
170
|
2
|
|
163
171
|
];
|
package/dist/esm/server.js
CHANGED
|
@@ -46,12 +46,7 @@ function server_default() {
|
|
|
46
46
|
root = isProd() ? distDirectory : appDirectory;
|
|
47
47
|
apiPath = path.resolve(root || process.cwd(), API_DIR);
|
|
48
48
|
apiAppPath = path.resolve(apiPath, API_APP_NAME);
|
|
49
|
-
|
|
50
|
-
4,
|
|
51
|
-
requireExistModule(apiAppPath)
|
|
52
|
-
];
|
|
53
|
-
case 1:
|
|
54
|
-
apiMod = _state.sent();
|
|
49
|
+
apiMod = requireExistModule(apiAppPath);
|
|
55
50
|
if (apiMod && typeof apiMod === "function") {
|
|
56
51
|
apiMod(transformAPI);
|
|
57
52
|
}
|
|
@@ -68,12 +63,12 @@ function server_default() {
|
|
|
68
63
|
4,
|
|
69
64
|
isWebOnly()
|
|
70
65
|
];
|
|
71
|
-
case
|
|
66
|
+
case 1:
|
|
72
67
|
webOnly = _state.sent();
|
|
73
68
|
if (!webOnly)
|
|
74
69
|
return [
|
|
75
70
|
3,
|
|
76
|
-
|
|
71
|
+
2
|
|
77
72
|
];
|
|
78
73
|
handler = function() {
|
|
79
74
|
var _ref = _async_to_generator(function(c, next) {
|
|
@@ -99,9 +94,9 @@ function server_default() {
|
|
|
99
94
|
}();
|
|
100
95
|
return [
|
|
101
96
|
3,
|
|
102
|
-
|
|
97
|
+
4
|
|
103
98
|
];
|
|
104
|
-
case
|
|
99
|
+
case 2:
|
|
105
100
|
runner = api.useHookRunners();
|
|
106
101
|
renderHandler = enableHandleWeb ? render : null;
|
|
107
102
|
return [
|
|
@@ -117,10 +112,10 @@ function server_default() {
|
|
|
117
112
|
}
|
|
118
113
|
})
|
|
119
114
|
];
|
|
120
|
-
case
|
|
115
|
+
case 3:
|
|
121
116
|
handler = _state.sent();
|
|
122
|
-
_state.label =
|
|
123
|
-
case
|
|
117
|
+
_state.label = 4;
|
|
118
|
+
case 4:
|
|
124
119
|
if (handler) {
|
|
125
120
|
globalMiddlewares.push({
|
|
126
121
|
name: "bind-bff",
|
|
@@ -148,86 +143,44 @@ function server_default() {
|
|
|
148
143
|
},
|
|
149
144
|
reset: function reset(param) {
|
|
150
145
|
var event = param.event;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
|
|
169
|
-
apiMiddlewares: middlewares
|
|
170
|
-
}));
|
|
171
|
-
if (!(event.type === "file-change"))
|
|
172
|
-
return [
|
|
173
|
-
3,
|
|
174
|
-
3
|
|
175
|
-
];
|
|
176
|
-
return [
|
|
177
|
-
4,
|
|
178
|
-
apiRouter.getApiHandlers()
|
|
179
|
-
];
|
|
180
|
-
case 2:
|
|
181
|
-
apiHandlerInfos = _state.sent();
|
|
182
|
-
appContext1 = api.useAppContext();
|
|
183
|
-
api.setAppContext(_object_spread_props(_object_spread({}, appContext1), {
|
|
184
|
-
apiHandlerInfos
|
|
185
|
-
}));
|
|
186
|
-
_state.label = 3;
|
|
187
|
-
case 3:
|
|
188
|
-
return [
|
|
189
|
-
2
|
|
190
|
-
];
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
})();
|
|
146
|
+
storage.reset();
|
|
147
|
+
var appContext = api.useAppContext();
|
|
148
|
+
var newApiModule = requireExistModule(apiAppPath);
|
|
149
|
+
if (newApiModule && typeof newApiModule === "function") {
|
|
150
|
+
newApiModule(transformAPI);
|
|
151
|
+
}
|
|
152
|
+
var middlewares = storage.middlewares;
|
|
153
|
+
api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
|
|
154
|
+
apiMiddlewares: middlewares
|
|
155
|
+
}));
|
|
156
|
+
if (event.type === "file-change") {
|
|
157
|
+
var apiHandlerInfos = apiRouter.getApiHandlers();
|
|
158
|
+
var appContext1 = api.useAppContext();
|
|
159
|
+
api.setAppContext(_object_spread_props(_object_spread({}, appContext1), {
|
|
160
|
+
apiHandlerInfos
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
194
163
|
},
|
|
195
164
|
prepareApiServer: function prepareApiServer(props, next) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
apiRouter.getApiHandlers()
|
|
216
|
-
];
|
|
217
|
-
case 1:
|
|
218
|
-
apiHandlerInfos = _state.sent();
|
|
219
|
-
api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
|
|
220
|
-
apiRouter,
|
|
221
|
-
apiHandlerInfos,
|
|
222
|
-
apiMode
|
|
223
|
-
}));
|
|
224
|
-
return [
|
|
225
|
-
2,
|
|
226
|
-
next(props)
|
|
227
|
-
];
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
})();
|
|
165
|
+
var pwd = props.pwd, prefix = props.prefix, httpMethodDecider = props.httpMethodDecider;
|
|
166
|
+
var apiDir = path.resolve(pwd, API_DIR);
|
|
167
|
+
var appContext = api.useAppContext();
|
|
168
|
+
var apiDirectory = appContext.apiDirectory, lambdaDirectory = appContext.lambdaDirectory;
|
|
169
|
+
apiRouter = new ApiRouter({
|
|
170
|
+
appDir: pwd,
|
|
171
|
+
apiDir: apiDirectory || apiDir,
|
|
172
|
+
lambdaDir: lambdaDirectory,
|
|
173
|
+
prefix,
|
|
174
|
+
httpMethodDecider
|
|
175
|
+
});
|
|
176
|
+
var apiMode = apiRouter.getApiMode();
|
|
177
|
+
var apiHandlerInfos = apiRouter.getApiHandlers();
|
|
178
|
+
api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
|
|
179
|
+
apiRouter,
|
|
180
|
+
apiHandlerInfos,
|
|
181
|
+
apiMode
|
|
182
|
+
}));
|
|
183
|
+
return next(props);
|
|
231
184
|
}
|
|
232
185
|
};
|
|
233
186
|
}
|
package/dist/esm-node/cli.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { fs, API_DIR, normalizeOutputPath, SHARED_DIR } from "@modern-js/utils";
|
|
2
|
+
import { fs, API_DIR, normalizeOutputPath, SHARED_DIR, isProd } from "@modern-js/utils";
|
|
3
3
|
import { compile } from "@modern-js/server-utils";
|
|
4
4
|
import { ApiRouter } from "@modern-js/bff-core";
|
|
5
|
+
import { registerModernRuntimePath } from "./helper";
|
|
5
6
|
const DEFAULT_API_PREFIX = "/api";
|
|
6
7
|
const TS_CONFIG_FILENAME = "tsconfig.json";
|
|
7
8
|
const bffPlugin = () => ({
|
|
8
9
|
name: "@modern-js/plugin-bff",
|
|
9
10
|
setup: (api) => {
|
|
11
|
+
let unRegisterResolveRuntimePath = null;
|
|
10
12
|
return {
|
|
11
13
|
config() {
|
|
12
14
|
return {
|
|
@@ -93,18 +95,27 @@ const bffPlugin = () => ({
|
|
|
93
95
|
plugins
|
|
94
96
|
};
|
|
95
97
|
},
|
|
98
|
+
async beforeBuild() {
|
|
99
|
+
if (isProd()) {
|
|
100
|
+
const { internalDirectory } = api.useAppContext();
|
|
101
|
+
unRegisterResolveRuntimePath = registerModernRuntimePath(internalDirectory);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
96
104
|
async afterBuild() {
|
|
97
|
-
|
|
105
|
+
if (unRegisterResolveRuntimePath) {
|
|
106
|
+
unRegisterResolveRuntimePath();
|
|
107
|
+
}
|
|
108
|
+
const { appDirectory, distDirectory, apiDirectory, sharedDirectory } = api.useAppContext();
|
|
98
109
|
const modernConfig = api.useResolvedConfigContext();
|
|
99
110
|
const distDir = path.resolve(distDirectory);
|
|
100
111
|
const apiDir = apiDirectory || path.resolve(appDirectory, API_DIR);
|
|
101
112
|
const sharedDir = sharedDirectory || path.resolve(appDirectory, SHARED_DIR);
|
|
102
113
|
const tsconfigPath = path.resolve(appDirectory, TS_CONFIG_FILENAME);
|
|
103
114
|
const sourceDirs = [];
|
|
104
|
-
if (
|
|
115
|
+
if (fs.existsSync(apiDir)) {
|
|
105
116
|
sourceDirs.push(apiDir);
|
|
106
117
|
}
|
|
107
|
-
if (
|
|
118
|
+
if (fs.existsSync(sharedDir)) {
|
|
108
119
|
sourceDirs.push(sharedDir);
|
|
109
120
|
}
|
|
110
121
|
const { server } = modernConfig;
|
|
@@ -118,8 +129,7 @@ const bffPlugin = () => ({
|
|
|
118
129
|
}, {
|
|
119
130
|
sourceDirs,
|
|
120
131
|
distDir,
|
|
121
|
-
tsconfigPath
|
|
122
|
-
moduleType
|
|
132
|
+
tsconfigPath
|
|
123
133
|
});
|
|
124
134
|
}
|
|
125
135
|
}
|
package/dist/esm-node/server.js
CHANGED
|
@@ -30,7 +30,7 @@ var server_default = () => ({
|
|
|
30
30
|
const root = isProd() ? distDirectory : appDirectory;
|
|
31
31
|
const apiPath = path.resolve(root || process.cwd(), API_DIR);
|
|
32
32
|
apiAppPath = path.resolve(apiPath, API_APP_NAME);
|
|
33
|
-
const apiMod =
|
|
33
|
+
const apiMod = requireExistModule(apiAppPath);
|
|
34
34
|
if (apiMod && typeof apiMod === "function") {
|
|
35
35
|
apiMod(transformAPI);
|
|
36
36
|
}
|
|
@@ -82,10 +82,10 @@ var server_default = () => ({
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
reset({ event }) {
|
|
86
86
|
storage.reset();
|
|
87
87
|
const appContext = api.useAppContext();
|
|
88
|
-
const newApiModule =
|
|
88
|
+
const newApiModule = requireExistModule(apiAppPath);
|
|
89
89
|
if (newApiModule && typeof newApiModule === "function") {
|
|
90
90
|
newApiModule(transformAPI);
|
|
91
91
|
}
|
|
@@ -95,7 +95,7 @@ var server_default = () => ({
|
|
|
95
95
|
apiMiddlewares: middlewares
|
|
96
96
|
});
|
|
97
97
|
if (event.type === "file-change") {
|
|
98
|
-
const apiHandlerInfos =
|
|
98
|
+
const apiHandlerInfos = apiRouter.getApiHandlers();
|
|
99
99
|
const appContext2 = api.useAppContext();
|
|
100
100
|
api.setAppContext({
|
|
101
101
|
...appContext2,
|
|
@@ -103,7 +103,7 @@ var server_default = () => ({
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
prepareApiServer(props, next) {
|
|
107
107
|
const { pwd, prefix, httpMethodDecider } = props;
|
|
108
108
|
const apiDir = path.resolve(pwd, API_DIR);
|
|
109
109
|
const appContext = api.useAppContext();
|
|
@@ -116,7 +116,7 @@ var server_default = () => ({
|
|
|
116
116
|
httpMethodDecider
|
|
117
117
|
});
|
|
118
118
|
const apiMode = apiRouter.getApiMode();
|
|
119
|
-
const apiHandlerInfos =
|
|
119
|
+
const apiHandlerInfos = apiRouter.getApiHandlers();
|
|
120
120
|
api.setAppContext({
|
|
121
121
|
...appContext,
|
|
122
122
|
apiRouter,
|
package/package.json
CHANGED
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.58.0",
|
|
19
19
|
"jsnext:source": "./src/cli.ts",
|
|
20
20
|
"types": "./dist/types/cli.d.ts",
|
|
21
21
|
"main": "./dist/cjs/cli.js",
|
|
22
22
|
"module": "./dist/esm/cli.js",
|
|
23
23
|
"exports": {
|
|
24
|
-
"./types": "./types.d.ts",
|
|
25
24
|
".": {
|
|
26
25
|
"types": "./dist/types/cli.d.ts",
|
|
27
26
|
"jsnext:source": "./src/cli.ts",
|
|
@@ -59,11 +58,11 @@
|
|
|
59
58
|
"dependencies": {
|
|
60
59
|
"@babel/core": "^7.24.7",
|
|
61
60
|
"@swc/helpers": "0.5.3",
|
|
62
|
-
"@modern-js/bff-core": "2.
|
|
63
|
-
"@modern-js/
|
|
64
|
-
"@modern-js/utils": "2.
|
|
65
|
-
"@modern-js/
|
|
66
|
-
"@modern-js/
|
|
61
|
+
"@modern-js/bff-core": "2.58.0",
|
|
62
|
+
"@modern-js/create-request": "2.58.0",
|
|
63
|
+
"@modern-js/server-utils": "2.58.0",
|
|
64
|
+
"@modern-js/utils": "2.58.0",
|
|
65
|
+
"@modern-js/server-core": "2.58.0"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
68
|
"@types/babel__core": "^7.20.5",
|
|
@@ -74,13 +73,13 @@
|
|
|
74
73
|
"ts-jest": "^29.1.0",
|
|
75
74
|
"typescript": "^5",
|
|
76
75
|
"webpack": "^5.93.0",
|
|
77
|
-
"@modern-js/
|
|
78
|
-
"@modern-js/
|
|
79
|
-
"@modern-js/
|
|
80
|
-
"@modern-js/
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@scripts/jest-config": "2.
|
|
76
|
+
"@modern-js/runtime": "2.58.0",
|
|
77
|
+
"@modern-js/core": "2.58.0",
|
|
78
|
+
"@modern-js/bff-runtime": "2.58.0",
|
|
79
|
+
"@modern-js/types": "2.58.0",
|
|
80
|
+
"@modern-js/app-tools": "2.58.0",
|
|
81
|
+
"@scripts/build": "2.58.0",
|
|
82
|
+
"@scripts/jest-config": "2.58.0"
|
|
84
83
|
},
|
|
85
84
|
"sideEffects": false,
|
|
86
85
|
"publishConfig": {
|