@next-core/brick-container 3.25.0 → 3.25.2
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/index.html +1 -1
- package/dist/{main.e99fc464.js → main.0541ded0.js} +2 -2
- package/dist/{main.e99fc464.js.map → main.0541ded0.js.map} +1 -1
- package/dist/{polyfill.8519603d.js → polyfill.cab80574.js} +1 -1
- package/package.json +2 -2
- package/serve/env.js +24 -0
- package/serve/getProxy.js +17 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/brick-container",
|
|
3
|
-
"version": "3.25.
|
|
3
|
+
"version": "3.25.2",
|
|
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",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"@next-core/runtime": "*",
|
|
76
76
|
"@next-core/utils": "*"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "9d07fd96e1c7cd1929f85a99683406de41bf58ea"
|
|
79
79
|
}
|
package/serve/env.js
CHANGED
|
@@ -25,6 +25,7 @@ const cli = meow(
|
|
|
25
25
|
--live-reload Enable live reload (currently only for local micro-apps)
|
|
26
26
|
--size-check Enable size-check mode
|
|
27
27
|
--cookie-same-site-none Append "Same-Site: none" for cookies
|
|
28
|
+
--https Enable serving by https (auto-generates self-signed cert if missing)
|
|
28
29
|
--verbose Print verbose logs
|
|
29
30
|
--proxy-config Specify custom proxy config file path (defaults to "dev.proxy.yaml" in project root)
|
|
30
31
|
--help Show help message
|
|
@@ -74,6 +75,9 @@ const cli = meow(
|
|
|
74
75
|
sizeCheck: {
|
|
75
76
|
type: "boolean",
|
|
76
77
|
},
|
|
78
|
+
https: {
|
|
79
|
+
type: "boolean",
|
|
80
|
+
},
|
|
77
81
|
verbose: {
|
|
78
82
|
type: "boolean",
|
|
79
83
|
},
|
|
@@ -128,6 +132,26 @@ export async function getEnv(rootDir, runtimeFlags) {
|
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
if (!https && flags.https) {
|
|
136
|
+
const keyPath = path.join(rootDir, "dev-https.key");
|
|
137
|
+
const certPath = path.join(rootDir, "dev-https.cert");
|
|
138
|
+
|
|
139
|
+
if (!existsSync(keyPath) || !existsSync(certPath)) {
|
|
140
|
+
const { execSync } = await import("node:child_process");
|
|
141
|
+
const san = `DNS:localhost${flags.host !== "localhost" ? ",IP:" + flags.host : ""}`;
|
|
142
|
+
console.log(chalk.cyan("Auto-generating self-signed certificate..."));
|
|
143
|
+
execSync(
|
|
144
|
+
`openssl req -x509 -newkey rsa:2048 -keyout "${keyPath}" -out "${certPath}" -days 365 -nodes -subj "/CN=localhost" -addext "subjectAltName=${san}"`,
|
|
145
|
+
{ stdio: "inherit" }
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
https = {
|
|
150
|
+
key: readFileSync(keyPath, "utf8"),
|
|
151
|
+
cert: readFileSync(certPath, "utf8"),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
131
155
|
const env = {
|
|
132
156
|
rootDir,
|
|
133
157
|
useSubdir: flags.subdir,
|
package/serve/getProxy.js
CHANGED
|
@@ -254,15 +254,29 @@ export default function getProxy(env, getRawIndexHtml) {
|
|
|
254
254
|
data.injectMenus = data.injectMenus.map((remoteMenu) => {
|
|
255
255
|
const appId = remoteMenu.app?.[0]?.appId;
|
|
256
256
|
const menuId = remoteMenu.menuId;
|
|
257
|
-
|
|
257
|
+
const remoteGroupId = remoteMenu.injectMenuGroupId;
|
|
258
258
|
if (!appId || !menuId) {
|
|
259
259
|
return remoteMenu;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
const localAppId = localStoryboard.app.id;
|
|
263
|
-
if (
|
|
263
|
+
if (
|
|
264
|
+
localStoryboard.meta &&
|
|
265
|
+
localStoryboard.meta.menus &&
|
|
266
|
+
localAppId === appId
|
|
267
|
+
) {
|
|
268
|
+
// 同一个 menuId 可能存在多个 inject 菜单(按 injectMenuGroupId 区分注入目标),
|
|
269
|
+
// 按 menuId + injectMenuGroupId 精确匹配。无 group 时仅按 menuId 匹配。
|
|
264
270
|
const localMenu = localStoryboard.meta.menus.find(
|
|
265
|
-
(menu) =>
|
|
271
|
+
(menu) => {
|
|
272
|
+
if (menu.menuId !== menuId) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
if (remoteGroupId) {
|
|
276
|
+
return menu.injectMenuGroupId === remoteGroupId;
|
|
277
|
+
}
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
266
280
|
);
|
|
267
281
|
|
|
268
282
|
if (localMenu) {
|