@next-core/brick-container 3.23.12 → 3.24.0

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.12",
3
+ "version": "3.24.0",
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": "809e9f365ead3c2b5526a3e70bf54f95bdfac176"
78
+ "gitHead": "45346318fe94f71445b675d6dcd895cd773dfe62"
79
79
  }
package/serve/getProxy.js CHANGED
@@ -4,12 +4,12 @@ import { responseInterceptor } from "http-proxy-middleware";
4
4
  import _ from "lodash";
5
5
  import jsYaml from "js-yaml";
6
6
  import { getBrickPackages } from "@next-core/serve-helpers";
7
- import { getStoryboards } from "./utils/getStoryboards.js";
7
+ import { getStoryboards, getSingleStoryboard } from "./utils/getStoryboards.js";
8
8
  import { fixV2Storyboard } from "./utils/fixV2Storyboard.js";
9
9
  import { injectIndexHtml } from "./utils/injectIndexHtml.js";
10
10
  import { getProcessedPublicDeps } from "./utils/getProcessedPublicDeps.js";
11
11
  import { concatBrickPackages } from "./utils/concatBrickPackages.js";
12
-
12
+ import chalk from "chalk";
13
13
  // Create an http agent that always use IPv4
14
14
  let agent;
15
15
  const getAgent = (server) => {
@@ -223,6 +223,64 @@ export default function getProxy(env, getRawIndexHtml) {
223
223
  return JSON.stringify(result);
224
224
  }
225
225
 
226
+ if (
227
+ req.path.startsWith(
228
+ `${baseHref}api/gateway/logic.micro_app_standalone_service/api/v1/micro_app_standalone/runtime`
229
+ )
230
+ ) {
231
+ const appId = req.path.match(/runtime\/(.+)$/)?.[1];
232
+ console.log("appId", appId);
233
+ if (!appId) {
234
+ return responseBuffer;
235
+ }
236
+ const content = responseBuffer.toString("utf-8");
237
+ const result = JSON.parse(content);
238
+ const { data } = result;
239
+
240
+ // 替换 injectMenus 中的 menu 数据
241
+ if (data && data.injectMenus && Array.isArray(data.injectMenus)) {
242
+ // 从本地 storyboard 中查找匹配的 menu
243
+ const localStoryboard = await getSingleStoryboard(
244
+ rootDir,
245
+ appId
246
+ );
247
+
248
+ data.injectMenus = data.injectMenus.map((remoteMenu) => {
249
+ const appId = remoteMenu.app?.[0]?.appId;
250
+ const menuId = remoteMenu.menuId;
251
+ if (!appId || !menuId) {
252
+ return remoteMenu;
253
+ }
254
+
255
+ const localAppId = localStoryboard.app.id;
256
+ if (
257
+ localStoryboard &&
258
+ localStoryboard.meta &&
259
+ localStoryboard.meta.menus
260
+ ) {
261
+ const localMenu = localStoryboard.meta.menus.find(
262
+ (menu) => menu.menuId === menuId && localAppId === appId
263
+ );
264
+
265
+ if (localMenu) {
266
+ console.log(
267
+ chalk.green(
268
+ `Replaced menu from local storyboard: ${appId}/${menuId}`
269
+ )
270
+ );
271
+ // 保留远程 menu 的 app 信息,使用本地 menu 的其他数据
272
+ return {
273
+ ...localMenu,
274
+ app: remoteMenu.app,
275
+ };
276
+ }
277
+ }
278
+ return remoteMenu;
279
+ });
280
+ }
281
+ removeCacheHeaders(res);
282
+ return JSON.stringify(result);
283
+ }
226
284
  return responseBuffer;
227
285
  }
228
286
  ),
