@next-core/brick-kit 2.199.2 → 2.199.4

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.
@@ -1464,6 +1464,7 @@
1464
1464
  collector = collectCoverage.createCollector(name);
1465
1465
  }
1466
1466
  var precooked = brickUtils.precookFunction(fn.source, {
1467
+ cacheKey: fn,
1467
1468
  typescript: fn.typescript,
1468
1469
  hooks: collector && {
1469
1470
  beforeVisit: collector.beforeVisit
@@ -2726,7 +2727,9 @@
2726
2727
  if (globals.some(key => data.includes(key))) {
2727
2728
  var {
2728
2729
  attemptToVisitGlobals
2729
- } = brickUtils.preevaluate(data);
2730
+ } = brickUtils.preevaluate(data, {
2731
+ cache: true
2732
+ });
2730
2733
  return globals.some(key => attemptToVisitGlobals.has(key));
2731
2734
  }
2732
2735
  } else if (globals.includes("APP")) {
@@ -2895,7 +2898,9 @@
2895
2898
  // A `SyntaxError` maybe thrown.
2896
2899
  var precooked;
2897
2900
  try {
2898
- precooked = brickUtils.preevaluate(raw);
2901
+ precooked = brickUtils.preevaluate(raw, {
2902
+ cache: true
2903
+ });
2899
2904
  } catch (error) {
2900
2905
  var message = "".concat(error.message, ", in \"").concat(raw, "\"");
2901
2906
  if (options.isReEvaluation) {
@@ -10574,21 +10579,13 @@
10574
10579
  tplContextId,
10575
10580
  formContextId
10576
10581
  } = _ref;
10577
- var auth = getAuth();
10578
10582
  var context = {
10579
10583
  hash: this.location.hash,
10580
10584
  pathname: this.location.pathname,
10581
10585
  query: this.query,
10582
10586
  match,
10583
10587
  app: this.kernel.nextApp,
10584
- sys: _objectSpread__default["default"]({
10585
- org: auth.org,
10586
- username: auth.username,
10587
- userInstanceId: auth.userInstanceId,
10588
- loginFrom: auth.loginFrom,
10589
- accessRule: auth.accessRule,
10590
- isAdmin: auth.isAdmin
10591
- }, getRuntimeMisc()),
10588
+ sys: _objectSpread__default["default"](_objectSpread__default["default"]({}, getAuth()), getRuntimeMisc()),
10592
10589
  flags: this.kernel.getFeatureFlags(),
10593
10590
  segues: this.segues,
10594
10591
  storyboardContext: this.storyboardContextWrapper.get(),
@@ -12091,7 +12088,7 @@
12091
12088
  render(location) {
12092
12089
  var _this3 = this;
12093
12090
  return _asyncToGenerator__default["default"](function* () {
12094
- var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp$config, _currentApp$config$_e, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme, _storyboard$app$homep, _storyboard$app2;
12091
+ var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp, _currentApp2, _currentApp2$config, _currentApp2$config$_, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme, _currentApp3, _currentApp4, _storyboard$app$homep, _storyboard$app2;
12095
12092
  _this3.state = "initial";
12096
12093
  var renderId = _this3.renderId = _.uniqueId("render-id-");
12097
12094
  resetAllInjected();
@@ -12123,6 +12120,14 @@
12123
12120
  version: storyboard.app.currentVersion
12124
12121
  });
12125
12122
  }
12123
+ var previousApp = _this3.kernel.currentApp;
12124
+ var currentApp = storyboard ? storyboard.app : undefined;
12125
+ // Storyboard maybe re-assigned, e.g. when open launchpad.
12126
+ var appChanged = previousApp && currentApp ? previousApp.id !== currentApp.id : previousApp !== currentApp;
12127
+ brickUtils.clearExpressionASTCache();
12128
+ if (appChanged) {
12129
+ brickUtils.clearFunctionASTCache();
12130
+ }
12126
12131
 
12127
12132
  /** Pending task for loading bricks */
12128
12133
  var pendingTask;
@@ -12169,18 +12174,15 @@
12169
12174
  registerMock((_storyboard$meta2 = storyboard.meta) === null || _storyboard$meta2 === void 0 ? void 0 : _storyboard$meta2.mocks);
12170
12175
  registerFormRenderer();
12171
12176
  collectContract((_storyboard$meta3 = storyboard.meta) === null || _storyboard$meta3 === void 0 ? void 0 : _storyboard$meta3.contracts);
12177
+
12178
+ // `app` maybe fulfilled
12179
+ currentApp = storyboard.app;
12172
12180
  }
12173
- var {
12174
- mountPoints,
12175
- currentApp: previousApp
12176
- } = _this3.kernel;
12177
- var currentApp = storyboard ? storyboard.app : undefined;
12178
- // Storyboard maybe re-assigned, e.g. when open launchpad.
12179
- var appChanged = previousApp && currentApp ? previousApp.id !== currentApp.id : previousApp !== currentApp;
12181
+ var mountPoints = _this3.kernel.mountPoints;
12180
12182
  var legacy = currentApp ? currentApp.legacy : undefined;
12181
- var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
12183
+ var layoutType = ((_currentApp = currentApp) === null || _currentApp === void 0 ? void 0 : _currentApp.layoutType) || "console";
12182
12184
  var faviconElement = document.querySelector("link[rel='shortcut icon']");
12183
- var customFaviconHref = currentApp === null || currentApp === void 0 ? void 0 : (_currentApp$config = currentApp.config) === null || _currentApp$config === void 0 ? void 0 : (_currentApp$config$_e = _currentApp$config._easyops_app_favicon) === null || _currentApp$config$_e === void 0 ? void 0 : _currentApp$config$_e.default;
12185
+ var customFaviconHref = (_currentApp2 = currentApp) === null || _currentApp2 === void 0 ? void 0 : (_currentApp2$config = _currentApp2.config) === null || _currentApp2$config === void 0 ? void 0 : (_currentApp2$config$_ = _currentApp2$config._easyops_app_favicon) === null || _currentApp2$config$_ === void 0 ? void 0 : _currentApp2$config$_.default;
12184
12186
  var settingsFaviconHref = (_this3$kernel$bootstr = _this3.kernel.bootstrapData.settings) === null || _this3$kernel$bootstr === void 0 ? void 0 : (_this3$kernel$bootstr2 = _this3$kernel$bootstr.brand) === null || _this3$kernel$bootstr2 === void 0 ? void 0 : _this3$kernel$bootstr2.favicon;
12185
12187
  if (faviconElement) {
12186
12188
  if (customFaviconHref) {
@@ -12199,7 +12201,7 @@
12199
12201
  transform: "translateY(-100px)",
12200
12202
  height: "calc(100vh - var(--app-bar-height))"
12201
12203
  };
12202
- setTheme(((_getLocalAppsTheme = getLocalAppsTheme()) === null || _getLocalAppsTheme === void 0 ? void 0 : _getLocalAppsTheme[currentApp === null || currentApp === void 0 ? void 0 : currentApp.id]) || (currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
12204
+ setTheme(((_getLocalAppsTheme = getLocalAppsTheme()) === null || _getLocalAppsTheme === void 0 ? void 0 : _getLocalAppsTheme[(_currentApp3 = currentApp) === null || _currentApp3 === void 0 ? void 0 : _currentApp3.id]) || ((_currentApp4 = currentApp) === null || _currentApp4 === void 0 ? void 0 : _currentApp4.theme) || "light");
12203
12205
  getRuntime().getFeatureFlags()["support-ui-8.2-compact-layout"] ? document.body.classList.add("compact-layout") : document.body.classList.remove("compact-layout");
12204
12206
  setMode("default");
12205
12207
  devtoolsHookEmit("rendering");
@@ -12395,12 +12397,12 @@
12395
12397
  // When we have a matched route other than an abstract route,
12396
12398
  // we say *page found*, otherwise, *page not found*.
12397
12399
  if (route && route.type !== "routes" || failed) {
12398
- var _this3$kernel$bootstr3, _this3$kernel$bootstr4, _getAuth$license;
12400
+ var _currentApp5, _this3$kernel$bootstr3, _this3$kernel$bootstr4, _getAuth$license;
12399
12401
  if (!failed) {
12400
12402
  yield pendingTask;
12401
12403
  }
12402
12404
  window.DISABLE_REACT_FLUSH_SYNC = false;
12403
- setUIVersion(currentApp === null || currentApp === void 0 ? void 0 : currentApp.uiVersion);
12405
+ setUIVersion((_currentApp5 = currentApp) === null || _currentApp5 === void 0 ? void 0 : _currentApp5.uiVersion);
12404
12406
  main.length > 0 && mountTree(main, mountPoints.main);
12405
12407
  portal.length > 0 && mountTree(portal, mountPoints.portal);
12406
12408
  afterMountTree(mountPoints.main);