@next-core/brick-utils 2.38.3 → 2.39.2
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 +27 -0
- package/dist/index.bundle.js +37 -24
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +36 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/types/track.d.ts +2 -0
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -2769,9 +2769,7 @@ function cook(rootAst, codeSource) {
|
|
|
2769
2769
|
var name = functionExpression.id.name;
|
|
2770
2770
|
var funcEnv = new DeclarativeEnvironment(scope);
|
|
2771
2771
|
funcEnv.CreateImmutableBinding(name, false);
|
|
2772
|
-
var closure = OrdinaryFunctionCreate(functionExpression,
|
|
2773
|
-
// functionExpression.body,
|
|
2774
|
-
funcEnv, true);
|
|
2772
|
+
var closure = OrdinaryFunctionCreate(functionExpression, funcEnv, true);
|
|
2775
2773
|
funcEnv.InitializeBinding(name, closure);
|
|
2776
2774
|
return closure;
|
|
2777
2775
|
} else {
|
|
@@ -2789,9 +2787,7 @@ function cook(rootAst, codeSource) {
|
|
|
2789
2787
|
} // https://tc39.es/ecma262/#sec-ordinaryfunctioncreate
|
|
2790
2788
|
|
|
2791
2789
|
|
|
2792
|
-
function OrdinaryFunctionCreate(sourceNode,
|
|
2793
|
-
// body: BlockStatement | Expression,
|
|
2794
|
-
scope, isConstructor) {
|
|
2790
|
+
function OrdinaryFunctionCreate(sourceNode, scope, isConstructor) {
|
|
2795
2791
|
var F = function () {
|
|
2796
2792
|
// eslint-disable-next-line prefer-rest-params
|
|
2797
2793
|
return CallFunction(F, arguments);
|
|
@@ -22628,7 +22624,7 @@ function getDependencyMapOfContext(contextConfs) {
|
|
|
22628
22624
|
};
|
|
22629
22625
|
|
|
22630
22626
|
if (!_contextConf2.property) {
|
|
22631
|
-
visitStoryboardExpressions([_contextConf2.if, _contextConf2.value, _contextConf2.resolve], beforeVisitContextFactory(stats, keyword), keyword);
|
|
22627
|
+
visitStoryboardExpressions([_contextConf2.if, _contextConf2.value, _contextConf2.resolve], beforeVisitContextFactory$1(stats, keyword), keyword);
|
|
22632
22628
|
}
|
|
22633
22629
|
|
|
22634
22630
|
depsMap.set(_contextConf2, stats);
|
|
@@ -22637,7 +22633,7 @@ function getDependencyMapOfContext(contextConfs) {
|
|
|
22637
22633
|
return depsMap;
|
|
22638
22634
|
}
|
|
22639
22635
|
|
|
22640
|
-
function beforeVisitContextFactory(stats, keyword) {
|
|
22636
|
+
function beforeVisitContextFactory$1(stats, keyword) {
|
|
22641
22637
|
return function beforeVisitContext(node, parent) {
|
|
22642
22638
|
if (node.name === keyword) {
|
|
22643
22639
|
var memberParent = parent[parent.length - 1];
|
|
@@ -22965,6 +22961,12 @@ function trackContext(raw) {
|
|
|
22965
22961
|
function trackState(raw) {
|
|
22966
22962
|
return track(raw, "track state", "STATE");
|
|
22967
22963
|
}
|
|
22964
|
+
function trackUsedContext(data) {
|
|
22965
|
+
return trackUsed(data, "CTX");
|
|
22966
|
+
}
|
|
22967
|
+
function trackUsedState(data) {
|
|
22968
|
+
return trackUsed(data, "STATE");
|
|
22969
|
+
}
|
|
22968
22970
|
|
|
22969
22971
|
function track(raw, trackText, variableName) {
|
|
22970
22972
|
if (raw.includes(trackText)) {
|
|
@@ -22974,22 +22976,7 @@ function track(raw, trackText, variableName) {
|
|
|
22974
22976
|
} = preevaluate(raw, {
|
|
22975
22977
|
withParent: true,
|
|
22976
22978
|
hooks: {
|
|
22977
|
-
beforeVisitGlobal(
|
|
22978
|
-
if (node.name === variableName) {
|
|
22979
|
-
var memberParent = parent[parent.length - 1];
|
|
22980
|
-
|
|
22981
|
-
if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object") {
|
|
22982
|
-
var memberNode = memberParent.node;
|
|
22983
|
-
|
|
22984
|
-
if (!memberNode.computed && memberNode.property.type === "Identifier") {
|
|
22985
|
-
contexts.add(memberNode.property.name);
|
|
22986
|
-
} else if (memberNode.computed && memberNode.property.type === "Literal" && typeof memberNode.property.value === "string") {
|
|
22987
|
-
contexts.add(memberNode.property.value);
|
|
22988
|
-
}
|
|
22989
|
-
}
|
|
22990
|
-
}
|
|
22991
|
-
}
|
|
22992
|
-
|
|
22979
|
+
beforeVisitGlobal: beforeVisitContextFactory(contexts, variableName)
|
|
22993
22980
|
}
|
|
22994
22981
|
});
|
|
22995
22982
|
var trackCtxExp;
|
|
@@ -23007,6 +22994,30 @@ function track(raw, trackText, variableName) {
|
|
|
23007
22994
|
return false;
|
|
23008
22995
|
}
|
|
23009
22996
|
|
|
22997
|
+
function trackUsed(data, variableName) {
|
|
22998
|
+
var contexts = new Set();
|
|
22999
|
+
visitStoryboardExpressions(data, beforeVisitContextFactory(contexts, variableName), variableName);
|
|
23000
|
+
return Array.from(contexts);
|
|
23001
|
+
}
|
|
23002
|
+
|
|
23003
|
+
function beforeVisitContextFactory(contexts, variableName) {
|
|
23004
|
+
return function beforeVisitContext(node, parent) {
|
|
23005
|
+
if (node.name === variableName) {
|
|
23006
|
+
var memberParent = parent[parent.length - 1];
|
|
23007
|
+
|
|
23008
|
+
if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object") {
|
|
23009
|
+
var memberNode = memberParent.node;
|
|
23010
|
+
|
|
23011
|
+
if (!memberNode.computed && memberNode.property.type === "Identifier") {
|
|
23012
|
+
contexts.add(memberNode.property.name);
|
|
23013
|
+
} else if (memberNode.computed && memberNode.property.type === "Literal" && typeof memberNode.property.value === "string") {
|
|
23014
|
+
contexts.add(memberNode.property.value);
|
|
23015
|
+
}
|
|
23016
|
+
}
|
|
23017
|
+
}
|
|
23018
|
+
};
|
|
23019
|
+
}
|
|
23020
|
+
|
|
23010
23021
|
// The debounce function receives our function as a parameter
|
|
23011
23022
|
function debounceByAnimationFrame(fn) {
|
|
23012
23023
|
// This holds the requestAnimationFrame reference, so we can cancel it if we wish
|
|
@@ -23063,5 +23074,5 @@ function beforeVisitInstalledAppsFactory(collection) {
|
|
|
23063
23074
|
};
|
|
23064
23075
|
}
|
|
23065
23076
|
|
|
23066
|
-
export { JsonStorage, PrecookFunctionVisitor, PrecookVisitor, asyncProcessBrick, asyncProcessStoryboard, computeRealRoutePath, convertValueByPrecision, cook, createProviderClass, debounceByAnimationFrame, deepFreeze, formatValue, getDependencyMapOfContext, getDepsOfTemplates, getDllAndDepsByResource, getDllAndDepsOfBricks, getDllAndDepsOfStoryboard, getTemplateDepsOfStoryboard, hasOwnProperty$1 as hasOwnProperty, inject, isBrickNode, isCustomTemplateNode, isEvaluable, isObject, isRouteNode, isSnippetNode, lint, loadScript, mapCustomApisToNameAndNamespace, matchPath, normalizeBuilderNode, normalizeMenu, parseForAnalysis, precook, precookFunction, preevaluate, prefetchScript, resolveContextConcurrently, restoreDynamicTemplates, scanAppGetMenuInAny, scanAppGetMenuInStoryboard, scanBricksInBrickConf, scanBricksInStoryboard, scanCustomApisInStoryboard, scanI18NInAny, scanI18NInStoryboard, scanInstalledAppsInStoryboard, scanPermissionActionsInAny, scanPermissionActionsInStoryboard, scanProcessorsInAny, scanProcessorsInStoryboard, scanRouteAliasInStoryboard, scanStoryboard, scanTemplatesInBrick, scanTemplatesInStoryboard, shouldAllowRecursiveEvaluations, smartDisplayForEvaluableString, syncResolveContextConcurrently, toPath, tokTypes_1 as tokTypes, trackContext, trackState, transform, transformAndInject, visitStoryboardExpressions, visitStoryboardFunctions };
|
|
23077
|
+
export { JsonStorage, PrecookFunctionVisitor, PrecookVisitor, asyncProcessBrick, asyncProcessStoryboard, computeRealRoutePath, convertValueByPrecision, cook, createProviderClass, debounceByAnimationFrame, deepFreeze, formatValue, getDependencyMapOfContext, getDepsOfTemplates, getDllAndDepsByResource, getDllAndDepsOfBricks, getDllAndDepsOfStoryboard, getTemplateDepsOfStoryboard, hasOwnProperty$1 as hasOwnProperty, inject, isBrickNode, isCustomTemplateNode, isEvaluable, isObject, isRouteNode, isSnippetNode, lint, loadScript, mapCustomApisToNameAndNamespace, matchPath, normalizeBuilderNode, normalizeMenu, parseForAnalysis, precook, precookFunction, preevaluate, prefetchScript, resolveContextConcurrently, restoreDynamicTemplates, scanAppGetMenuInAny, scanAppGetMenuInStoryboard, scanBricksInBrickConf, scanBricksInStoryboard, scanCustomApisInStoryboard, scanI18NInAny, scanI18NInStoryboard, scanInstalledAppsInStoryboard, scanPermissionActionsInAny, scanPermissionActionsInStoryboard, scanProcessorsInAny, scanProcessorsInStoryboard, scanRouteAliasInStoryboard, scanStoryboard, scanTemplatesInBrick, scanTemplatesInStoryboard, shouldAllowRecursiveEvaluations, smartDisplayForEvaluableString, syncResolveContextConcurrently, toPath, tokTypes_1 as tokTypes, trackContext, trackState, trackUsedContext, trackUsedState, transform, transformAndInject, visitStoryboardExpressions, visitStoryboardFunctions };
|
|
23067
23078
|
//# sourceMappingURL=index.esm.js.map
|