@next-core/brick-utils 2.31.0 → 2.31.1

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.esm.js CHANGED
@@ -18497,6 +18497,7 @@ function precook(rootAst) {
18497
18497
  var {
18498
18498
  expressionOnly,
18499
18499
  visitors,
18500
+ withParent,
18500
18501
  hooks = {}
18501
18502
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18502
18503
  var attemptToVisitGlobals = new Set();
@@ -18517,16 +18518,27 @@ function precook(rootAst) {
18517
18518
  }
18518
18519
  }
18519
18520
 
18520
- function Evaluate(node) {
18521
+ function EvaluateChildren(node, keys, parent) {
18522
+ for (var key of keys) {
18523
+ Evaluate(node[key], parent === null || parent === void 0 ? void 0 : parent.concat({
18524
+ node,
18525
+ key
18526
+ }));
18527
+ }
18528
+ }
18529
+
18530
+ function Evaluate(node, parent) {
18521
18531
  if (Array.isArray(node)) {
18522
- for (var n of node) {
18523
- Evaluate(n);
18524
- }
18532
+ node.forEach((n, index) => {
18533
+ Evaluate(n, parent ? parent.slice(0, -1).concat(_objectSpread(_objectSpread({}, parent[parent.length - 1]), {}, {
18534
+ index
18535
+ })) : parent);
18536
+ });
18525
18537
  } else if (node) {
18526
18538
  var _hooks$beforeVisit, _hooks$beforeVisitUnk; // `node` maybe `null` in some cases.
18527
18539
 
18528
18540
 
18529
- (_hooks$beforeVisit = hooks.beforeVisit) === null || _hooks$beforeVisit === void 0 ? void 0 : _hooks$beforeVisit.call(hooks, node);
18541
+ (_hooks$beforeVisit = hooks.beforeVisit) === null || _hooks$beforeVisit === void 0 ? void 0 : _hooks$beforeVisit.call(hooks, node, parent);
18530
18542
  visitors && visit(node); // Expressions:
18531
18543
 
18532
18544
  switch (node.type) {
@@ -18534,7 +18546,7 @@ function precook(rootAst) {
18534
18546
  if (!ResolveBinding(node.name)) {
18535
18547
  var _hooks$beforeVisitGlo;
18536
18548
 
18537
- (_hooks$beforeVisitGlo = hooks.beforeVisitGlobal) === null || _hooks$beforeVisitGlo === void 0 ? void 0 : _hooks$beforeVisitGlo.call(hooks, node);
18549
+ (_hooks$beforeVisitGlo = hooks.beforeVisitGlobal) === null || _hooks$beforeVisitGlo === void 0 ? void 0 : _hooks$beforeVisitGlo.call(hooks, node, parent);
18538
18550
  attemptToVisitGlobals.add(node.name);
18539
18551
  }
18540
18552
 
@@ -18542,76 +18554,71 @@ function precook(rootAst) {
18542
18554
 
18543
18555
  case "ArrayExpression":
18544
18556
  case "ArrayPattern":
18545
- Evaluate(node.elements);
18557
+ EvaluateChildren(node, ["elements"], parent);
18546
18558
  return;
18547
18559
 
18548
18560
  case "ArrowFunctionExpression":
18549
18561
  {
18550
18562
  var env = getRunningContext().LexicalEnvironment;
18551
18563
  var closure = OrdinaryFunctionCreate(node, env);
18552
- CallFunction(closure);
18564
+ CallFunction(closure, parent);
18553
18565
  return;
18554
18566
  }
18555
18567
 
18556
18568
  case "AssignmentPattern":
18557
18569
  case "BinaryExpression":
18558
18570
  case "LogicalExpression":
18559
- Evaluate(node.left);
18560
- Evaluate(node.right);
18571
+ EvaluateChildren(node, ["left", "right"], parent);
18561
18572
  return;
18562
18573
 
18563
18574
  case "CallExpression":
18564
18575
  case "NewExpression":
18565
- Evaluate(node.callee);
18566
- Evaluate(node.arguments);
18576
+ EvaluateChildren(node, ["callee", "arguments"], parent);
18567
18577
  return;
18568
18578
 
18569
18579
  case "ChainExpression":
18570
- Evaluate(node.expression);
18580
+ EvaluateChildren(node, ["expression"], parent);
18571
18581
  return;
18572
18582
 
18573
18583
  case "ConditionalExpression":
18574
- Evaluate(node.test);
18575
- Evaluate(node.consequent);
18576
- Evaluate(node.alternate);
18584
+ EvaluateChildren(node, ["test", "consequent", "alternate"], parent);
18577
18585
  return;
18578
18586
 
18579
18587
  case "MemberExpression":
18580
- Evaluate(node.object);
18588
+ EvaluateChildren(node, ["object"], parent);
18581
18589
 
18582
18590
  if (node.computed) {
18583
- Evaluate(node.property);
18591
+ EvaluateChildren(node, ["property"], parent);
18584
18592
  }
18585
18593
 
18586
18594
  return;
18587
18595
 
18588
18596
  case "ObjectExpression":
18589
18597
  case "ObjectPattern":
18590
- Evaluate(node.properties);
18598
+ EvaluateChildren(node, ["properties"], parent);
18591
18599
  return;
18592
18600
 
18593
18601
  case "Property":
18594
18602
  if (node.computed) {
18595
- Evaluate(node.key);
18603
+ EvaluateChildren(node, ["key"], parent);
18596
18604
  }
18597
18605
 
18598
- Evaluate(node.value);
18606
+ EvaluateChildren(node, ["value"], parent);
18599
18607
  return;
18600
18608
 
18601
18609
  case "RestElement":
18602
18610
  case "SpreadElement":
18603
18611
  case "UnaryExpression":
18604
- Evaluate(node.argument);
18612
+ EvaluateChildren(node, ["argument"], parent);
18605
18613
  return;
18606
18614
 
18607
18615
  case "SequenceExpression":
18608
18616
  case "TemplateLiteral":
18609
- Evaluate(node.expressions);
18617
+ EvaluateChildren(node, ["expressions"], parent);
18610
18618
  return;
18611
18619
 
18612
18620
  case "TaggedTemplateExpression":
18613
- Evaluate(node.tag);
18614
- Evaluate(node.quasi);
18621
+ EvaluateChildren(node, ["tag", "quasi"], parent);
18615
18622
  return;
18616
18623
 
18617
18624
  case "Literal":
@@ -18622,8 +18629,7 @@ function precook(rootAst) {
18622
18629
  // Statements and assignments:
18623
18630
  switch (node.type) {
18624
18631
  case "AssignmentExpression":
18625
- Evaluate(node.right);
18626
- Evaluate(node.left);
18632
+ EvaluateChildren(node, ["right", "left"], parent);
18627
18633
  return;
18628
18634
 
18629
18635
  case "BlockStatement":
@@ -18637,7 +18643,7 @@ function precook(rootAst) {
18637
18643
  var blockEnv = new AnalysisEnvironment(oldEnv);
18638
18644
  BlockDeclarationInstantiation(node.body, blockEnv);
18639
18645
  runningContext.LexicalEnvironment = blockEnv;
18640
- Evaluate(node.body);
18646
+ EvaluateChildren(node, ["body"], parent);
18641
18647
  runningContext.LexicalEnvironment = oldEnv;
18642
18648
  return;
18643
18649
  }
@@ -18655,20 +18661,18 @@ function precook(rootAst) {
18655
18661
  var catchEnv = new AnalysisEnvironment(_oldEnv);
18656
18662
  BoundNamesInstantiation(node.param, catchEnv);
18657
18663
  _runningContext.LexicalEnvironment = catchEnv;
18658
- Evaluate(node.param);
18659
- Evaluate(node.body);
18664
+ EvaluateChildren(node, ["param", "body"], parent);
18660
18665
  _runningContext.LexicalEnvironment = _oldEnv;
18661
18666
  return;
18662
18667
  }
18663
18668
 
18664
18669
  case "DoWhileStatement":
18665
- Evaluate(node.body);
18666
- Evaluate(node.test);
18670
+ EvaluateChildren(node, ["body", "test"], parent);
18667
18671
  return;
18668
18672
 
18669
18673
  case "ExpressionStatement":
18670
18674
  case "TSAsExpression":
18671
- Evaluate(node.expression);
18675
+ EvaluateChildren(node, ["expression"], parent);
18672
18676
  return;
18673
18677
 
18674
18678
  case "ForInStatement":
@@ -18687,7 +18691,7 @@ function precook(rootAst) {
18687
18691
  _runningContext2.LexicalEnvironment = newEnv;
18688
18692
  }
18689
18693
 
18690
- Evaluate(node.right);
18694
+ EvaluateChildren(node, ["right"], parent);
18691
18695
  _runningContext2.LexicalEnvironment = _oldEnv2; // ForIn/OfBodyEvaluation
18692
18696
 
18693
18697
  if (lexicalBinding) {
@@ -18696,8 +18700,7 @@ function precook(rootAst) {
18696
18700
  _runningContext2.LexicalEnvironment = iterationEnv;
18697
18701
  }
18698
18702
 
18699
- Evaluate(node.left);
18700
- Evaluate(node.body);
18703
+ EvaluateChildren(node, ["left", "body"], parent);
18701
18704
  _runningContext2.LexicalEnvironment = _oldEnv2;
18702
18705
  return;
18703
18706
  }
@@ -18718,10 +18721,7 @@ function precook(rootAst) {
18718
18721
  _runningContext3.LexicalEnvironment = loopEnv;
18719
18722
  }
18720
18723
 
18721
- Evaluate(node.init);
18722
- Evaluate(node.test);
18723
- Evaluate(node.body);
18724
- Evaluate(node.update);
18724
+ EvaluateChildren(node, ["init", "test", "body", "update"], parent);
18725
18725
  _runningContext3.LexicalEnvironment = _oldEnv3;
18726
18726
  return;
18727
18727
  }
@@ -18734,7 +18734,7 @@ function precook(rootAst) {
18734
18734
 
18735
18735
  _env.CreateBinding(fn);
18736
18736
 
18737
- CallFunction(fo);
18737
+ CallFunction(fo, parent);
18738
18738
  return;
18739
18739
  }
18740
18740
 
@@ -18742,30 +18742,27 @@ function precook(rootAst) {
18742
18742
  {
18743
18743
  var _closure = InstantiateOrdinaryFunctionExpression(node);
18744
18744
 
18745
- CallFunction(_closure);
18745
+ CallFunction(_closure, parent);
18746
18746
  return;
18747
18747
  }
18748
18748
 
18749
18749
  case "IfStatement":
18750
- Evaluate(node.test);
18751
- Evaluate(node.consequent);
18752
- Evaluate(node.alternate);
18750
+ EvaluateChildren(node, ["test", "consequent", "alternate"], parent);
18753
18751
  return;
18754
18752
 
18755
18753
  case "ReturnStatement":
18756
18754
  case "ThrowStatement":
18757
18755
  case "UpdateExpression":
18758
- Evaluate(node.argument);
18756
+ EvaluateChildren(node, ["argument"], parent);
18759
18757
  return;
18760
18758
 
18761
18759
  case "SwitchCase":
18762
- Evaluate(node.test);
18763
- Evaluate(node.consequent);
18760
+ EvaluateChildren(node, ["test", "consequent"], parent);
18764
18761
  return;
18765
18762
 
18766
18763
  case "SwitchStatement":
18767
18764
  {
18768
- Evaluate(node.discriminant);
18765
+ EvaluateChildren(node, ["discriminant"], parent);
18769
18766
 
18770
18767
  var _runningContext4 = getRunningContext();
18771
18768
 
@@ -18775,34 +18772,30 @@ function precook(rootAst) {
18775
18772
 
18776
18773
  BlockDeclarationInstantiation(node.cases, _blockEnv);
18777
18774
  _runningContext4.LexicalEnvironment = _blockEnv;
18778
- Evaluate(node.cases);
18775
+ EvaluateChildren(node, ["cases"], parent);
18779
18776
  _runningContext4.LexicalEnvironment = _oldEnv4;
18780
18777
  return;
18781
18778
  }
18782
18779
 
18783
18780
  case "TryStatement":
18784
- Evaluate(node.block);
18785
- Evaluate(node.handler);
18786
- Evaluate(node.finalizer);
18781
+ EvaluateChildren(node, ["block", "handler", "finalizer"], parent);
18787
18782
  return;
18788
18783
 
18789
18784
  case "VariableDeclaration":
18790
- Evaluate(node.declarations);
18785
+ EvaluateChildren(node, ["declarations"], parent);
18791
18786
  return;
18792
18787
 
18793
18788
  case "VariableDeclarator":
18794
- Evaluate(node.id);
18795
- Evaluate(node.init);
18789
+ EvaluateChildren(node, ["id", "init"], parent);
18796
18790
  return;
18797
18791
 
18798
18792
  case "WhileStatement":
18799
- Evaluate(node.test);
18800
- Evaluate(node.body);
18793
+ EvaluateChildren(node, ["test", "body"], parent);
18801
18794
  return;
18802
18795
  }
18803
18796
  }
18804
18797
 
18805
- var silent = (_hooks$beforeVisitUnk = hooks.beforeVisitUnknown) === null || _hooks$beforeVisitUnk === void 0 ? void 0 : _hooks$beforeVisitUnk.call(hooks, node);
18798
+ var silent = (_hooks$beforeVisitUnk = hooks.beforeVisitUnknown) === null || _hooks$beforeVisitUnk === void 0 ? void 0 : _hooks$beforeVisitUnk.call(hooks, node, parent);
18806
18799
 
18807
18800
  if (!silent) {
18808
18801
  // eslint-disable-next-line no-console
@@ -18834,10 +18827,16 @@ function precook(rootAst) {
18834
18827
  BoundNamesInstantiation(declarations, env);
18835
18828
  }
18836
18829
 
18837
- function CallFunction(closure) {
18830
+ function CallFunction(closure, parent) {
18838
18831
  PrepareOrdinaryCall(closure);
18839
- FunctionDeclarationInstantiation(closure);
18840
- Evaluate(closure.ECMAScriptCode);
18832
+ FunctionDeclarationInstantiation(closure, parent);
18833
+ Evaluate(closure.ECMAScriptCode, parent === null || parent === void 0 ? void 0 : parent.concat({
18834
+ node: closure.Function,
18835
+ key: "body"
18836
+ }).concat(closure.Function.body.type === "BlockStatement" ? {
18837
+ node: closure.Function.body,
18838
+ key: "body"
18839
+ } : []));
18841
18840
  analysisContextStack.pop();
18842
18841
  }
18843
18842
 
@@ -18849,7 +18848,7 @@ function precook(rootAst) {
18849
18848
  analysisContextStack.push(calleeContext);
18850
18849
  }
18851
18850
 
18852
- function FunctionDeclarationInstantiation(func) {
18851
+ function FunctionDeclarationInstantiation(func, parent) {
18853
18852
  var calleeContext = getRunningContext();
18854
18853
  var code = func.ECMAScriptCode;
18855
18854
  var formals = func.FormalParameters;
@@ -18861,7 +18860,10 @@ function precook(rootAst) {
18861
18860
  var varNames = collectBoundNames(varDeclarations);
18862
18861
  var env = calleeContext.LexicalEnvironment;
18863
18862
  BoundNamesInstantiation(formals, env);
18864
- Evaluate(formals);
18863
+ Evaluate(formals, parent === null || parent === void 0 ? void 0 : parent.concat({
18864
+ node: func.Function,
18865
+ key: "params"
18866
+ }));
18865
18867
  var varEnv;
18866
18868
 
18867
18869
  if (!hasParameterExpressions) {
@@ -18906,19 +18908,16 @@ function precook(rootAst) {
18906
18908
  return OrdinaryFunctionCreate(functionExpression, funcEnv);
18907
18909
  }
18908
18910
 
18909
- function OrdinaryFunctionCreate(_ref, scope) {
18910
- var {
18911
- params,
18912
- body
18913
- } = _ref;
18911
+ function OrdinaryFunctionCreate(func, scope) {
18914
18912
  return {
18915
- FormalParameters: params,
18916
- ECMAScriptCode: body.type === "BlockStatement" ? body.body : body,
18913
+ Function: func,
18914
+ FormalParameters: func.params,
18915
+ ECMAScriptCode: func.body.type === "BlockStatement" ? func.body.body : func.body,
18917
18916
  Environment: scope
18918
18917
  };
18919
18918
  }
18920
18919
 
18921
- Evaluate(rootAst);
18920
+ Evaluate(rootAst, withParent ? [] : undefined);
18922
18921
  return attemptToVisitGlobals;
18923
18922
  }
18924
18923
 
@@ -19178,12 +19177,16 @@ function collectProcessors(data, collection) {
19178
19177
  if (typeof data === "string") {
19179
19178
  if (data.includes(PROCESSORS) && isEvaluable(data)) {
19180
19179
  preevaluate(data, {
19181
- visitors: {
19182
- MemberExpression(node) {
19183
- var accessNamespace = node.object;
19180
+ withParent: true,
19181
+ hooks: {
19182
+ beforeVisitGlobal(node, parent) {
19183
+ if (node.name === PROCESSORS) {
19184
+ var memberParent = parent[parent.length - 1];
19185
+ var outerMemberParent = parent[parent.length - 2];
19184
19186
 
19185
- if (!node.computed && node.property.type === "Identifier" && accessNamespace.type === "MemberExpression" && !accessNamespace.computed && accessNamespace.object.type === "Identifier" && accessNamespace.object.name === PROCESSORS && accessNamespace.property.type === "Identifier") {
19186
- collection.push("".concat(accessNamespace.property.name, ".").concat(node.property.name));
19187
+ if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object" && !memberParent.node.computed && memberParent.node.property.type === "Identifier" && (outerMemberParent === null || outerMemberParent === void 0 ? void 0 : outerMemberParent.node.type) === "MemberExpression" && outerMemberParent.key === "object" && !outerMemberParent.node.computed && outerMemberParent.node.property.type === "Identifier") {
19188
+ collection.push("".concat(memberParent.node.property.name, ".").concat(outerMemberParent.node.property.name));
19189
+ }
19187
19190
  }
19188
19191
  }
19189
19192
 
@@ -19974,12 +19977,18 @@ function collectPermissionActions(data, collection) {
19974
19977
  if (typeof data === "string") {
19975
19978
  if (data.includes(PERMISSIONS) && isEvaluable(data)) {
19976
19979
  preevaluate(data, {
19977
- visitors: {
19978
- CallExpression(node) {
19979
- if (node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === PERMISSIONS && !node.callee.computed && node.callee.property.type === "Identifier" && node.callee.property.name === check) {
19980
- for (var arg of node.arguments) {
19981
- if (arg.type === "Literal" && typeof arg.value === "string") {
19982
- collection.add(arg.value);
19980
+ withParent: true,
19981
+ hooks: {
19982
+ beforeVisitGlobal(node, parent) {
19983
+ if (node.name === PERMISSIONS) {
19984
+ var memberParent = parent[parent.length - 1];
19985
+ var callParent = parent[parent.length - 2];
19986
+
19987
+ 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 === check) {
19988
+ for (var arg of callParent.node.arguments) {
19989
+ if (arg.type === "Literal" && typeof arg.value === "string") {
19990
+ collection.add(arg.value);
19991
+ }
19983
19992
  }
19984
19993
  }
19985
19994
  }
@@ -20065,21 +20074,22 @@ function scanI18NInStoryboard(storyboard) {
20065
20074
  var _storyboard$meta;
20066
20075
 
20067
20076
  var collection = new Map();
20068
- var beforeVisit = beforeVisitFactory(collection); // Notice: `menus` may contain evaluations of I18N too.
20077
+ var beforeVisitGlobal = beforeVisitGlobalFactory(collection); // Notice: `menus` may contain evaluations of I18N too.
20069
20078
 
20070
20079
  var {
20071
20080
  customTemplates,
20072
20081
  menus,
20073
20082
  functions
20074
20083
  } = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
20075
- collectI18N([storyboard.routes, customTemplates, menus], beforeVisit);
20084
+ collectI18N([storyboard.routes, customTemplates, menus], beforeVisitGlobal);
20076
20085
 
20077
20086
  if (Array.isArray(functions)) {
20078
20087
  for (var fn of functions) {
20079
20088
  precookFunction(fn.source, {
20080
20089
  typescript: fn.typescript,
20090
+ withParent: true,
20081
20091
  hooks: {
20082
- beforeVisit
20092
+ beforeVisitGlobal
20083
20093
  }
20084
20094
  });
20085
20095
  }
@@ -20089,18 +20099,19 @@ function scanI18NInStoryboard(storyboard) {
20089
20099
  }
20090
20100
  function scanI18NInAny(data) {
20091
20101
  var collection = new Map();
20092
- collectI18N(data, beforeVisitFactory(collection));
20102
+ collectI18N(data, beforeVisitGlobalFactory(collection));
20093
20103
  return collection;
20094
20104
  }
20095
20105
 
20096
- function collectI18N(data, beforeVisit) {
20106
+ function collectI18N(data, beforeVisitGlobal) {
20097
20107
  var memo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakSet();
20098
20108
 
20099
20109
  if (typeof data === "string") {
20100
20110
  if (data.includes(I18N) && isEvaluable(data)) {
20101
20111
  preevaluate(data, {
20112
+ withParent: true,
20102
20113
  hooks: {
20103
- beforeVisit
20114
+ beforeVisitGlobal
20104
20115
  }
20105
20116
  });
20106
20117
  }
@@ -20114,31 +20125,35 @@ function collectI18N(data, beforeVisit) {
20114
20125
 
20115
20126
  if (Array.isArray(data)) {
20116
20127
  for (var item of data) {
20117
- collectI18N(item, beforeVisit, memo);
20128
+ collectI18N(item, beforeVisitGlobal, memo);
20118
20129
  }
20119
20130
  } else {
20120
20131
  for (var _item of Object.values(data)) {
20121
- collectI18N(_item, beforeVisit, memo);
20132
+ collectI18N(_item, beforeVisitGlobal, memo);
20122
20133
  }
20123
20134
  }
20124
20135
  }
20125
20136
  }
20126
20137
 
20127
- function beforeVisitFactory(collection) {
20128
- return function beforeVisit(node) {
20129
- if (node.type === "CallExpression") {
20130
- var [keyNode, defaultNode] = node.arguments;
20138
+ function beforeVisitGlobalFactory(collection) {
20139
+ return function beforeVisitGlobal(node, parent) {
20140
+ if (node.name === I18N) {
20141
+ var callParent = parent[parent.length - 1];
20131
20142
 
20132
- if (node.callee.type === "Identifier" && node.callee.name === I18N && keyNode && keyNode.type === "Literal" && typeof keyNode.value === "string") {
20133
- var valueSet = collection.get(keyNode.value);
20143
+ if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === "CallExpression" && callParent.key === "callee") {
20144
+ var [keyNode, defaultNode] = callParent.node.arguments;
20134
20145
 
20135
- if (!valueSet) {
20136
- valueSet = new Set();
20137
- collection.set(keyNode.value, valueSet);
20138
- }
20146
+ if (keyNode && keyNode.type === "Literal" && typeof keyNode.value === "string") {
20147
+ var valueSet = collection.get(keyNode.value);
20148
+
20149
+ if (!valueSet) {
20150
+ valueSet = new Set();
20151
+ collection.set(keyNode.value, valueSet);
20152
+ }
20139
20153
 
20140
- if (defaultNode && defaultNode.type === "Literal" && typeof defaultNode.value === "string") {
20141
- valueSet.add(defaultNode.value);
20154
+ if (defaultNode && defaultNode.type === "Literal" && typeof defaultNode.value === "string") {
20155
+ valueSet.add(defaultNode.value);
20156
+ }
20142
20157
  }
20143
20158
  }
20144
20159
  }
@@ -20815,23 +20830,35 @@ function getDependencyMapOfContext(contextConfs) {
20815
20830
 
20816
20831
  return depsMap;
20817
20832
  }
20818
- var CTX = "CTX";
20833
+ var CTX$1 = "CTX";
20819
20834
 
20820
20835
  function collectContexts(data, stats) {
20821
20836
  var memo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakSet();
20822
20837
 
20823
20838
  if (typeof data === "string") {
20824
- if (data.includes(CTX) && isEvaluable(data)) {
20839
+ if (data.includes(CTX$1) && isEvaluable(data)) {
20825
20840
  preevaluate(data, {
20826
- visitors: {
20827
- MemberExpression(node) {
20828
- if (node.object.type === "Identifier" && node.object.name === CTX) {
20829
- if (!node.computed && node.property.type === "Identifier") {
20830
- if (!stats.dependencies.includes(node.property.name)) {
20831
- stats.dependencies.push(node.property.name);
20841
+ withParent: true,
20842
+ hooks: {
20843
+ beforeVisitGlobal(node, parent) {
20844
+ if (node.name === CTX$1) {
20845
+ var memberParent = parent[parent.length - 1];
20846
+
20847
+ if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object") {
20848
+ var memberNode = memberParent.node;
20849
+ var dep;
20850
+
20851
+ if (!memberNode.computed && memberNode.property.type === "Identifier") {
20852
+ dep = memberNode.property.name;
20853
+ } else if (memberNode.computed && memberNode.property.type === "Literal" && typeof memberNode.property.value === "string") {
20854
+ dep = memberNode.property.value;
20855
+ } else {
20856
+ stats.includesComputed = true;
20857
+ }
20858
+
20859
+ if (dep !== undefined && !stats.dependencies.includes(dep)) {
20860
+ stats.dependencies.push(dep);
20832
20861
  }
20833
- } else {
20834
- stats.includesComputed = true;
20835
20862
  }
20836
20863
  }
20837
20864
  }
@@ -21129,6 +21156,7 @@ function deepFreeze(object) {
21129
21156
  }
21130
21157
 
21131
21158
  var TRACK_CONTEXT = "track context";
21159
+ var CTX = "CTX";
21132
21160
  /**
21133
21161
  * Get tracking CTX for an evaluable expression in `track context` mode.
21134
21162
  *
@@ -21162,13 +21190,20 @@ function trackContext(raw) {
21162
21190
  var {
21163
21191
  expression
21164
21192
  } = preevaluate(raw, {
21165
- visitors: {
21166
- MemberExpression(node) {
21167
- if (node.object.type === "Identifier" && node.object.name === "CTX") {
21168
- if (!node.computed && node.property.type === "Identifier") {
21169
- contexts.add(node.property.name);
21170
- } else if (node.computed && node.property.type === "Literal" && typeof node.property.value === "string") {
21171
- contexts.add(node.property.value);
21193
+ withParent: true,
21194
+ hooks: {
21195
+ beforeVisitGlobal(node, parent) {
21196
+ if (node.name === CTX) {
21197
+ var memberParent = parent[parent.length - 1];
21198
+
21199
+ if ((memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object") {
21200
+ var memberNode = memberParent.node;
21201
+
21202
+ if (!memberNode.computed && memberNode.property.type === "Identifier") {
21203
+ contexts.add(memberNode.property.name);
21204
+ } else if (memberNode.computed && memberNode.property.type === "Literal" && typeof memberNode.property.value === "string") {
21205
+ contexts.add(memberNode.property.value);
21206
+ }
21172
21207
  }
21173
21208
  }
21174
21209
  }