@next-core/brick-utils 2.37.13 → 2.37.14

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,165 +3,96 @@
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.13](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.12...@next-core/brick-utils@2.37.13) (2022-05-07)
6
+ ## [2.37.14](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.13...@next-core/brick-utils@2.37.14) (2022-05-09)
7
7
 
8
+ **Note:** Version bump only for package @next-core/brick-utils
8
9
 
9
- ### Bug Fixes
10
10
 
11
- * ignore screenshot in builder nodes ([1e59600](https://github.com/easyops-cn/next-core/commit/1e59600e13bb95ffdf8d3440b60d77b39efa075b))
12
11
 
13
12
 
14
13
 
14
+ ## [2.37.13](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.12...@next-core/brick-utils@2.37.13) (2022-05-07)
15
+
16
+ ### Bug Fixes
15
17
 
18
+ - ignore screenshot in builder nodes ([1e59600](https://github.com/easyops-cn/next-core/commit/1e59600e13bb95ffdf8d3440b60d77b39efa075b))
16
19
 
17
20
  ## [2.37.12](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.11...@next-core/brick-utils@2.37.12) (2022-05-06)
18
21
 
19
22
  **Note:** Version bump only for package @next-core/brick-utils
20
23
 
21
-
22
-
23
-
24
-
25
24
  ## [2.37.11](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.10...@next-core/brick-utils@2.37.11) (2022-04-26)
26
25
 
27
26
  **Note:** Version bump only for package @next-core/brick-utils
28
27
 
29
-
30
-
31
-
32
-
33
28
  ## [2.37.10](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.9...@next-core/brick-utils@2.37.10) (2022-04-22)
34
29
 
35
30
  **Note:** Version bump only for package @next-core/brick-utils
36
31
 
37
-
38
-
39
-
40
-
41
32
  ## [2.37.9](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.8...@next-core/brick-utils@2.37.9) (2022-04-21)
42
33
 
43
34
  **Note:** Version bump only for package @next-core/brick-utils
44
35
 
45
-
46
-
47
-
48
-
49
36
  ## [2.37.8](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.7...@next-core/brick-utils@2.37.8) (2022-04-19)
50
37
 
51
38
  **Note:** Version bump only for package @next-core/brick-utils
52
39
 
53
-
54
-
55
-
56
-
57
40
  ## [2.37.7](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.6...@next-core/brick-utils@2.37.7) (2022-04-14)
58
41
 
59
42
  **Note:** Version bump only for package @next-core/brick-utils
60
43
 
61
-
62
-
63
-
64
-
65
44
  ## [2.37.6](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.5...@next-core/brick-utils@2.37.6) (2022-04-07)
66
45
 
67
46
  **Note:** Version bump only for package @next-core/brick-utils
68
47
 
69
-
70
-
71
-
72
-
73
48
  ## [2.37.5](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.4...@next-core/brick-utils@2.37.5) (2022-04-06)
74
49
 
75
50
  **Note:** Version bump only for package @next-core/brick-utils
76
51
 
77
-
78
-
79
-
80
-
81
52
  ## [2.37.4](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.3...@next-core/brick-utils@2.37.4) (2022-03-29)
82
53
 
83
54
  **Note:** Version bump only for package @next-core/brick-utils
84
55
 
85
-
86
-
87
-
88
-
89
56
  ## [2.37.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.2...@next-core/brick-utils@2.37.3) (2022-03-29)
90
57
 
91
58
  **Note:** Version bump only for package @next-core/brick-utils
92
59
 
93
-
94
-
95
-
96
-
97
60
  ## [2.37.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.1...@next-core/brick-utils@2.37.2) (2022-03-28)
98
61
 
99
62
  **Note:** Version bump only for package @next-core/brick-utils
100
63
 
101
-
102
-
103
-
104
-
105
64
  ## [2.37.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.0...@next-core/brick-utils@2.37.1) (2022-03-24)
106
65
 
107
-
108
66
  ### Bug Fixes
109
67
 
110
- * ignore `previewSettings` when building route node ([8cffb40](https://github.com/easyops-cn/next-core/commit/8cffb40b0c583a989c29518a1ed3ef2c8b24ad62))
111
-
112
-
113
-
114
-
68
+ - ignore `previewSettings` when building route node ([8cffb40](https://github.com/easyops-cn/next-core/commit/8cffb40b0c583a989c29518a1ed3ef2c8b24ad62))
115
69
 
116
70
  # [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)
117
71
 
118
-
119
72
  ### Features
120
73
 
121
- * support APP.getMenu ([#1651](https://github.com/easyops-cn/next-core/issues/1651)) ([5b9f53a](https://github.com/easyops-cn/next-core/commit/5b9f53a3367087a062f415dd68070f15b98bf966))
122
-
123
-
124
-
125
-
74
+ - support APP.getMenu ([#1651](https://github.com/easyops-cn/next-core/issues/1651)) ([5b9f53a](https://github.com/easyops-cn/next-core/commit/5b9f53a3367087a062f415dd68070f15b98bf966))
126
75
 
127
76
  # [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)
128
77
 
129
-
130
78
  ### Features
131
79
 
132
- * new util function: debounceByAnimationFrame ([d47d032](https://github.com/easyops-cn/next-core/commit/d47d032dea4f9a55e8b642b0d2af926e808c716f))
133
-
134
-
135
-
136
-
80
+ - new util function: debounceByAnimationFrame ([d47d032](https://github.com/easyops-cn/next-core/commit/d47d032dea4f9a55e8b642b0d2af926e808c716f))
137
81
 
138
82
  ## [2.35.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.2...@next-core/brick-utils@2.35.3) (2022-03-15)
139
83
 
140
84
  **Note:** Version bump only for package @next-core/brick-utils
141
85
 
142
-
143
-
144
-
145
-
146
86
  ## [2.35.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.1...@next-core/brick-utils@2.35.2) (2022-03-07)
147
87
 
148
-
149
88
  ### Bug Fixes
150
89
 
151
- * fix get deps when brick package has no editors ([833739d](https://github.com/easyops-cn/next-core/commit/833739de875706666a8555d1becb35043f88efc6))
152
-
153
-
154
-
155
-
90
+ - fix get deps when brick package has no editors ([833739d](https://github.com/easyops-cn/next-core/commit/833739de875706666a8555d1becb35043f88efc6))
156
91
 
157
92
  ## [2.35.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.0...@next-core/brick-utils@2.35.1) (2022-02-28)
158
93
 
159
94
  **Note:** Version bump only for package @next-core/brick-utils
160
95
 
161
-
162
-
163
-
164
-
165
96
  # [2.35.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.34.2...@next-core/brick-utils@2.35.0) (2022-02-21)
166
97
 
167
98
  ### Features
@@ -1,16 +1,16 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/taggedTemplateLiteral'), require('@next-core/pipes'), require('js-yaml')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/taggedTemplateLiteral', '@next-core/pipes', 'js-yaml'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickUtils = {}, global._asyncToGenerator, global.lodash, global._defineProperty, global._objectSpread, global._objectWithoutProperties, global._taggedTemplateLiteral, global.pipes, global.yaml));
5
- })(this, (function (exports, _asyncToGenerator, lodash, _defineProperty, _objectSpread, _objectWithoutProperties, _taggedTemplateLiteral, pipes, yaml) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('lodash'), require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/taggedTemplateLiteral'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@next-core/pipes'), require('js-yaml')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', 'lodash', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/taggedTemplateLiteral', '@babel/runtime/helpers/objectWithoutProperties', '@next-core/pipes', 'js-yaml'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickUtils = {}, global._asyncToGenerator, global.lodash, global._defineProperty, global._objectSpread, global._taggedTemplateLiteral, global._objectWithoutProperties, global.pipes, global.yaml));
5
+ })(this, (function (exports, _asyncToGenerator, lodash, _defineProperty, _objectSpread, _taggedTemplateLiteral, _objectWithoutProperties, pipes, yaml) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
10
10
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
11
11
  var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
12
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
13
12
  var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
13
+ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
14
14
  var yaml__default = /*#__PURE__*/_interopDefaultLegacy(yaml);
15
15
 
16
16
  var cache$1 = new Map();
@@ -21027,7 +21027,7 @@
21027
21027
  break;
21028
21028
  }
21029
21029
 
21030
- if (!name) throw new TypeError("Missing parameter name at " + i);
21030
+ if (!name) throw new TypeError("Missing parameter name at ".concat(i));
21031
21031
  tokens.push({
21032
21032
  type: "NAME",
21033
21033
  index: i,
@@ -21043,7 +21043,7 @@
21043
21043
  var j = i + 1;
21044
21044
 
21045
21045
  if (str[j] === "?") {
21046
- throw new TypeError("Pattern cannot start with \"?\" at " + j);
21046
+ throw new TypeError("Pattern cannot start with \"?\" at ".concat(j));
21047
21047
  }
21048
21048
 
21049
21049
  while (j < str.length) {
@@ -21063,15 +21063,15 @@
21063
21063
  count++;
21064
21064
 
21065
21065
  if (str[j + 1] !== "?") {
21066
- throw new TypeError("Capturing groups are not allowed at " + j);
21066
+ throw new TypeError("Capturing groups are not allowed at ".concat(j));
21067
21067
  }
21068
21068
  }
21069
21069
 
21070
21070
  pattern += str[j++];
21071
21071
  }
21072
21072
 
21073
- if (count) throw new TypeError("Unbalanced pattern at " + i);
21074
- if (!pattern) throw new TypeError("Missing pattern at " + i);
21073
+ if (count) throw new TypeError("Unbalanced pattern at ".concat(i));
21074
+ if (!pattern) throw new TypeError("Missing pattern at ".concat(i));
21075
21075
  tokens.push({
21076
21076
  type: "PATTERN",
21077
21077
  index: i,
@@ -21108,7 +21108,7 @@
21108
21108
  var tokens = lexer(str);
21109
21109
  var _a = options.prefixes,
21110
21110
  prefixes = _a === void 0 ? "./" : _a;
21111
- var defaultPattern = "[^" + escapeString(options.delimiter || "/#?") + "]+?";
21111
+ var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
21112
21112
  var result = [];
21113
21113
  var key = 0;
21114
21114
  var i = 0;
@@ -21124,12 +21124,12 @@
21124
21124
  var _a = tokens[i],
21125
21125
  nextType = _a.type,
21126
21126
  index = _a.index;
21127
- throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type);
21127
+ throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
21128
21128
  };
21129
21129
 
21130
21130
  var consumeText = function () {
21131
21131
  var result = "";
21132
- var value; // tslint:disable-next-line
21132
+ var value;
21133
21133
 
21134
21134
  while (value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
21135
21135
  result += value;
@@ -21227,7 +21227,7 @@
21227
21227
 
21228
21228
  var matches = tokens.map(function (token) {
21229
21229
  if (typeof token === "object") {
21230
- return new RegExp("^(?:" + token.pattern + ")$", reFlags);
21230
+ return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
21231
21231
  }
21232
21232
  });
21233
21233
  return function (data) {
@@ -21247,19 +21247,19 @@
21247
21247
 
21248
21248
  if (Array.isArray(value)) {
21249
21249
  if (!repeat) {
21250
- throw new TypeError("Expected \"" + token.name + "\" to not repeat, but got an array");
21250
+ throw new TypeError("Expected \"".concat(token.name, "\" to not repeat, but got an array"));
21251
21251
  }
21252
21252
 
21253
21253
  if (value.length === 0) {
21254
21254
  if (optional) continue;
21255
- throw new TypeError("Expected \"" + token.name + "\" to not be empty");
21255
+ throw new TypeError("Expected \"".concat(token.name, "\" to not be empty"));
21256
21256
  }
21257
21257
 
21258
21258
  for (var j = 0; j < value.length; j++) {
21259
21259
  var segment = encode(value[j], token);
21260
21260
 
21261
21261
  if (validate && !matches[i].test(segment)) {
21262
- throw new TypeError("Expected all \"" + token.name + "\" to match \"" + token.pattern + "\", but got \"" + segment + "\"");
21262
+ throw new TypeError("Expected all \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\""));
21263
21263
  }
21264
21264
 
21265
21265
  path += token.prefix + segment + token.suffix;
@@ -21272,7 +21272,7 @@
21272
21272
  var segment = encode(String(value), token);
21273
21273
 
21274
21274
  if (validate && !matches[i].test(segment)) {
21275
- throw new TypeError("Expected \"" + token.name + "\" to match \"" + token.pattern + "\", but got \"" + segment + "\"");
21275
+ throw new TypeError("Expected \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\""));
21276
21276
  }
21277
21277
 
21278
21278
  path += token.prefix + segment + token.suffix;
@@ -21281,7 +21281,7 @@
21281
21281
 
21282
21282
  if (optional) continue;
21283
21283
  var typeOfMessage = repeat ? "an array" : "a string";
21284
- throw new TypeError("Expected \"" + token.name + "\" to be " + typeOfMessage);
21284
+ throw new TypeError("Expected \"".concat(token.name, "\" to be ").concat(typeOfMessage));
21285
21285
  }
21286
21286
 
21287
21287
  return path;
@@ -21336,7 +21336,7 @@
21336
21336
  var parts = paths.map(function (path) {
21337
21337
  return pathToRegexp(path, keys, options).source;
21338
21338
  });
21339
- return new RegExp("(?:" + parts.join("|") + ")", flags(options));
21339
+ return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
21340
21340
  }
21341
21341
  /**
21342
21342
  * Create a path regexp from string input.
@@ -21365,9 +21365,13 @@
21365
21365
  _d = options.encode,
21366
21366
  encode = _d === void 0 ? function (x) {
21367
21367
  return x;
21368
- } : _d;
21369
- var endsWith = "[" + escapeString(options.endsWith || "") + "]|$";
21370
- var delimiter = "[" + escapeString(options.delimiter || "/#?") + "]";
21368
+ } : _d,
21369
+ _e = options.delimiter,
21370
+ delimiter = _e === void 0 ? "/#?" : _e,
21371
+ _f = options.endsWith,
21372
+ endsWith = _f === void 0 ? "" : _f;
21373
+ var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
21374
+ var delimiterRe = "[".concat(escapeString(delimiter), "]");
21371
21375
  var route = start ? "^" : ""; // Iterate over the tokens and create our regexp string.
21372
21376
 
21373
21377
  for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
@@ -21385,33 +21389,36 @@
21385
21389
  if (prefix || suffix) {
21386
21390
  if (token.modifier === "+" || token.modifier === "*") {
21387
21391
  var mod = token.modifier === "*" ? "?" : "";
21388
- route += "(?:" + prefix + "((?:" + token.pattern + ")(?:" + suffix + prefix + "(?:" + token.pattern + "))*)" + suffix + ")" + mod;
21392
+ route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
21389
21393
  } else {
21390
- route += "(?:" + prefix + "(" + token.pattern + ")" + suffix + ")" + token.modifier;
21394
+ route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
21391
21395
  }
21392
21396
  } else {
21393
- route += "(" + token.pattern + ")" + token.modifier;
21397
+ if (token.modifier === "+" || token.modifier === "*") {
21398
+ route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
21399
+ } else {
21400
+ route += "(".concat(token.pattern, ")").concat(token.modifier);
21401
+ }
21394
21402
  }
21395
21403
  } else {
21396
- route += "(?:" + prefix + suffix + ")" + token.modifier;
21404
+ route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
21397
21405
  }
21398
21406
  }
21399
21407
  }
21400
21408
 
21401
21409
  if (end) {
21402
- if (!strict) route += delimiter + "?";
21403
- route += !options.endsWith ? "$" : "(?=" + endsWith + ")";
21410
+ if (!strict) route += "".concat(delimiterRe, "?");
21411
+ route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
21404
21412
  } else {
21405
21413
  var endToken = tokens[tokens.length - 1];
21406
- var isEndDelimited = typeof endToken === "string" ? delimiter.indexOf(endToken[endToken.length - 1]) > -1 : // tslint:disable-next-line
21407
- endToken === undefined;
21414
+ var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === undefined;
21408
21415
 
21409
21416
  if (!strict) {
21410
- route += "(?:" + delimiter + "(?=" + endsWith + "))?";
21417
+ route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
21411
21418
  }
21412
21419
 
21413
21420
  if (!isEndDelimited) {
21414
- route += "(?=" + delimiter + "|" + endsWith + ")";
21421
+ route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
21415
21422
  }
21416
21423
  }
21417
21424