@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.esm.js
CHANGED
|
@@ -1143,6 +1143,8 @@ function cook(rootAst, codeSource) {
|
|
|
1143
1143
|
// Currently unicode flag is not fully supported across major browsers.
|
|
1144
1144
|
throw new SyntaxError("Unsupported unicode flag in regular expression: ".concat(node.raw));
|
|
1145
1145
|
}
|
|
1146
|
+
// Always create a new RegExp, because the AST will be reused.
|
|
1147
|
+
return NormalCompletion(new RegExp(node.regex.pattern, node.regex.flags));
|
|
1146
1148
|
}
|
|
1147
1149
|
return NormalCompletion(node.value);
|
|
1148
1150
|
}
|
|
@@ -2839,13 +2841,13 @@ var PipelineOperatorErrors = {
|
|
|
2839
2841
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
|
2840
2842
|
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
|
2841
2843
|
};
|
|
2842
|
-
var _excluded$1 = ["toMessage"],
|
|
2844
|
+
var _excluded$1$1 = ["toMessage"],
|
|
2843
2845
|
_excluded2$1 = ["message"];
|
|
2844
2846
|
function toParseErrorConstructor(_ref) {
|
|
2845
2847
|
var {
|
|
2846
2848
|
toMessage
|
|
2847
2849
|
} = _ref,
|
|
2848
|
-
properties = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2850
|
+
properties = _objectWithoutPropertiesLoose(_ref, _excluded$1$1);
|
|
2849
2851
|
return function constructor(_ref39) {
|
|
2850
2852
|
var {
|
|
2851
2853
|
loc,
|
|
@@ -17467,32 +17469,56 @@ function lint(source) {
|
|
|
17467
17469
|
return errors;
|
|
17468
17470
|
}
|
|
17469
17471
|
|
|
17470
|
-
var _excluded = ["typescript"];
|
|
17472
|
+
var _excluded$1 = ["typescript", "cacheKey"];
|
|
17473
|
+
var ASTCache$1 = new WeakMap();
|
|
17471
17474
|
function precookFunction(source) {
|
|
17472
17475
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
17473
17476
|
{
|
|
17474
|
-
typescript
|
|
17477
|
+
typescript,
|
|
17478
|
+
cacheKey
|
|
17475
17479
|
} = _ref,
|
|
17476
|
-
restOptions = _objectWithoutProperties(_ref, _excluded);
|
|
17477
|
-
var func =
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
+
restOptions = _objectWithoutProperties(_ref, _excluded$1);
|
|
17481
|
+
var func = cacheKey ? ASTCache$1.get(cacheKey) : undefined;
|
|
17482
|
+
if (!func) {
|
|
17483
|
+
func = parseAsEstree(source, {
|
|
17484
|
+
typescript
|
|
17485
|
+
});
|
|
17486
|
+
if (cacheKey) {
|
|
17487
|
+
ASTCache$1.set(cacheKey, func);
|
|
17488
|
+
}
|
|
17489
|
+
}
|
|
17480
17490
|
var attemptToVisitGlobals = precook(func, restOptions);
|
|
17481
17491
|
return {
|
|
17482
17492
|
function: func,
|
|
17483
17493
|
attemptToVisitGlobals
|
|
17484
17494
|
};
|
|
17485
17495
|
}
|
|
17496
|
+
function clearFunctionASTCache() {
|
|
17497
|
+
ASTCache$1 = new WeakMap();
|
|
17498
|
+
}
|
|
17486
17499
|
|
|
17500
|
+
var _excluded = ["cache"];
|
|
17501
|
+
var ASTCache = new Map();
|
|
17487
17502
|
// `raw` should always be asserted by `isEvaluable`.
|
|
17488
|
-
function preevaluate(raw
|
|
17503
|
+
function preevaluate(raw) {
|
|
17504
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
17505
|
+
{
|
|
17506
|
+
cache
|
|
17507
|
+
} = _ref,
|
|
17508
|
+
restOptions = _objectWithoutProperties(_ref, _excluded);
|
|
17489
17509
|
var fixes = [];
|
|
17490
17510
|
var source = raw.replace(/^\s*<%[~=!]?\s|\s%>\s*$/g, m => {
|
|
17491
17511
|
fixes.push(m);
|
|
17492
17512
|
return "";
|
|
17493
17513
|
});
|
|
17494
|
-
var expression =
|
|
17495
|
-
|
|
17514
|
+
var expression = cache ? ASTCache.get(source) : undefined;
|
|
17515
|
+
if (!expression) {
|
|
17516
|
+
expression = parseAsEstreeExpression(source);
|
|
17517
|
+
if (cache) {
|
|
17518
|
+
ASTCache.set(source, expression);
|
|
17519
|
+
}
|
|
17520
|
+
}
|
|
17521
|
+
var attemptToVisitGlobals = precook(expression, _objectSpread(_objectSpread({}, restOptions), {}, {
|
|
17496
17522
|
expressionOnly: true
|
|
17497
17523
|
}));
|
|
17498
17524
|
return {
|
|
@@ -17515,6 +17541,9 @@ function isSnippetEvaluation(raw) {
|
|
|
17515
17541
|
function isTrackAll(raw) {
|
|
17516
17542
|
return /^\s*<%=\s/.test(raw) && /\s%>\s*$/.test(raw);
|
|
17517
17543
|
}
|
|
17544
|
+
function clearExpressionASTCache() {
|
|
17545
|
+
ASTCache.clear();
|
|
17546
|
+
}
|
|
17518
17547
|
|
|
17519
17548
|
// istanbul ignore file
|
|
17520
17549
|
|
|
@@ -17549,6 +17578,7 @@ function visitStoryboardFunctions(functions, beforeVisitGlobal, options) {
|
|
|
17549
17578
|
}
|
|
17550
17579
|
try {
|
|
17551
17580
|
precookFunction(fn.source, {
|
|
17581
|
+
cacheKey: fn,
|
|
17552
17582
|
typescript: fn.typescript,
|
|
17553
17583
|
withParent: true,
|
|
17554
17584
|
hooks: {
|
|
@@ -17579,6 +17609,7 @@ options) {
|
|
|
17579
17609
|
if (matchExpressionString(value) && customIsEvaluable(value)) {
|
|
17580
17610
|
try {
|
|
17581
17611
|
preevaluate(value, {
|
|
17612
|
+
cache: true,
|
|
17582
17613
|
withParent: true,
|
|
17583
17614
|
hooks: {
|
|
17584
17615
|
beforeVisitGlobal
|
|
@@ -19624,6 +19655,7 @@ function track(raw, trackText, variableName) {
|
|
|
19624
19655
|
var {
|
|
19625
19656
|
expression
|
|
19626
19657
|
} = preevaluate(raw, {
|
|
19658
|
+
cache: true,
|
|
19627
19659
|
withParent: true,
|
|
19628
19660
|
hooks: {
|
|
19629
19661
|
beforeVisitGlobal: beforeVisitContextFactory(usage, variableName)
|
|
@@ -19650,6 +19682,7 @@ function trackAll(raw) {
|
|
|
19650
19682
|
includesComputed: false
|
|
19651
19683
|
};
|
|
19652
19684
|
preevaluate(raw, {
|
|
19685
|
+
cache: true,
|
|
19653
19686
|
withParent: true,
|
|
19654
19687
|
hooks: {
|
|
19655
19688
|
beforeVisitGlobal: beforeVisitContextFactory(usage, TRACK_NAMES, true)
|
|
@@ -20447,7 +20480,9 @@ function computeConstantCondition(ifContainer) {
|
|
|
20447
20480
|
expression,
|
|
20448
20481
|
attemptToVisitGlobals,
|
|
20449
20482
|
source
|
|
20450
|
-
} = preevaluate(ifContainer.if
|
|
20483
|
+
} = preevaluate(ifContainer.if, {
|
|
20484
|
+
cache: true
|
|
20485
|
+
});
|
|
20451
20486
|
var {
|
|
20452
20487
|
constantFeatureFlags,
|
|
20453
20488
|
featureFlags
|
|
@@ -20737,5 +20772,5 @@ function snippetEvaluate(brickConf, context) {
|
|
|
20737
20772
|
return result;
|
|
20738
20773
|
}
|
|
20739
20774
|
|
|
20740
|
-
export { JsonStorage, PrecookFunctionVisitor, PrecookVisitor, asyncProcessBrick, asyncProcessStoryboard, collectBricksByCustomTemplates, collectContextUsage, computeConstantCondition, computeRealRoutePath, convertValueByPrecision, cook, createProviderClass, debounceByAnimationFrame, deepFreeze, deferResolveContextConcurrently, formatValue, getDependencyMapOfContext, getDepsOfTemplates, getDllAndDepsByResource, getDllAndDepsOfBricks, getDllAndDepsOfStoryboard, getTemplateDepsOfStoryboard, hasOwnProperty$1 as hasOwnProperty, inject, isBrickNode, isCustomTemplateNode, isEvaluable, isObject$1 as isObject, isRouteNode, isSnippetEvaluation, isSnippetNode, isTrackAll, lint, loadScript, makeThrottledAggregation, mapCustomApisToNameAndNamespace, matchPath, normalizeBuilderNode, normalizeMenu, parseBrick, parseForAnalysis, parseRoutes, parseStoryboard, parseTemplate, parseTemplates, precook, precookFunction, preevaluate, prefetchScript, removeDeadConditions, removeDeadConditionsInTpl, resolveContextConcurrently, restoreDynamicTemplates, scanAppGetMenuInAny, scanAppGetMenuInStoryboard, scanBricksInBrickConf, scanBricksInStoryboard, scanCustomApisInStoryboard, scanI18NInAny, scanI18NInStoryboard, scanInstalledAppsInStoryboard, scanPermissionActionsInAny, scanPermissionActionsInStoryboard, scanProcessorsInAny, scanProcessorsInStoryboard, scanRouteAliasInStoryboard, scanStoryboard, scanStoryboardAst, scanTemplatesInBrick, scanTemplatesInStoryboard, shouldAllowRecursiveEvaluations, smartDisplayForEvaluableString, snippetEvaluate, syncResolveContextConcurrently, toPath, tokTypes_1 as tokTypes, trackAll, trackContext, trackFormState, trackState, trackUsedContext, trackUsedFormState, trackUsedState, transform, transformAndInject, traverse, traverseStoryboard, visitStoryboardExpressions, visitStoryboardFunctions };
|
|
20775
|
+
export { JsonStorage, PrecookFunctionVisitor, PrecookVisitor, asyncProcessBrick, asyncProcessStoryboard, clearExpressionASTCache, clearFunctionASTCache, collectBricksByCustomTemplates, collectContextUsage, computeConstantCondition, computeRealRoutePath, convertValueByPrecision, cook, createProviderClass, debounceByAnimationFrame, deepFreeze, deferResolveContextConcurrently, formatValue, getDependencyMapOfContext, getDepsOfTemplates, getDllAndDepsByResource, getDllAndDepsOfBricks, getDllAndDepsOfStoryboard, getTemplateDepsOfStoryboard, hasOwnProperty$1 as hasOwnProperty, inject, isBrickNode, isCustomTemplateNode, isEvaluable, isObject$1 as isObject, isRouteNode, isSnippetEvaluation, isSnippetNode, isTrackAll, lint, loadScript, makeThrottledAggregation, mapCustomApisToNameAndNamespace, matchPath, normalizeBuilderNode, normalizeMenu, parseBrick, parseForAnalysis, parseRoutes, parseStoryboard, parseTemplate, parseTemplates, precook, precookFunction, preevaluate, prefetchScript, removeDeadConditions, removeDeadConditionsInTpl, resolveContextConcurrently, restoreDynamicTemplates, scanAppGetMenuInAny, scanAppGetMenuInStoryboard, scanBricksInBrickConf, scanBricksInStoryboard, scanCustomApisInStoryboard, scanI18NInAny, scanI18NInStoryboard, scanInstalledAppsInStoryboard, scanPermissionActionsInAny, scanPermissionActionsInStoryboard, scanProcessorsInAny, scanProcessorsInStoryboard, scanRouteAliasInStoryboard, scanStoryboard, scanStoryboardAst, scanTemplatesInBrick, scanTemplatesInStoryboard, shouldAllowRecursiveEvaluations, smartDisplayForEvaluableString, snippetEvaluate, syncResolveContextConcurrently, toPath, tokTypes_1 as tokTypes, trackAll, trackContext, trackFormState, trackState, trackUsedContext, trackUsedFormState, trackUsedState, transform, transformAndInject, traverse, traverseStoryboard, visitStoryboardExpressions, visitStoryboardFunctions };
|
|
20741
20776
|
//# sourceMappingURL=index.esm.js.map
|