@next-core/brick-utils 2.43.8 → 2.44.0

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
@@ -23577,16 +23577,20 @@ function computeConstantCondition(ifContainer) {
23577
23577
  attemptToVisitGlobals,
23578
23578
  source
23579
23579
  } = preevaluate(ifContainer.if);
23580
- var hasOtherThanFlags = false;
23580
+ var {
23581
+ constantFeatureFlags,
23582
+ featureFlags
23583
+ } = options;
23584
+ var hasDynamicVariables = false;
23581
23585
 
23582
23586
  for (var _item4 of attemptToVisitGlobals) {
23583
- if (_item4 !== "undefined" && _item4 !== "FLAGS") {
23584
- hasOtherThanFlags = true;
23587
+ if (_item4 !== "undefined" && (!constantFeatureFlags || _item4 !== "FLAGS")) {
23588
+ hasDynamicVariables = true;
23585
23589
  break;
23586
23590
  }
23587
23591
  }
23588
23592
 
23589
- if (hasOtherThanFlags) {
23593
+ if (hasDynamicVariables) {
23590
23594
  if (isConstantLogical(expression, false, options)) {
23591
23595
  if (process.env.NODE_ENV === "development") {
23592
23596
  // eslint-disable-next-line no-console
@@ -23599,24 +23603,22 @@ function computeConstantCondition(ifContainer) {
23599
23603
  return;
23600
23604
  }
23601
23605
 
23602
- var {
23603
- constantFeatureFlags,
23604
- featureFlags
23605
- } = options;
23606
+ var originalIf = ifContainer.if;
23607
+ var globalVariables = {
23608
+ undefined: undefined
23609
+ };
23606
23610
 
23607
23611
  if (constantFeatureFlags) {
23608
- var originalIf = ifContainer.if;
23609
- ifContainer.if = !!cook(expression, source, {
23610
- globalVariables: {
23611
- undefined: undefined,
23612
- FLAGS: featureFlags
23613
- }
23614
- });
23612
+ globalVariables.FLAGS = featureFlags;
23613
+ }
23615
23614
 
23616
- if (process.env.NODE_ENV === "development" && ifContainer.if === false) {
23617
- // eslint-disable-next-line no-console
23618
- console.warn("[removed dead if]:", originalIf, ifContainer);
23619
- }
23615
+ ifContainer.if = !!cook(expression, source, {
23616
+ globalVariables
23617
+ });
23618
+
23619
+ if (process.env.NODE_ENV === "development" && ifContainer.if === false) {
23620
+ // eslint-disable-next-line no-console
23621
+ console.warn("[removed dead if]:", originalIf, ifContainer);
23620
23622
  }
23621
23623
  } catch (error) {
23622
23624
  // eslint-disable-next-line no-console