@next-core/brick-container 3.18.13 → 3.18.15

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.18.13",
3
+ "version": "3.18.15",
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.16",
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
- "@next-core/loader": "^1.6.6",
60
- "@next-core/preview": "^0.7.15",
61
- "@next-core/runtime": "^1.54.10",
59
+ "@next-core/loader": "^1.6.7",
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": "2c7aeefaca5cb1e98dacd20553e0e50cde4865b4"
77
+ "gitHead": "910762b07eccf013728a8e5f963af6ad794c9f16"
78
78
  }
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, express.static(distDir));
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
  }
@@ -44,6 +44,7 @@ function getE2eSettings() {
44
44
  presetBricks: {
45
45
  notification: false,
46
46
  dialog: false,
47
+ error: false,
47
48
  },
48
49
  };
49
50
  }
@@ -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/",