pasika 0.10.145 → 0.10.146

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.
@@ -11524,6 +11524,16 @@ function sectionOf(symbol) {
11524
11524
  if (symbol.kind === "keyframes") return "keyframes";
11525
11525
  return symbol.kind;
11526
11526
  }
11527
+ function scopeOf(symbol, sheet) {
11528
+ const enclosing = [...sheet.children].find(
11529
+ (node) => node.loc && node.loc.start.line <= symbol.line && node.loc.end.line >= symbol.line
11530
+ );
11531
+ if (!enclosing?.loc) return "top-level";
11532
+ if (symbol.kind === "theme-token" || symbol.kind === "root-variable" || enclosing.type === "Atrule" && enclosing.name === "layer") {
11533
+ return `block:${enclosing.loc.start.offset.toString()}`;
11534
+ }
11535
+ return "top-level";
11536
+ }
11527
11537
  function ownerOf(symbol, graph, root) {
11528
11538
  const references = graph.references.filter((ref) => {
11529
11539
  if (ref.source !== "module" || !/\.(?:tsx|jsx)$/u.test(ref.file) || /\.(?:test|spec|stories)\.(?:tsx|jsx)$/u.test(ref.file)) {
@@ -11579,14 +11589,16 @@ var themeTokenOrderRule = {
11579
11589
  ).map((symbol) => ({
11580
11590
  symbol,
11581
11591
  owner: ownerOf(symbol, graph, root),
11582
- section: sectionOf(symbol)
11592
+ section: sectionOf(symbol),
11593
+ scope: scopeOf(symbol, context.sourceCode.ast)
11583
11594
  })).sort((a, b) => a.symbol.line - b.symbol.line);
11584
11595
  let activeGroup;
11585
11596
  let previousItem;
11586
11597
  for (const item of items) {
11587
11598
  const previousLine = previousItem?.symbol.line ?? 0;
11588
11599
  const intervening = groups.filter((group) => group.line > previousLine && group.line < item.symbol.line).at(-1);
11589
- if (item.section !== previousItem?.section) activeGroup = intervening;
11600
+ const previousScope = previousItem?.scope;
11601
+ if (item.section !== previousItem?.section || item.scope !== previousScope) activeGroup = intervening;
11590
11602
  else if (intervening) activeGroup = intervening;
11591
11603
  item.group = activeGroup;
11592
11604
  previousItem = item;
@@ -11621,7 +11633,7 @@ var themeTokenOrderRule = {
11621
11633
  message = `CSS definition "${item.symbol.name}" requires a component-path group comment.`;
11622
11634
  } else if (item.owner !== "global" && actual !== item.owner) {
11623
11635
  message = `CSS definition "${item.symbol.name}" belongs to group "${item.owner}", not "${reportedGroup}".`;
11624
- } else if (previous?.section === item.section) {
11636
+ } else if (previous?.section === item.section && previous.scope === item.scope) {
11625
11637
  if (previous.owner !== item.owner && previous.owner.localeCompare(item.owner) > 0) {
11626
11638
  message = `CSS consumer groups in ${item.section} must be ordered alphabetically by path.`;
11627
11639
  } else if (previous.owner === item.owner && previous.symbol.name.localeCompare(item.symbol.name) > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.145",
3
+ "version": "0.10.146",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",