@next-core/brick-kit 2.199.2 → 2.199.3

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.esm.js CHANGED
@@ -4,7 +4,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
4
4
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
5
5
  import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
6
6
  import _, { escapeRegExp, set, get, difference, identity, uniqueId, isNil, isEmpty, merge, sortBy, cloneDeep, clamp, orderBy, pick, isObject as isObject$1, uniq, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
7
- import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, JsonStorage, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, preevaluate, shouldAllowRecursiveEvaluations, inject, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
7
+ import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, JsonStorage, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, preevaluate, shouldAllowRecursiveEvaluations, inject, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, clearExpressionASTCache, clearFunctionASTCache, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
8
8
  import moment from 'moment';
9
9
  import { pipes } from '@next-core/pipes';
10
10
  import i18next, { getFixedT } from 'i18next';
@@ -1466,6 +1466,7 @@ function StoryboardFunctionRegistryFactory() {
1466
1466
  collector = collectCoverage.createCollector(name);
1467
1467
  }
1468
1468
  var precooked = precookFunction(fn.source, {
1469
+ cacheKey: fn,
1469
1470
  typescript: fn.typescript,
1470
1471
  hooks: collector && {
1471
1472
  beforeVisit: collector.beforeVisit
@@ -2728,7 +2729,9 @@ function attemptToVisit(data, globals) {
2728
2729
  if (globals.some(key => data.includes(key))) {
2729
2730
  var {
2730
2731
  attemptToVisitGlobals
2731
- } = preevaluate(data);
2732
+ } = preevaluate(data, {
2733
+ cache: true
2734
+ });
2732
2735
  return globals.some(key => attemptToVisitGlobals.has(key));
2733
2736
  }
2734
2737
  } else if (globals.includes("APP")) {
@@ -2897,7 +2900,9 @@ function evaluate(raw) {
2897
2900
  // A `SyntaxError` maybe thrown.
2898
2901
  var precooked;
2899
2902
  try {
2900
- precooked = preevaluate(raw);
2903
+ precooked = preevaluate(raw, {
2904
+ cache: true
2905
+ });
2901
2906
  } catch (error) {
2902
2907
  var message = "".concat(error.message, ", in \"").concat(raw, "\"");
2903
2908
  if (options.isReEvaluation) {
@@ -12093,7 +12098,7 @@ class Router {
12093
12098
  render(location) {
12094
12099
  var _this3 = this;
12095
12100
  return _asyncToGenerator$3(function* () {
12096
- 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;
12101
+ 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;
12097
12102
  _this3.state = "initial";
12098
12103
  var renderId = _this3.renderId = uniqueId("render-id-");
12099
12104
  resetAllInjected();
@@ -12125,6 +12130,14 @@ class Router {
12125
12130
  version: storyboard.app.currentVersion
12126
12131
  });
12127
12132
  }
12133
+ var previousApp = _this3.kernel.currentApp;
12134
+ var currentApp = storyboard ? storyboard.app : undefined;
12135
+ // Storyboard maybe re-assigned, e.g. when open launchpad.
12136
+ var appChanged = previousApp && currentApp ? previousApp.id !== currentApp.id : previousApp !== currentApp;
12137
+ clearExpressionASTCache();
12138
+ if (appChanged) {
12139
+ clearFunctionASTCache();
12140
+ }
12128
12141
 
12129
12142
  /** Pending task for loading bricks */
12130
12143
  var pendingTask;
@@ -12171,18 +12184,15 @@ class Router {
12171
12184
  registerMock((_storyboard$meta2 = storyboard.meta) === null || _storyboard$meta2 === void 0 ? void 0 : _storyboard$meta2.mocks);
12172
12185
  registerFormRenderer();
12173
12186
  collectContract((_storyboard$meta3 = storyboard.meta) === null || _storyboard$meta3 === void 0 ? void 0 : _storyboard$meta3.contracts);
12187
+
12188
+ // `app` maybe fulfilled
12189
+ currentApp = storyboard.app;
12174
12190
  }
12175
- var {
12176
- mountPoints,
12177
- currentApp: previousApp
12178
- } = _this3.kernel;
12179
- var currentApp = storyboard ? storyboard.app : undefined;
12180
- // Storyboard maybe re-assigned, e.g. when open launchpad.
12181
- var appChanged = previousApp && currentApp ? previousApp.id !== currentApp.id : previousApp !== currentApp;
12191
+ var mountPoints = _this3.kernel.mountPoints;
12182
12192
  var legacy = currentApp ? currentApp.legacy : undefined;
12183
- var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
12193
+ var layoutType = ((_currentApp = currentApp) === null || _currentApp === void 0 ? void 0 : _currentApp.layoutType) || "console";
12184
12194
  var faviconElement = document.querySelector("link[rel='shortcut icon']");
12185
- 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;
12195
+ 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;
12186
12196
  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;
12187
12197
  if (faviconElement) {
12188
12198
  if (customFaviconHref) {
@@ -12201,7 +12211,7 @@ class Router {
12201
12211
  transform: "translateY(-100px)",
12202
12212
  height: "calc(100vh - var(--app-bar-height))"
12203
12213
  };
12204
- 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");
12214
+ 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");
12205
12215
  getRuntime().getFeatureFlags()["support-ui-8.2-compact-layout"] ? document.body.classList.add("compact-layout") : document.body.classList.remove("compact-layout");
12206
12216
  setMode("default");
12207
12217
  devtoolsHookEmit("rendering");
@@ -12397,12 +12407,12 @@ class Router {
12397
12407
  // When we have a matched route other than an abstract route,
12398
12408
  // we say *page found*, otherwise, *page not found*.
12399
12409
  if (route && route.type !== "routes" || failed) {
12400
- var _this3$kernel$bootstr3, _this3$kernel$bootstr4, _getAuth$license;
12410
+ var _currentApp5, _this3$kernel$bootstr3, _this3$kernel$bootstr4, _getAuth$license;
12401
12411
  if (!failed) {
12402
12412
  yield pendingTask;
12403
12413
  }
12404
12414
  window.DISABLE_REACT_FLUSH_SYNC = false;
12405
- setUIVersion(currentApp === null || currentApp === void 0 ? void 0 : currentApp.uiVersion);
12415
+ setUIVersion((_currentApp5 = currentApp) === null || _currentApp5 === void 0 ? void 0 : _currentApp5.uiVersion);
12406
12416
  main.length > 0 && mountTree(main, mountPoints.main);
12407
12417
  portal.length > 0 && mountTree(portal, mountPoints.portal);
12408
12418
  afterMountTree(mountPoints.main);