@next-core/brick-utils 2.36.0 → 2.37.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.37.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.36.0...@next-core/brick-utils@2.37.0) (2022-03-24)
7
+
8
+
9
+ ### Features
10
+
11
+ * support APP.getMenu ([#1651](https://github.com/easyops-cn/next-core/issues/1651)) ([5b9f53a](https://github.com/easyops-cn/next-core/commit/5b9f53a3367087a062f415dd68070f15b98bf966))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.36.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.3...@next-core/brick-utils@2.36.0) (2022-03-18)
7
18
 
8
19
 
@@ -21058,6 +21058,46 @@
21058
21058
  };
21059
21059
  }
21060
21060
 
21061
+ var APP = "APP";
21062
+ var GET_MENUS = "getMenu";
21063
+ function scanAppGetMenuInStoryboard(storyboard) {
21064
+ var _storyboard$meta;
21065
+
21066
+ var collection = new Set();
21067
+ var beforeVisitPermissions = beforeVisitAppFactory(collection);
21068
+ var {
21069
+ customTemplates,
21070
+ functions
21071
+ } = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
21072
+ visitStoryboardExpressions([storyboard.routes, customTemplates], beforeVisitPermissions, APP);
21073
+ visitStoryboardFunctions(functions, beforeVisitPermissions);
21074
+ return Array.from(collection);
21075
+ }
21076
+ function scanAppGetMenuInAny(data) {
21077
+ var collection = new Set();
21078
+ visitStoryboardExpressions(data, beforeVisitAppFactory(collection), APP);
21079
+ return Array.from(collection);
21080
+ }
21081
+
21082
+ function beforeVisitAppFactory(collection) {
21083
+ return function beforeVisitAPP(node, parent) {
21084
+ if (node.name === APP) {
21085
+ var memberParent = parent[parent.length - 1];
21086
+ var callParent = parent[parent.length - 2];
21087
+
21088
+ if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === "CallExpression" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === "callee" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object" && !memberParent.node.computed && memberParent.node.property.type === "Identifier" && memberParent.node.property.name === GET_MENUS) {
21089
+ if (callParent.node.arguments.length === 1) {
21090
+ var menuId = callParent.node.arguments[0];
21091
+
21092
+ if (menuId.type === "Literal" && typeof menuId.value === "string") {
21093
+ collection.add(menuId.value);
21094
+ }
21095
+ }
21096
+ }
21097
+ }
21098
+ };
21099
+ }
21100
+
21061
21101
  var LexicalStatus;
21062
21102
 
21063
21103
  (function (LexicalStatus) {
@@ -22209,6 +22249,8 @@
22209
22249
  exports.prefetchScript = prefetchScript;
22210
22250
  exports.resolveContextConcurrently = resolveContextConcurrently;
22211
22251
  exports.restoreDynamicTemplates = restoreDynamicTemplates;
22252
+ exports.scanAppGetMenuInAny = scanAppGetMenuInAny;
22253
+ exports.scanAppGetMenuInStoryboard = scanAppGetMenuInStoryboard;
22212
22254
  exports.scanBricksInBrickConf = scanBricksInBrickConf;
22213
22255
  exports.scanBricksInStoryboard = scanBricksInStoryboard;
22214
22256
  exports.scanCustomApisInStoryboard = scanCustomApisInStoryboard;