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.
package/dist/cli/index.js CHANGED
@@ -3287,12 +3287,22 @@ function hasStateInComponentMaster(node, context, statePattern) {
3287
3287
  if (!master) return false;
3288
3288
  return hasStateInVariantProps(master, statePattern);
3289
3289
  }
3290
+ var VARIANT_POSITION_NAME_RE = /^[\w ]+=[^,]+(,\s*[\w ]+=[^,]+)*$/;
3291
+ function hasUsablePropDefs(propDefs) {
3292
+ return propDefs != null && typeof propDefs === "object";
3293
+ }
3290
3294
  function canDetermineVariants(node, context) {
3291
- if (node.type === "COMPONENT") return true;
3292
- if (node.componentPropertyDefinitions !== void 0) return true;
3295
+ if (hasUsablePropDefs(node.componentPropertyDefinitions)) return true;
3296
+ if (node.type === "COMPONENT") {
3297
+ return !VARIANT_POSITION_NAME_RE.test(node.name);
3298
+ }
3293
3299
  if (node.componentId !== void 0) {
3294
3300
  const defs = context.file.componentDefinitions;
3295
- if (defs && defs[node.componentId] !== void 0) return true;
3301
+ const master = defs?.[node.componentId];
3302
+ if (master) {
3303
+ if (hasUsablePropDefs(master.componentPropertyDefinitions)) return true;
3304
+ return !VARIANT_POSITION_NAME_RE.test(master.name);
3305
+ }
3296
3306
  }
3297
3307
  return false;
3298
3308
  }
@@ -4046,7 +4056,7 @@ function computeApplyContext(violation, instanceContext) {
4046
4056
  }
4047
4057
 
4048
4058
  // package.json
4049
- var version2 = "0.10.4";
4059
+ var version2 = "0.10.5";
4050
4060
 
4051
4061
  // src/core/engine/scoring.ts
4052
4062
  function computeTotalScorePerCategory(configs) {