pasika 0.10.137 → 0.10.138

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.
@@ -135,7 +135,7 @@ declare const tailwindRules: {
135
135
  "css-entry-point": _eslint_css.CSSRuleDefinition;
136
136
  "feature-css-placement": _eslint_css.CSSRuleDefinition;
137
137
  "global-stylesheet": _eslint_css.CSSRuleDefinition;
138
- "unused-utility": _eslint_css.CSSRuleDefinition;
138
+ "unused-css-definition": _eslint_css.CSSRuleDefinition;
139
139
  "unique-css-definition": _eslint_css.CSSRuleDefinition;
140
140
  "unique-css-token-value": _eslint_css.CSSRuleDefinition;
141
141
  "no-utility-alias": _eslint_css.CSSRuleDefinition;
@@ -178,7 +178,7 @@ declare const pasikaPlugin: {
178
178
  "css-entry-point": _eslint_css.CSSRuleDefinition;
179
179
  "feature-css-placement": _eslint_css.CSSRuleDefinition;
180
180
  "global-stylesheet": _eslint_css.CSSRuleDefinition;
181
- "unused-utility": _eslint_css.CSSRuleDefinition;
181
+ "unused-css-definition": _eslint_css.CSSRuleDefinition;
182
182
  "unique-css-definition": _eslint_css.CSSRuleDefinition;
183
183
  "unique-css-token-value": _eslint_css.CSSRuleDefinition;
184
184
  "no-utility-alias": _eslint_css.CSSRuleDefinition;
@@ -10622,6 +10622,13 @@ function buildCssDependencyGraph(options) {
10622
10622
  const utilities = new Set(definitions.filter((item) => item.kind === "utility").map((item) => item.name));
10623
10623
  const selectors = new Set(definitions.filter((item) => item.kind === "selector").map((item) => item.name));
10624
10624
  const keyframes = new Set(definitions.filter((item) => item.kind === "keyframes").map((item) => item.name));
10625
+ for (const token of definitions) {
10626
+ if (token.kind !== "theme-token" || !token.name.startsWith("--animate-") || !token.value) continue;
10627
+ for (const name of keyframes) {
10628
+ if (tokenLines(token.value, name).length === 0) continue;
10629
+ references.push({ kind: "keyframes", name, file: token.file, line: token.line, source: "css" });
10630
+ }
10631
+ }
10625
10632
  const generatedClasses = /* @__PURE__ */ new Map();
10626
10633
  const themeNames = definitions.filter((symbol) => symbol.kind === "theme-token").map((symbol) => symbol.name);
10627
10634
  const classesByToken = themeClassesForTokens(themeNames, options.sourceRoot);
@@ -10705,9 +10712,6 @@ function buildCssDependencyGraph(options) {
10705
10712
  }
10706
10713
  return { definitions, references, imports };
10707
10714
  }
10708
- function cssSymbolUsages(graph, kind, name) {
10709
- return graph.references.filter((item) => item.kind === kind && item.name === name);
10710
- }
10711
10715
 
10712
10716
  // eslint/rules/tailwind/css-ownership.ts
10713
10717
  import path70 from "path";
@@ -11854,15 +11858,47 @@ var uniqueCssTokenValueRule = {
11854
11858
  }
11855
11859
  };
11856
11860
 
11857
- // eslint/rules/tailwind/unused-utility.ts
11861
+ // eslint/rules/tailwind/unused-css-definition.ts
11858
11862
  import { statSync as statSync5 } from "fs";
11859
11863
  import path79 from "path";
11860
- var unusedUtilityRule = {
11864
+ function isImplicitThemeToken(name) {
11865
+ return name === "--spacing" || name === "--radius" || name === "--font-sans" || name === "--font-mono" || name.startsWith("--breakpoint-") || name.startsWith("--default-");
11866
+ }
11867
+ function staticMention(content, name) {
11868
+ const pattern = new RegExp(`(?<![\\w-])${escapeRegExp(name)}(?![\\w-])`, "u");
11869
+ return pattern.test(content);
11870
+ }
11871
+ function isUnused(symbol, references, moduleContents) {
11872
+ if (symbol.kind === "utility") {
11873
+ return !references.some((reference) => reference.kind === "utility" && reference.name === symbol.name);
11874
+ }
11875
+ if (symbol.kind === "keyframes") {
11876
+ return !references.some((reference) => reference.kind === "keyframes" && reference.name === symbol.name);
11877
+ }
11878
+ if (symbol.kind !== "theme-token" || isImplicitThemeToken(symbol.name)) return false;
11879
+ if (references.some((reference) => reference.kind === "theme-class" && reference.token === symbol.name)) {
11880
+ return false;
11881
+ }
11882
+ if (references.some((reference) => reference.kind === "variable" && reference.name === symbol.name)) {
11883
+ return false;
11884
+ }
11885
+ return !moduleContents.some((content) => staticMention(content, symbol.name));
11886
+ }
11887
+ function unusedMessage(symbol) {
11888
+ if (symbol.kind === "utility") {
11889
+ return `Custom utility "${symbol.name}" is never referenced by project CSS or source.`;
11890
+ }
11891
+ if (symbol.kind === "keyframes") {
11892
+ return `@keyframes "${symbol.name}" is never referenced by project CSS or source.`;
11893
+ }
11894
+ return `Theme token "${symbol.name}" is never referenced by project CSS or source.`;
11895
+ }
11896
+ var unusedCssDefinitionRule = {
11861
11897
  meta: {
11862
11898
  schema: [],
11863
11899
  type: "problem",
11864
11900
  docs: {
11865
- description: "Require every custom @utility to be referenced by the repository's source."
11901
+ description: "Report unused @utility, @keyframes and non-foundational @theme tokens across project CSS and modules."
11866
11902
  }
11867
11903
  },
11868
11904
  create(context) {
@@ -11875,24 +11911,32 @@ var unusedUtilityRule = {
11875
11911
  const current = path79.normalize(path79.resolve(context.filename));
11876
11912
  const textOf = cachedTextReader();
11877
11913
  const cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
11878
- const moduleFiles = findFiles(sourceRoot, MODULE_EXTENSIONS4);
11914
+ const moduleContents = findFiles(sourceRoot, MODULE_EXTENSIONS4).map((file) => ({
11915
+ path: file,
11916
+ content: textOf(file)
11917
+ }));
11879
11918
  const graph = buildCssDependencyGraph({
11880
11919
  sourceRoot,
11881
11920
  css: cssFiles.map((file) => ({
11882
11921
  path: file,
11883
11922
  content: path79.normalize(file) === current ? context.sourceCode.text : textOf(file)
11884
11923
  })),
11885
- modules: moduleFiles.map((file) => ({ path: file, content: textOf(file) }))
11924
+ modules: moduleContents
11886
11925
  });
11926
+ const sourceTexts = moduleContents.map((module) => module.content);
11927
+ const unused = graph.definitions.filter(
11928
+ (symbol) => symbol.file === current && isUnused(symbol, graph.references, sourceTexts)
11929
+ );
11887
11930
  return {
11888
11931
  "StyleSheet:exit"(node) {
11889
- for (const utility of atrulesNamed(node, "utility")) {
11890
- const name = preludeIdentifiers(utility)[0];
11891
- if (!name) continue;
11892
- if (cssSymbolUsages(graph, "utility", name).length > 0) continue;
11932
+ for (const symbol of unused) {
11893
11933
  context.report({
11894
- node: utility,
11895
- message: `Custom utility "${name}" is never used by the repository's source; remove it or use it.`
11934
+ node,
11935
+ loc: {
11936
+ start: { line: symbol.line, column: 1 },
11937
+ end: { line: symbol.line, column: 2 }
11938
+ },
11939
+ message: unusedMessage(symbol)
11896
11940
  });
11897
11941
  }
11898
11942
  }
@@ -12734,7 +12778,7 @@ var tailwindRules = {
12734
12778
  "css-entry-point": cssEntryPointRule,
12735
12779
  "feature-css-placement": featureCssPlacementRule,
12736
12780
  "global-stylesheet": globalStylesheetRule,
12737
- "unused-utility": unusedUtilityRule,
12781
+ "unused-css-definition": unusedCssDefinitionRule,
12738
12782
  "unique-css-definition": uniqueCssDefinitionRule,
12739
12783
  "unique-css-token-value": uniqueCssTokenValueRule,
12740
12784
  "no-utility-alias": noUtilityAliasRule
@@ -14142,6 +14186,7 @@ var tailwindImportGraph = {
14142
14186
  languageOptions: { tolerant: true },
14143
14187
  rules: {
14144
14188
  "pasika/at-rule-spacing": "error",
14189
+ "pasika/unused-css-definition": "error",
14145
14190
  "pasika/css-entry-point": "error",
14146
14191
  "pasika/feature-css-placement": "error",
14147
14192
  "pasika/unique-css-definition": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.137",
3
+ "version": "0.10.138",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",