@next-core/brick-container 3.23.10 → 3.23.12

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.23.10",
3
+ "version": "3.23.12",
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.26",
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": "8b56a7ae267ef34303a936bd380cec6568206854"
78
+ "gitHead": "809e9f365ead3c2b5526a3e70bf54f95bdfac176"
79
79
  }
@@ -1,10 +1,11 @@
1
1
  import jsYaml from "js-yaml";
2
+ import { serveBricks } from "@next-core/serve-helpers";
2
3
  import bootstrapJson from "./bootstrapJson.js";
3
4
  import mockAuth from "./mockAuth.js";
4
5
  import singleAppBootstrapJson from "./singleAppBootstrapJson.js";
5
6
  import standaloneBootstrapJson from "./standaloneBootstrapJson.js";
6
7
  import serveBricksWithVersions from "./serveBricksWithVersions.js";
7
- import { serveBricks } from "@next-core/serve-helpers";
8
+ import serveAppImages from "./serveAppImages.js";
8
9
 
9
10
  const { safeDump, JSON_SCHEMA } = jsYaml;
10
11
 
@@ -101,6 +102,16 @@ export function getPreMiddlewares(env) {
101
102
  }
102
103
  },
103
104
  });
105
+
106
+ middlewares.push({
107
+ path: `${baseHref}sa-static/${appId}/versions/0.0.0/webroot/-/images`,
108
+ middleware: serveAppImages(env, appId),
109
+ });
110
+
111
+ middlewares.push({
112
+ path: `${baseHref}sa-static/${appId}/versions/0.0.0/webroot/-/micro-apps/${appId}/images`,
113
+ middleware: serveAppImages(env, appId),
114
+ });
104
115
  }
105
116
 
106
117
  middlewares.push({
@@ -0,0 +1,24 @@
1
+ import path from "node:path";
2
+ import { tryServeFiles } from "@next-core/serve-helpers";
3
+
4
+ export default function serveAppImages({ rootDir }, appId) {
5
+ /**
6
+ * @param {import("express").Request} req
7
+ * @param {import("express").Response} res
8
+ */
9
+ return async function (req, res, next) {
10
+ if (req.method !== "GET") {
11
+ next();
12
+ return;
13
+ }
14
+
15
+ tryServeFiles(
16
+ ["mock-micro-apps", "apps"].map((folder) =>
17
+ path.join(rootDir, folder, appId, "dist/images", req.path)
18
+ ),
19
+ req,
20
+ res,
21
+ next
22
+ );
23
+ };
24
+ }