canicode 0.10.4 → 0.10.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.
@@ -1773,7 +1773,7 @@ function computeApplyContext(violation, instanceContext) {
1773
1773
  }
1774
1774
 
1775
1775
  // package.json
1776
- var version = "0.10.4";
1776
+ var version = "0.10.5";
1777
1777
 
1778
1778
  // src/core/engine/scoring.ts
1779
1779
  function computeTotalScorePerCategory(configs) {
@@ -4856,12 +4856,22 @@ function hasStateInComponentMaster(node, context, statePattern) {
4856
4856
  if (!master) return false;
4857
4857
  return hasStateInVariantProps(master, statePattern);
4858
4858
  }
4859
+ var VARIANT_POSITION_NAME_RE = /^[\w ]+=[^,]+(,\s*[\w ]+=[^,]+)*$/;
4860
+ function hasUsablePropDefs(propDefs) {
4861
+ return propDefs != null && typeof propDefs === "object";
4862
+ }
4859
4863
  function canDetermineVariants(node, context) {
4860
- if (node.type === "COMPONENT") return true;
4861
- if (node.componentPropertyDefinitions !== void 0) return true;
4864
+ if (hasUsablePropDefs(node.componentPropertyDefinitions)) return true;
4865
+ if (node.type === "COMPONENT") {
4866
+ return !VARIANT_POSITION_NAME_RE.test(node.name);
4867
+ }
4862
4868
  if (node.componentId !== void 0) {
4863
4869
  const defs = context.file.componentDefinitions;
4864
- if (defs && defs[node.componentId] !== void 0) return true;
4870
+ const master = defs?.[node.componentId];
4871
+ if (master) {
4872
+ if (hasUsablePropDefs(master.componentPropertyDefinitions)) return true;
4873
+ return !VARIANT_POSITION_NAME_RE.test(master.name);
4874
+ }
4865
4875
  }
4866
4876
  return false;
4867
4877
  }