@next-core/brick-utils 2.52.3 → 2.52.5
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.bundle.js +49 -12
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +48 -13
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
package/dist/index.bundle.js
CHANGED
|
@@ -1149,6 +1149,8 @@
|
|
|
1149
1149
|
// Currently unicode flag is not fully supported across major browsers.
|
|
1150
1150
|
throw new SyntaxError("Unsupported unicode flag in regular expression: ".concat(node.raw));
|
|
1151
1151
|
}
|
|
1152
|
+
// Always create a new RegExp, because the AST will be reused.
|
|
1153
|
+
return NormalCompletion(new RegExp(node.regex.pattern, node.regex.flags));
|
|
1152
1154
|
}
|
|
1153
1155
|
return NormalCompletion(node.value);
|
|
1154
1156
|
}
|
|
@@ -2845,13 +2847,13 @@
|
|
|
2845
2847
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
2846
2848
|
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
2847
2849
|
};
|
|
2848
|
-
var _excluded$1 = ["toMessage"],
|
|
2850
|
+
var _excluded$1$1 = ["toMessage"],
|
|
2849
2851
|
_excluded2$1 = ["message"];
|
|
2850
2852
|
function toParseErrorConstructor(_ref) {
|
|
2851
2853
|
var {
|
|
2852
2854
|
toMessage
|
|
2853
2855
|
} = _ref,
|
|
2854
|
-
properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2856
|
+
properties = _objectWithoutPropertiesLoose(_ref, _excluded$1$1);
|
|
2855
2857
|
return function constructor(_ref39) {
|
|
2856
2858
|
var {
|
|
2857
2859
|
loc,
|
|
@@ -17473,32 +17475,56 @@
|
|
|
17473
17475
|
return errors;
|
|
17474
17476
|
}
|
|
17475
17477
|
|
|
17476
|
-
var _excluded = ["typescript"];
|
|
17478
|
+
var _excluded$1 = ["typescript", "cacheKey"];
|
|
17479
|
+
var ASTCache$1 = new WeakMap();
|
|
17477
17480
|
function precookFunction(source) {
|
|
17478
17481
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
17479
17482
|
{
|
|
17480
|
-
typescript
|
|
17483
|
+
typescript,
|
|
17484
|
+
cacheKey
|
|
17481
17485
|
} = _ref,
|
|
17482
|
-
restOptions = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
17483
|
-
var func =
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
+
restOptions = _objectWithoutProperties__default["default"](_ref, _excluded$1);
|
|
17487
|
+
var func = cacheKey ? ASTCache$1.get(cacheKey) : undefined;
|
|
17488
|
+
if (!func) {
|
|
17489
|
+
func = parseAsEstree(source, {
|
|
17490
|
+
typescript
|
|
17491
|
+
});
|
|
17492
|
+
if (cacheKey) {
|
|
17493
|
+
ASTCache$1.set(cacheKey, func);
|
|
17494
|
+
}
|
|
17495
|
+
}
|
|
17486
17496
|
var attemptToVisitGlobals = precook(func, restOptions);
|
|
17487
17497
|
return {
|
|
17488
17498
|
function: func,
|
|
17489
17499
|
attemptToVisitGlobals
|
|
17490
17500
|
};
|
|
17491
17501
|
}
|
|
17502
|
+
function clearFunctionASTCache() {
|
|
17503
|
+
ASTCache$1 = new WeakMap();
|
|
17504
|
+
}
|
|
17492
17505
|
|
|
17506
|
+
var _excluded = ["cache"];
|
|
17507
|
+
var ASTCache = new Map();
|
|
17493
17508
|
// `raw` should always be asserted by `isEvaluable`.
|
|
17494
|
-
function preevaluate(raw
|
|
17509
|
+
function preevaluate(raw) {
|
|
17510
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
17511
|
+
{
|
|
17512
|
+
cache
|
|
17513
|
+
} = _ref,
|
|
17514
|
+
restOptions = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
17495
17515
|
var fixes = [];
|
|
17496
17516
|
var source = raw.replace(/^\s*<%[~=!]?\s|\s%>\s*$/g, m => {
|
|
17497
17517
|
fixes.push(m);
|
|
17498
17518
|
return "";
|
|
17499
17519
|
});
|
|
17500
|
-
var expression =
|
|
17501
|
-
|
|
17520
|
+
var expression = cache ? ASTCache.get(source) : undefined;
|
|
17521
|
+
if (!expression) {
|
|
17522
|
+
expression = parseAsEstreeExpression(source);
|
|
17523
|
+
if (cache) {
|
|
17524
|
+
ASTCache.set(source, expression);
|
|
17525
|
+
}
|
|
17526
|
+
}
|
|
17527
|
+
var attemptToVisitGlobals = precook(expression, _objectSpread__default["default"](_objectSpread__default["default"]({}, restOptions), {}, {
|
|
17502
17528
|
expressionOnly: true
|
|
17503
17529
|
}));
|
|
17504
17530
|
return {
|
|
@@ -17521,6 +17547,9 @@
|
|
|
17521
17547
|
function isTrackAll(raw) {
|
|
17522
17548
|
return /^\s*<%=\s/.test(raw) && /\s%>\s*$/.test(raw);
|
|
17523
17549
|
}
|
|
17550
|
+
function clearExpressionASTCache() {
|
|
17551
|
+
ASTCache.clear();
|
|
17552
|
+
}
|
|
17524
17553
|
|
|
17525
17554
|
// istanbul ignore file
|
|
17526
17555
|
|
|
@@ -17555,6 +17584,7 @@
|
|
|
17555
17584
|
}
|
|
17556
17585
|
try {
|
|
17557
17586
|
precookFunction(fn.source, {
|
|
17587
|
+
cacheKey: fn,
|
|
17558
17588
|
typescript: fn.typescript,
|
|
17559
17589
|
withParent: true,
|
|
17560
17590
|
hooks: {
|
|
@@ -17585,6 +17615,7 @@
|
|
|
17585
17615
|
if (matchExpressionString(value) && customIsEvaluable(value)) {
|
|
17586
17616
|
try {
|
|
17587
17617
|
preevaluate(value, {
|
|
17618
|
+
cache: true,
|
|
17588
17619
|
withParent: true,
|
|
17589
17620
|
hooks: {
|
|
17590
17621
|
beforeVisitGlobal
|
|
@@ -19630,6 +19661,7 @@
|
|
|
19630
19661
|
var {
|
|
19631
19662
|
expression
|
|
19632
19663
|
} = preevaluate(raw, {
|
|
19664
|
+
cache: true,
|
|
19633
19665
|
withParent: true,
|
|
19634
19666
|
hooks: {
|
|
19635
19667
|
beforeVisitGlobal: beforeVisitContextFactory(usage, variableName)
|
|
@@ -19656,6 +19688,7 @@
|
|
|
19656
19688
|
includesComputed: false
|
|
19657
19689
|
};
|
|
19658
19690
|
preevaluate(raw, {
|
|
19691
|
+
cache: true,
|
|
19659
19692
|
withParent: true,
|
|
19660
19693
|
hooks: {
|
|
19661
19694
|
beforeVisitGlobal: beforeVisitContextFactory(usage, TRACK_NAMES, true)
|
|
@@ -20453,7 +20486,9 @@
|
|
|
20453
20486
|
expression,
|
|
20454
20487
|
attemptToVisitGlobals,
|
|
20455
20488
|
source
|
|
20456
|
-
} = preevaluate(ifContainer.if
|
|
20489
|
+
} = preevaluate(ifContainer.if, {
|
|
20490
|
+
cache: true
|
|
20491
|
+
});
|
|
20457
20492
|
var {
|
|
20458
20493
|
constantFeatureFlags,
|
|
20459
20494
|
featureFlags
|
|
@@ -20752,6 +20787,8 @@
|
|
|
20752
20787
|
exports.PrecookVisitor = PrecookVisitor;
|
|
20753
20788
|
exports.asyncProcessBrick = asyncProcessBrick;
|
|
20754
20789
|
exports.asyncProcessStoryboard = asyncProcessStoryboard;
|
|
20790
|
+
exports.clearExpressionASTCache = clearExpressionASTCache;
|
|
20791
|
+
exports.clearFunctionASTCache = clearFunctionASTCache;
|
|
20755
20792
|
exports.collectBricksByCustomTemplates = collectBricksByCustomTemplates;
|
|
20756
20793
|
exports.collectContextUsage = collectContextUsage;
|
|
20757
20794
|
exports.computeConstantCondition = computeConstantCondition;
|