@next-core/brick-container 3.18.14 → 3.18.16
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/{core.dc53fd0f.js → core.7fae79f4.js} +2 -2
- package/dist/core.7fae79f4.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist/{main.c1cb8286.js → main.904a20bc.js} +2 -2
- package/dist/{main.c1cb8286.js.map → main.904a20bc.js.map} +1 -1
- package/dist/{polyfill.266306d1.js → polyfill.2fc9a9dc.js} +1 -1
- package/dist/preview/{core.a9dc0cc8.js → core.94e2cf9e.js} +1 -1
- package/dist/preview/core.94e2cf9e.js.map +1 -0
- package/dist/preview/index.html +1 -1
- package/dist/preview/{main.f361235c.js → main.04c54d60.js} +1 -1
- package/dist/preview/{main.f361235c.js.map → main.04c54d60.js.map} +1 -1
- package/dist/{vendors.e5235460.js → vendors.12b330c4.js} +2 -2
- package/package.json +5 -5
- package/serve/getProxy.js +4 -0
- package/serve/index.js +13 -5
- package/serve/utils/shouldServeAsIndexHtml.js +3 -2
- package/dist/core.dc53fd0f.js.map +0 -1
- package/dist/preview/core.a9dc0cc8.js.map +0 -1
- /package/dist/{vendors.e5235460.js.LICENSE.txt → vendors.12b330c4.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.18.
|
|
3
|
+
"version": "3.18.16",
|
|
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,12 +53,12 @@
|
|
|
53
53
|
"@next-api-sdk/api-gateway-sdk": "^1.1.0",
|
|
54
54
|
"@next-api-sdk/micro-app-standalone-sdk": "^1.1.0",
|
|
55
55
|
"@next-core/build-next-bricks": "^1.23.0",
|
|
56
|
-
"@next-core/easyops-runtime": "^0.12.
|
|
56
|
+
"@next-core/easyops-runtime": "^0.12.18",
|
|
57
57
|
"@next-core/http": "^1.2.6",
|
|
58
58
|
"@next-core/i18n": "^1.0.62",
|
|
59
59
|
"@next-core/loader": "^1.6.7",
|
|
60
|
-
"@next-core/preview": "^0.7.
|
|
61
|
-
"@next-core/runtime": "^1.54.
|
|
60
|
+
"@next-core/preview": "^0.7.17",
|
|
61
|
+
"@next-core/runtime": "^1.54.12",
|
|
62
62
|
"@next-core/test-next": "^1.1.5",
|
|
63
63
|
"@next-core/theme": "^1.5.4",
|
|
64
64
|
"@next-core/types": "^1.12.1",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"@next-core/runtime": "*",
|
|
75
75
|
"@next-core/utils": "*"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "8fb75518c6094aa51c01817cc03feb547ddb5d17"
|
|
78
78
|
}
|
package/serve/getProxy.js
CHANGED
|
@@ -69,6 +69,10 @@ export default function getProxy(env, getRawIndexHtml) {
|
|
|
69
69
|
if (req.headers["origin"] === `http://${host}:${port}`) {
|
|
70
70
|
proxyReq.setHeader("origin", server);
|
|
71
71
|
}
|
|
72
|
+
// http-proxy-middleware does not support zstd encoding
|
|
73
|
+
if (req.headers["accept-encoding"]?.includes("zstd")) {
|
|
74
|
+
proxyReq.setHeader("accept-encoding", "gzip");
|
|
75
|
+
}
|
|
72
76
|
},
|
|
73
77
|
onProxyRes: responseInterceptor(
|
|
74
78
|
async (responseBuffer, _proxyRes, req, res) => {
|
package/serve/index.js
CHANGED
|
@@ -55,6 +55,8 @@ for (const middleware of middlewares) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
const proxy = getProxy(env, getRawIndexHtml);
|
|
59
|
+
|
|
58
60
|
const browseHappyHtml = "browse-happy.html";
|
|
59
61
|
|
|
60
62
|
if (useLocalContainer) {
|
|
@@ -66,7 +68,7 @@ if (useLocalContainer) {
|
|
|
66
68
|
|
|
67
69
|
// Serve index.html
|
|
68
70
|
app.use(baseHref, async (req, res, next) => {
|
|
69
|
-
await serveIndexHtml(req, res, next, true);
|
|
71
|
+
await serveIndexHtml(req, res, next, true, !!proxy);
|
|
70
72
|
});
|
|
71
73
|
|
|
72
74
|
// Serve browse-happy.html
|
|
@@ -74,14 +76,20 @@ if (useLocalContainer) {
|
|
|
74
76
|
res.sendFile(path.join(distDir, browseHappyHtml));
|
|
75
77
|
});
|
|
76
78
|
|
|
79
|
+
const staticHandler = express.static(distDir);
|
|
77
80
|
// Serve static files
|
|
78
|
-
app.use(baseHref,
|
|
81
|
+
app.use(baseHref, (req, res, next) => {
|
|
82
|
+
if (req.path === "/") {
|
|
83
|
+
next();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
return staticHandler(req, res, next);
|
|
87
|
+
});
|
|
79
88
|
|
|
80
89
|
// Serve static files in next-core for new standalone apps.
|
|
81
90
|
app.use(`${baseHref}sa-static/-/core/0.0.0/`, express.static(distDir));
|
|
82
91
|
}
|
|
83
92
|
|
|
84
|
-
const proxy = getProxy(env, getRawIndexHtml);
|
|
85
93
|
if (proxy) {
|
|
86
94
|
for (const { context, onProxyReq, onProxyRes, ...options } of proxy) {
|
|
87
95
|
app.use(
|
|
@@ -139,8 +147,8 @@ liveReloadServer(env);
|
|
|
139
147
|
* @param {import("express").Request} req
|
|
140
148
|
* @param {import("express").Response} res
|
|
141
149
|
*/
|
|
142
|
-
async function serveIndexHtml(req, res, next, isHome) {
|
|
143
|
-
if (!shouldServeAsIndexHtml(req, isHome)) {
|
|
150
|
+
async function serveIndexHtml(req, res, next, isHome, proxiedHome) {
|
|
151
|
+
if (!shouldServeAsIndexHtml(req, isHome, proxiedHome)) {
|
|
144
152
|
next();
|
|
145
153
|
return;
|
|
146
154
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {import("express").Request} req
|
|
3
3
|
* @param {boolean} isHome
|
|
4
|
+
* @param {boolean} proxiedHome
|
|
4
5
|
* @returns {boolean}
|
|
5
6
|
*/
|
|
6
|
-
export function shouldServeAsIndexHtml(req, isHome) {
|
|
7
|
+
export function shouldServeAsIndexHtml(req, isHome, proxiedHome) {
|
|
7
8
|
return (
|
|
8
9
|
req.method === "GET" &&
|
|
9
10
|
(isHome
|
|
10
|
-
? req.path === "/"
|
|
11
|
+
? !proxiedHome && req.path === "/"
|
|
11
12
|
: ![
|
|
12
13
|
"/api/",
|
|
13
14
|
"/sa-static/",
|