pasika 0.10.147 → 0.10.149

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.
@@ -11516,16 +11516,61 @@ import path78 from "path";
11516
11516
  // eslint/rules/tailwind/css-consumers.ts
11517
11517
  import path77 from "path";
11518
11518
  import { generate as generate6, parse as parse7 } from "@eslint/css-tree";
11519
+ import * as ts17 from "typescript";
11519
11520
  function contains2(text, name) {
11520
11521
  return new RegExp(`(?<![\\w-])${escapeRegExp(name)}(?![\\w-])`, "u").test(text);
11521
11522
  }
11522
11523
  function inferCssConsumerPaths(options) {
11523
11524
  const { graph, css: css2, modules, sourceRoot } = options;
11524
11525
  const defs = graph.definitions;
11525
- const components = modules.filter((mod) => {
11526
- const relative = path77.relative(sourceRoot, mod.path).split(path77.sep).join("/");
11527
- return /^(?:features\/[\w-]+\/|shared\/|compositions\/)[\w./-]+\.(?:tsx|jsx)$/u.test(relative) && !/\.(?:test|spec|stories)\.(?:tsx|jsx)$/u.test(relative);
11528
- });
11526
+ const moduleByPath = new Map(modules.map((mod) => [path77.normalize(mod.path), mod]));
11527
+ const componentPaths = new Map(
11528
+ modules.flatMap((mod) => {
11529
+ const relative = path77.relative(sourceRoot, mod.path).split(path77.sep).join("/");
11530
+ return /^(?:app\/|features\/[\w-]+\/|shared\/|compositions\/).+\.(?:tsx|jsx)$/u.test(relative) && !/\.(?:test|spec|stories)\.(?:tsx|jsx)$/u.test(relative) ? [[path77.normalize(mod.path), relative]] : [];
11531
+ })
11532
+ );
11533
+ const importers = /* @__PURE__ */ new Map();
11534
+ for (const mod of modules) {
11535
+ for (const imported of ts17.preProcessFile(mod.content, true, true).importedFiles) {
11536
+ const specifier = imported.fileName;
11537
+ let base;
11538
+ if (specifier.startsWith("@/")) base = path77.resolve(sourceRoot, specifier.slice(2));
11539
+ else if (specifier.startsWith(".")) base = path77.resolve(path77.dirname(mod.path), specifier);
11540
+ if (!base) continue;
11541
+ const resolved = [
11542
+ base,
11543
+ ...[".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"].flatMap((ext) => [
11544
+ `${base}${ext}`,
11545
+ path77.join(base, `index${ext}`)
11546
+ ])
11547
+ ].find((candidate) => moduleByPath.has(path77.normalize(candidate)));
11548
+ if (!resolved) continue;
11549
+ const key = path77.normalize(resolved);
11550
+ const parents = importers.get(key) ?? /* @__PURE__ */ new Set();
11551
+ parents.add(path77.normalize(mod.path));
11552
+ importers.set(key, parents);
11553
+ }
11554
+ }
11555
+ const componentCache = /* @__PURE__ */ new Map();
11556
+ function componentConsumers(file) {
11557
+ const key = path77.normalize(file);
11558
+ const cached = componentCache.get(key);
11559
+ if (cached) return cached;
11560
+ const found = /* @__PURE__ */ new Set();
11561
+ const seen = /* @__PURE__ */ new Set();
11562
+ const pending = [key];
11563
+ while (pending.length > 0) {
11564
+ const current = pending.pop();
11565
+ if (!current || seen.has(current)) continue;
11566
+ seen.add(current);
11567
+ const consumer = componentPaths.get(current);
11568
+ if (consumer) found.add(consumer);
11569
+ for (const parent of importers.get(current) ?? []) pending.push(parent);
11570
+ }
11571
+ componentCache.set(key, found);
11572
+ return found;
11573
+ }
11529
11574
  const classesByToken = themeClassesForTokens(
11530
11575
  defs.filter((def) => def.kind === "theme-token").map((def) => def.name),
11531
11576
  sourceRoot
@@ -11535,10 +11580,14 @@ function inferCssConsumerPaths(options) {
11535
11580
  const refs = graph.references.filter(
11536
11581
  (ref) => ref.source === "module" && (def.kind === "theme-token" && ref.kind === "theme-class" && ref.token === def.name || def.kind === "utility" && ref.kind === "utility" && ref.name === def.name || def.kind === "selector" && ref.kind === "selector" && ref.name === def.name || def.kind === "keyframes" && ref.kind === "keyframes" && ref.name === def.name)
11537
11582
  );
11538
- for (const mod of components) {
11583
+ const set = consumers.get(symbolId(def));
11584
+ for (const ref of refs) {
11585
+ for (const component of componentConsumers(ref.file)) set?.add(component);
11586
+ }
11587
+ for (const mod of modules) {
11539
11588
  const explicit = ["theme-token", "root-variable"].includes(def.kind) && contains2(mod.content, def.name) || def.kind === "keyframes" && contains2(mod.content, def.name) || def.kind === "font-face" && new RegExp(`(?:fontFamily|font-family)\\s*[:=]\\s*["']${escapeRegExp(def.name)}`, "iu").test(mod.content);
11540
- if (explicit || refs.some((ref) => ref.file === mod.path)) {
11541
- consumers.get(symbolId(def))?.add(path77.relative(sourceRoot, mod.path).split(path77.sep).join("/"));
11589
+ if (explicit) {
11590
+ for (const component of componentConsumers(mod.path)) set?.add(component);
11542
11591
  }
11543
11592
  }
11544
11593
  }
@@ -11599,7 +11648,7 @@ function inferCssConsumerPaths(options) {
11599
11648
  }
11600
11649
 
11601
11650
  // eslint/rules/tailwind/theme-token-order.ts
11602
- var GROUP_PATH = String.raw`(?:global|src/[\w./-]+\.(?:tsx?|jsx?)|(?:app|features|shared|compositions)(?:/[\w.-]+)*)`;
11651
+ var GROUP_PATH = String.raw`(?:global|src/[\w./-]+\.(?:tsx?|jsx?)|(?:app|features|shared|compositions)(?:/[\w.\[\]()@-]+)*)`;
11603
11652
  var GROUP_RE = new RegExp(
11604
11653
  String.raw`^\s*/\*\s*(?:Group:\s*)?(?<paths>${GROUP_PATH}(?:\s*,\s*${GROUP_PATH})*)\s*\*/\s*$`,
11605
11654
  "u"
@@ -11692,7 +11741,7 @@ var themeTokenOrderRule = {
11692
11741
  if (!item.owner) {
11693
11742
  message = `CSS definition "${item.symbol.name}" has no traceable consumer; reference it or remove it.`;
11694
11743
  } else if (!currentGroup) {
11695
- message = `CSS definition "${item.symbol.name}" requires a consumer-path group comment.`;
11744
+ message = `CSS definition "${item.symbol.name}" requires group "${item.owner}" (no consumer-path group comment found).`;
11696
11745
  } else if (actual !== item.owner) {
11697
11746
  message = `CSS definition "${item.symbol.name}" belongs to group "${item.owner}", not "${reportedGroup}".`;
11698
11747
  } else if (previous?.section === item.section && previous.scope === item.scope) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.147",
3
+ "version": "0.10.149",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",