@next-core/brick-container 3.0.4 → 3.0.6
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/brick-container",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "Brick Container Server",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/brick-container",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"build": "cross-env NODE_ENV='production' build-next-bricks"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@next-core/serve-helpers": "^1.0.
|
|
28
|
+
"@next-core/serve-helpers": "^1.0.3",
|
|
29
29
|
"body-parser": "^1.20.1",
|
|
30
30
|
"compression": "^1.7.4",
|
|
31
31
|
"express": "^4.18.2",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"@next-core/runtime": "*",
|
|
54
54
|
"@next-core/utils": "*"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "c25db2de68fa2f264c920a7879ab58a704a3581d"
|
|
57
57
|
}
|
package/serve/getProxy.js
CHANGED
|
@@ -4,6 +4,7 @@ import { getBrickPackages } from "@next-core/serve-helpers";
|
|
|
4
4
|
import { getStoryboards } from "./utils/getStoryboards.js";
|
|
5
5
|
import { fixV2Storyboard } from "./utils/fixV2Storyboard.js";
|
|
6
6
|
import { injectIndexHtml } from "./utils/injectIndexHtml.js";
|
|
7
|
+
import { concatBrickPackages } from "./utils/concatBrickPackages.js";
|
|
7
8
|
|
|
8
9
|
export default function getProxy(env, getRawIndexHtml) {
|
|
9
10
|
const { rootDir, localMicroApps, baseHref, useRemote, useLocalContainer } =
|
|
@@ -37,7 +38,10 @@ export default function getProxy(env, getRawIndexHtml) {
|
|
|
37
38
|
|
|
38
39
|
// Todo: filter out local micro-apps and brick packages
|
|
39
40
|
data.storyboards = storyboards.concat(data.storyboards);
|
|
40
|
-
data.brickPackages =
|
|
41
|
+
data.brickPackages = concatBrickPackages(
|
|
42
|
+
brickPackages,
|
|
43
|
+
data.brickPackages
|
|
44
|
+
);
|
|
41
45
|
removeCacheHeaders(res);
|
|
42
46
|
return JSON.stringify(result);
|
|
43
47
|
}
|
|
@@ -171,9 +175,10 @@ export default function getProxy(env, getRawIndexHtml) {
|
|
|
171
175
|
) {
|
|
172
176
|
const content = responseBuffer.toString("utf-8");
|
|
173
177
|
const result = JSON.parse(content);
|
|
174
|
-
result.brickPackages = (
|
|
175
|
-
await getBrickPackages(rootDir, true)
|
|
176
|
-
|
|
178
|
+
result.brickPackages = concatBrickPackages(
|
|
179
|
+
await getBrickPackages(rootDir, true),
|
|
180
|
+
result.brickPackages
|
|
181
|
+
);
|
|
177
182
|
delete result.templatePackages;
|
|
178
183
|
removeCacheHeaders(res);
|
|
179
184
|
return JSON.stringify(result);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function concatBrickPackages(localPackages, remotePackages) {
|
|
2
|
+
const localIds = new Set();
|
|
3
|
+
for (const pkg of localPackages) {
|
|
4
|
+
localIds.add(pkg.id ?? pkg.filePath.split("/", 2).join("/"));
|
|
5
|
+
}
|
|
6
|
+
return localPackages.concat(
|
|
7
|
+
remotePackages.filter(
|
|
8
|
+
(pkg) => !localIds.has(pkg.id ?? pkg.filePath.split("/", 2).join("/"))
|
|
9
|
+
)
|
|
10
|
+
);
|
|
11
|
+
}
|