pasika 0.10.148 → 0.10.150

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 /^(?:app\/|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"
@@ -11625,15 +11674,15 @@ function scopeOf(symbol, sheet) {
11625
11674
  return "top-level";
11626
11675
  }
11627
11676
  function groupForConsumers(consumers) {
11628
- if (consumers.length === 1) return consumers[0] ?? "";
11629
- return [
11630
- ...new Set(
11631
- consumers.map((consumer) => {
11632
- const parts = consumer.split("/");
11633
- return parts[0] === "features" ? parts.slice(0, 2).join("/") : parts[0] ?? "";
11634
- })
11635
- )
11636
- ].sort().join(", ");
11677
+ const scopes = /* @__PURE__ */ new Map();
11678
+ for (const consumer of consumers) {
11679
+ const parts = consumer.split("/");
11680
+ const scope = parts[0] === "features" ? parts.slice(0, 2).join("/") : parts[0] ?? "";
11681
+ const paths = scopes.get(scope) ?? [];
11682
+ paths.push(consumer);
11683
+ scopes.set(scope, paths);
11684
+ }
11685
+ return [...scopes].map(([scope, paths]) => paths.length === 1 ? paths[0] ?? scope : scope).sort().join(", ");
11637
11686
  }
11638
11687
  var themeTokenOrderRule = {
11639
11688
  meta: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.148",
3
+ "version": "0.10.150",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",