@next-core/brick-container 3.23.11 → 3.24.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/all.eb41e92c.js +3 -0
- package/dist/all.eb41e92c.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist/main.ff3c7a79.js +2 -0
- package/dist/{main.a8c8ceb9.js.map → main.ff3c7a79.js.map} +1 -1
- package/dist/{polyfill.9f0c982e.js → polyfill.82190935.js} +1 -1
- package/package.json +3 -3
- package/serve/getProxy.js +60 -2
- package/dist/all.2b4a60a0.js +0 -3
- package/dist/all.2b4a60a0.js.map +0 -1
- package/dist/main.a8c8ceb9.js +0 -2
- /package/dist/{all.2b4a60a0.js.LICENSE.txt → all.eb41e92c.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/brick-container",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"description": "Brick Container Server",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/brick-container",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@next-api-sdk/api-gateway-sdk": "^1.2.2",
|
|
54
54
|
"@next-api-sdk/micro-app-standalone-sdk": "^1.3.0",
|
|
55
55
|
"@next-core/build-next-bricks": "^1.25.1",
|
|
56
|
-
"@next-core/easyops-runtime": "^0.15.
|
|
56
|
+
"@next-core/easyops-runtime": "^0.15.27",
|
|
57
57
|
"@next-core/http": "^1.2.14",
|
|
58
58
|
"@next-core/i18n": "^1.0.88",
|
|
59
59
|
"@next-core/loader": "^1.6.17",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"@next-core/runtime": "*",
|
|
76
76
|
"@next-core/utils": "*"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "45346318fe94f71445b675d6dcd895cd773dfe62"
|
|
79
79
|
}
|
package/serve/getProxy.js
CHANGED
|
@@ -4,12 +4,12 @@ import { responseInterceptor } from "http-proxy-middleware";
|
|
|
4
4
|
import _ from "lodash";
|
|
5
5
|
import jsYaml from "js-yaml";
|
|
6
6
|
import { getBrickPackages } from "@next-core/serve-helpers";
|
|
7
|
-
import { getStoryboards } from "./utils/getStoryboards.js";
|
|
7
|
+
import { getStoryboards, getSingleStoryboard } from "./utils/getStoryboards.js";
|
|
8
8
|
import { fixV2Storyboard } from "./utils/fixV2Storyboard.js";
|
|
9
9
|
import { injectIndexHtml } from "./utils/injectIndexHtml.js";
|
|
10
10
|
import { getProcessedPublicDeps } from "./utils/getProcessedPublicDeps.js";
|
|
11
11
|
import { concatBrickPackages } from "./utils/concatBrickPackages.js";
|
|
12
|
-
|
|
12
|
+
import chalk from "chalk";
|
|
13
13
|
// Create an http agent that always use IPv4
|
|
14
14
|
let agent;
|
|
15
15
|
const getAgent = (server) => {
|
|
@@ -223,6 +223,64 @@ export default function getProxy(env, getRawIndexHtml) {
|
|
|
223
223
|
return JSON.stringify(result);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
if (
|
|
227
|
+
req.path.startsWith(
|
|
228
|
+
`${baseHref}api/gateway/logic.micro_app_standalone_service/api/v1/micro_app_standalone/runtime`
|
|
229
|
+
)
|
|
230
|
+
) {
|
|
231
|
+
const appId = req.path.match(/runtime\/(.+)$/)?.[1];
|
|
232
|
+
console.log("appId", appId);
|
|
233
|
+
if (!appId) {
|
|
234
|
+
return responseBuffer;
|
|
235
|
+
}
|
|
236
|
+
const content = responseBuffer.toString("utf-8");
|
|
237
|
+
const result = JSON.parse(content);
|
|
238
|
+
const { data } = result;
|
|
239
|
+
|
|
240
|
+
// 替换 injectMenus 中的 menu 数据
|
|
241
|
+
if (data && data.injectMenus && Array.isArray(data.injectMenus)) {
|
|
242
|
+
// 从本地 storyboard 中查找匹配的 menu
|
|
243
|
+
const localStoryboard = await getSingleStoryboard(
|
|
244
|
+
rootDir,
|
|
245
|
+
appId
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
data.injectMenus = data.injectMenus.map((remoteMenu) => {
|
|
249
|
+
const appId = remoteMenu.app?.[0]?.appId;
|
|
250
|
+
const menuId = remoteMenu.menuId;
|
|
251
|
+
if (!appId || !menuId) {
|
|
252
|
+
return remoteMenu;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const localAppId = localStoryboard.app.id;
|
|
256
|
+
if (
|
|
257
|
+
localStoryboard &&
|
|
258
|
+
localStoryboard.meta &&
|
|
259
|
+
localStoryboard.meta.menus
|
|
260
|
+
) {
|
|
261
|
+
const localMenu = localStoryboard.meta.menus.find(
|
|
262
|
+
(menu) => menu.menuId === menuId && localAppId === appId
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
if (localMenu) {
|
|
266
|
+
console.log(
|
|
267
|
+
chalk.green(
|
|
268
|
+
`Replaced menu from local storyboard: ${appId}/${menuId}`
|
|
269
|
+
)
|
|
270
|
+
);
|
|
271
|
+
// 保留远程 menu 的 app 信息,使用本地 menu 的其他数据
|
|
272
|
+
return {
|
|
273
|
+
...localMenu,
|
|
274
|
+
app: remoteMenu.app,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return remoteMenu;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
removeCacheHeaders(res);
|
|
282
|
+
return JSON.stringify(result);
|
|
283
|
+
}
|
|
226
284
|
return responseBuffer;
|
|
227
285
|
}
|
|
228
286
|
),
|