@@ -1,2 +0,0 @@
1
- (()=>{"use strict";var e,t,r,n,o,a,i,l,u,c,s,f,h,d,p,m,b,v,y,g,x,w,_,k,S,j={2585:()=>{},4861:(e,t,r)=>{r.a(e,(async(e,t)=>{try{if(r(2585),r(6118),r(8898),window.BRICK_NEXT_VERSIONS={"brick-container":"3.23.12"},window.MOCK_DATE)try{const{set:e}=await r.e(621).then(r.t.bind(r,3132,23));e(window.MOCK_DATE)}catch(e){console.error("Mock date failed:",e)}r.e(668).then(r.bind(r,5046)),t()}catch(e){t(e)}}),1)},6118:()=>{},8898:()=>{}},E={};function O(e){var t=E[e];if(void 0!==t)return t.exports;var r=E[e]={id:e,loaded:!1,exports:{}};return j[e].call(r.exports,r,r.exports,O),r.loaded=!0,r.exports}O.m=j,O.c=E,e="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",t="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",r="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",n=e=>{e&&e.d<1&&(e.d=1,e.forEach((e=>e.r--)),e.forEach((e=>e.r--?e.r++:e())))},O.a=(o,a,i)=>{var l;i&&((l=[]).d=-1);var u,c,s,f=new Set,h=o.exports,d=new Promise(((e,t)=>{s=t,c=e}));d[t]=h,d[e]=e=>(l&&e(l),f.forEach(e),d.catch((e=>{}))),o.exports=d,a((o=>{var a;u=(o=>o.map((o=>{if(null!==o&&"object"==typeof o){if(o[e])return o;if(o.then){var a=[];a.d=0,o.then((e=>{i[t]=e,n(a)}),(e=>{i[r]=e,n(a)}));var i={};return i[e]=e=>e(a),i}}var l={};return l[e]=e=>{},l[t]=o,l})))(o);var i=()=>u.map((e=>{if(e[r])throw e[r];return e[t]})),c=new Promise((t=>{(a=()=>t(i)).r=0;var r=e=>e!==l&&!f.has(e)&&(f.add(e),e&&!e.d&&(a.r++,e.push(a)));u.map((t=>t[e](r)))}));return a.r?c:i()}),(e=>(e?s(d[r]=e):c(h),n(l)))),l&&l.d<0&&(l.d=0)},O.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return O.d(t,{a:t}),t},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,O.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);O.r(r);var n={};o=o||[null,a({}),a([]),a(a)];for(var i=2&t&&e;"object"==typeof i&&!~o.indexOf(i);i=a(i))Object.getOwnPropertyNames(i).forEach((t=>n[t]=()=>e[t]));return n.default=()=>e,O.d(r,n),r},O.d=(e,t)=>{for(var r in t)O.o(t,r)&&!O.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},O.f={},O.e=e=>Promise.all(Object.keys(O.f).reduce(((t,r)=>(O.f[r](e,t),t)),[])),O.u=e=>({621:"mockdate",668:"all"}[e]+"."+{621:"85073b97",668:"eb41e92c"}[e]+".js"),O.miniCssF=e=>"all.ae8498c8.css",O.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),O.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i={},l="@next-core/brick-container:",O.l=(e,t,r,n)=>{if(i[e])i[e].push(t);else{var o,a;if(void 0!==r)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var s=u[c];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==l+r){o=s;break}}o||(a=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,O.nc&&o.setAttribute("nonce",O.nc),o.setAttribute("data-webpack",l+r),o.src=e),i[e]=[t];var f=(t,r)=>{o.onerror=o.onload=null,clearTimeout(h);var n=i[e];if(delete i[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach((e=>e(r))),t)return t(r)},h=setTimeout(f.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=f.bind(null,o.onerror),o.onload=f.bind(null,o.onload),a&&document.head.appendChild(o)}},O.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},O.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),O.j=792,(()=>{O.S={};var e={},t={};O.I=(r,n)=>{n||(n=[]);var o=t[r];if(o||(o=t[r]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[r])return e[r];O.o(O.S,r)||(O.S[r]={});var a=O.S[r],i="@next-core/brick-container",l=(e,t,r,n)=>{var o=a[e]=a[e]||{},l=o[t];(!l||!l.loaded&&(!n!=!l.eager?n:i>l.from))&&(o[t]={get:r,from:i,eager:!!n})},u=[];return"default"===r&&(l("@babel/parser","7.27.5",(()=>O.e(668).then((()=>()=>O(6773))))),l("@easyops-cn/brick-next-pipes","0.7.6",(()=>O.e(668).then((()=>()=>O(4306))))),l("@next-core/cook","2.5.12",(()=>O.e(668).then((()=>()=>O(8382))))),l("@next-core/easyops-runtime","0.15.27",(()=>O.e(668).then((()=>()=>O(970))))),l("@next-core/http","1.2.14",(()=>O.e(668).then((()=>()=>O(3032))))),l("@next-core/i18n","1.0.88",(()=>O.e(668).then((()=>()=>O(6319))))),l("@next-core/inject","1.0.63",(()=>O.e(668).then((()=>()=>O(6095))))),l("@next-core/loader","1.6.17",(()=>O.e(668).then((()=>()=>O(9321))))),l("@next-core/pipes","2.0.36",(()=>O.e(668).then((()=>()=>O(8604))))),l("@next-core/runtime","1.72.2",(()=>O.e(668).then((()=>()=>O(4046))))),l("@next-core/supply","2.3.9",(()=>O.e(668).then((()=>()=>O(5702))))),l("@next-core/theme","1.6.1",(()=>O.e(668).then((()=>()=>O(90))))),l("@next-core/utils/general","1.8.9",(()=>O.e(668).then((()=>()=>O(763))))),l("@next-core/utils/storyboard","1.8.9",(()=>O.e(668).then((()=>()=>O(4395))))),l("history","4.10.1",(()=>O.e(668).then((()=>()=>O(9669))))),l("i18next-browser-languagedetector","7.2.2",(()=>O.e(668).then((()=>()=>O(726))))),l("i18next","22.5.1",(()=>O.e(668).then((()=>()=>O(843))))),l("js-yaml","3.14.1",(()=>O.e(668).then((()=>()=>O(9515))))),l("lodash","4.17.21",(()=>O.e(668).then((()=>()=>O(5250))))),l("moment/locale/zh-cn.js","2.30.1",(()=>O.e(668).then((()=>()=>O(1329))))),l("moment","2.30.1",(()=>O.e(668).then((()=>()=>O(9420)))))),e[r]=u.length?Promise.all(u).then((()=>e[r]=1)):1}}})(),(()=>{var e;O.g.importScripts&&(e=O.g.location+"");var t=O.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),O.p=e})(),u=e=>{var t=e=>e.split(".").map((e=>+e==e?+e:e)),r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=r[1]?t(r[1]):[];return r[2]&&(n.length++,n.push.apply(n,t(r[2]))),r[3]&&(n.push([]),n.push.apply(n,t(r[3]))),n},c=(e,t)=>{e=u(e),t=u(t);for(var r=0;;){if(r>=e.length)return r<t.length&&"u"!=(typeof t[r])[0];var n=e[r],o=(typeof n)[0];if(r>=t.length)return"u"==o;var a=t[r],i=(typeof a)[0];if(o!=i)return"o"==o&&"n"==i||"s"==i||"u"==o;if("o"!=o&&"u"!=o&&n!=a)return n<a;r++}},s=e=>{var t=e[0],r="";if(1===e.length)return"*";if(t+.5){r+=0==t?">=":-1==t?"<":1==t?"^":2==t?"~":t>0?"=":"!=";for(var n=1,o=1;o<e.length;o++)n--,r+="u"==(typeof(i=e[o]))[0]?"-":(n>0?".":"")+(n=2,i);return r}var a=[];for(o=1;o<e.length;o++){var i=e[o];a.push(0===i?"not("+l()+")":1===i?"("+l()+" || "+l()+")":2===i?a.pop()+" "+a.pop():s(i))}return l();function l(){return a.pop().replace(/^\((.+)\)$/,"$1")}},f=(e,t)=>{if(0 in e){t=u(t);var r=e[0],n=r<0;n&&(r=-r-1);for(var o=0,a=1,i=!0;;a++,o++){var l,c,s=a<e.length?(typeof e[a])[0]:"";if(o>=t.length||"o"==(c=(typeof(l=t[o]))[0]))return!i||("u"==s?a>r&&!n:""==s!=n);if("u"==c){if(!i||"u"!=s)return!1}else if(i)if(s==c)if(a<=r){if(l!=e[a])return!1}else{if(n?l>e[a]:l<e[a])return!1;l!=e[a]&&(i=!1)}else if("s"!=s&&"n"!=s){if(n||a<=r)return!1;i=!1,a--}else{if(a<=r||c<s!=n)return!1;i=!1}else"s"!=s&&"n"!=s&&(i=!1,a--)}}var h=[],d=h.pop.bind(h);for(o=1;o<e.length;o++){var p=e[o];h.push(1==p?d()|d():2==p?d()&d():p?f(p,t):!d())}return!!d()},h=(e,t)=>e&&O.o(e,t),d=e=>(e.loaded=1,e.get()),p=e=>Object.keys(e).reduce(((t,r)=>(e[r].eager&&(t[r]=e[r]),t)),{}),m=(e,t,r)=>{var n=r?p(e[t]):e[t];return Object.keys(n).reduce(((e,t)=>!e||!n[e].loaded&&c(e,t)?t:e),0)},b=(e,t,r,n)=>"Unsatisfied version "+r+" from "+(r&&e[t][r].from)+" of shared singleton module "+t+" (required "+s(n)+")",v=e=>{throw new Error(e)},y=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},g=(e,t,r)=>r?r():((e,t)=>v("Shared module "+t+" doesn't exist in shared scope "+e))(e,t),x=(e=>function(t,r,n,o,a){var i=O.I(t);return i&&i.then&&!n?i.then(e.bind(e,t,O.S[t],r,!1,o,a)):e(t,O.S[t],r,n,o,a)})(((e,t,r,n,o,a)=>{if(!h(t,r))return g(e,r,a);var i=m(t,r,n);return f(o,i)||y(b(t,r,i,o)),d(t[r][i])})),w={},_={1727:()=>x("default","@next-core/theme",!1,[1,1,6,1],(()=>O.e(668).then((()=>()=>O(90))))),3647:()=>x("default","@next-core/runtime",!1,[0],(()=>O.e(668).then((()=>()=>O(4046))))),7551:()=>x("default","@next-core/http",!1,[0],(()=>O.e(668).then((()=>()=>O(3032))))),5018:()=>x("default","@next-core/i18n",!1,[1,1,0,88],(()=>O.e(668).then((()=>()=>O(6319))))),9102:()=>x("default","@next-core/easyops-runtime",!1,[2,0,15,27],(()=>O.e(668).then((()=>()=>O(970))))),1030:()=>x("default","lodash",!1,[1,4,17,21],(()=>O.e(668).then((()=>()=>O(5250))))),4113:()=>x("default","@next-core/utils/general",!1,[0],(()=>O.e(668).then((()=>()=>O(763))))),1060:()=>x("default","js-yaml",!1,[1,3,14,1],(()=>O.e(668).then((()=>()=>O(9515))))),8856:()=>x("default","@next-core/loader",!1,[1,1,6,17],(()=>O.e(668).then((()=>()=>O(9321))))),5069:()=>x("default","@next-core/utils/storyboard",!1,[0],(()=>O.e(668).then((()=>()=>O(4395))))),1858:()=>x("default","moment/locale/zh-cn.js",!1,[0],(()=>O.e(668).then((()=>()=>O(1329))))),1916:()=>x("default","moment",!1,[0],(()=>O.e(668).then((()=>()=>O(9420))))),5630:()=>x("default","i18next",!1,[0],(()=>O.e(668).then((()=>()=>O(843))))),1732:()=>x("default","history",!1,[0],(()=>O.e(668).then((()=>()=>O(9669))))),848:()=>x("default","i18next-browser-languagedetector",!1,[0],(()=>O.e(668).then((()=>()=>O(726))))),8303:()=>x("default","@next-core/cook",!1,[0],(()=>O.e(668).then((()=>()=>O(8382))))),8319:()=>x("default","@next-core/supply",!1,[0],(()=>O.e(668).then((()=>()=>O(5702))))),3575:()=>x("default","@next-core/inject",!1,[0],(()=>O.e(668).then((()=>()=>O(6095))))),5285:()=>x("default","@next-core/pipes",!1,[0],(()=>O.e(668).then((()=>()=>O(8604))))),580:()=>x("default","@babel/parser",!1,[0],(()=>O.e(668).then((()=>()=>O(6773))))),8377:()=>x("default","@easyops-cn/brick-next-pipes",!1,[0],(()=>O.e(668).then((()=>()=>O(4306)))))},k={668:[1727,3647,7551,5018,9102,1030,4113,1060,8856,5069,1858,1916,5630,1732,848,8303,8319,3575,5285,580,8377]},S={},O.f.consumes=(e,t)=>{O.o(k,e)&&k[e].forEach((e=>{if(O.o(w,e))return t.push(w[e]);if(!S[e]){var r=t=>{w[e]=0,O.m[e]=r=>{delete O.c[e],r.exports=t()}};S[e]=!0;var n=t=>{delete w[e],O.m[e]=r=>{throw delete O.c[e],t}};try{var o=_[e]();o.then?t.push(w[e]=o.then(r).catch(n)):r(o)}catch(e){n(e)}}}))},(()=>{if("undefined"!=typeof document){var e={792:0};O.f.miniCss=(t,r)=>{e[t]?r.push(e[t]):0!==e[t]&&{668:1}[t]&&r.push(e[t]=(e=>new Promise(((t,r)=>{var n=O.miniCssF(e),o=O.p+n;if(((e,t)=>{for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=(i=r[n]).getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(o===e||o===t))return i}var a=document.getElementsByTagName("style");for(n=0;n<a.length;n++){var i;if((o=(i=a[n]).getAttribute("data-href"))===e||o===t)return i}})(n,o))return t();((e,t,r,n,o)=>{var a=document.createElement("link");a.rel="stylesheet",a.type="text/css",O.nc&&(a.nonce=O.nc),a.onerror=a.onload=r=>{if(a.onerror=a.onload=null,"load"===r.type)n();else{var i=r&&r.type,l=r&&r.target&&r.target.href||t,u=new Error("Loading CSS chunk "+e+" failed.\n("+i+": "+l+")");u.name="ChunkLoadError",u.code="CSS_CHUNK_LOAD_FAILED",u.type=i,u.request=l,a.parentNode&&a.parentNode.removeChild(a),o(u)}},a.href=t,document.head.appendChild(a)})(e,o,0,t,r)})))(t).then((()=>{e[t]=0}),(r=>{throw delete e[t],r})))}}})(),(()=>{var e={792:0};O.f.j=(t,r)=>{var n=O.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,o)=>n=e[t]=[r,o]));r.push(n[2]=o);var a=O.p+O.u(t),i=new Error;O.l(a,(r=>{if(O.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}}),"chunk-"+t,t)}};var t=(t,r)=>{var n,o,[a,i,l]=r,u=0;if(a.some((t=>0!==e[t]))){for(n in i)O.o(i,n)&&(O.m[n]=i[n]);l&&l(O)}for(t&&t(r);u<a.length;u++)o=a[u],O.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=globalThis.webpackChunk_next_core_brick_container=globalThis.webpackChunk_next_core_brick_container||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),O(4861)})();
2
- //# sourceMappingURL=main.a0c9d518.js.map