pasika 0.10.125 → 0.10.126
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/eslint/pasika/index.js +71 -13
- package/package.json +1 -1
|
@@ -11214,6 +11214,8 @@ var unusedUtilityRule = {
|
|
|
11214
11214
|
};
|
|
11215
11215
|
|
|
11216
11216
|
// eslint/rules/tailwind/utility-mapping.ts
|
|
11217
|
+
import { spawnSync } from "child_process";
|
|
11218
|
+
import { existsSync as existsSync12 } from "fs";
|
|
11217
11219
|
import path78 from "path";
|
|
11218
11220
|
function applyOperationCount(utility) {
|
|
11219
11221
|
let count = 0;
|
|
@@ -11264,8 +11266,54 @@ var themeOperations = [
|
|
|
11264
11266
|
{ property: "transition-timing-function", prefix: "ease", namespace: "ease" },
|
|
11265
11267
|
{ property: "zoom", prefix: "zoom", namespace: "zoom" },
|
|
11266
11268
|
{ property: "perspective", prefix: "perspective", namespace: "perspective" },
|
|
11267
|
-
{ property: "animation", prefix: "animate", namespace: "animate" }
|
|
11269
|
+
{ property: "animation", prefix: "animate", namespace: "animate" },
|
|
11270
|
+
{ property: "box-shadow", prefix: "shadow", namespace: "shadow" }
|
|
11268
11271
|
];
|
|
11272
|
+
var SHADOW_THEME_WORKER = String.raw`
|
|
11273
|
+
import { readFileSync } from "node:fs";
|
|
11274
|
+
import { compile } from "tailwindcss";
|
|
11275
|
+
const values = JSON.parse(readFileSync(0, "utf8"));
|
|
11276
|
+
const results = [];
|
|
11277
|
+
for (const value of values) {
|
|
11278
|
+
try {
|
|
11279
|
+
const compiler = await compile(["@theme { --shadow-pasika-probe: ", value, "; } @tailwind utilities;"].join(""));
|
|
11280
|
+
const css = compiler.build(["shadow-pasika-probe"]);
|
|
11281
|
+
const block = css.match(/\.shadow-pasika-probe\s*\{(?<body>[^}]+)\}/u)?.groups?.body ?? "";
|
|
11282
|
+
results.push(/--tw-shadow\s*:/u.test(block) && /box-shadow\s*:/u.test(block));
|
|
11283
|
+
} catch {
|
|
11284
|
+
results.push(false);
|
|
11285
|
+
}
|
|
11286
|
+
}
|
|
11287
|
+
process.stdout.write(JSON.stringify(results));
|
|
11288
|
+
`;
|
|
11289
|
+
var shadowSupportCache = /* @__PURE__ */ new Map();
|
|
11290
|
+
function themeSupportedShadows(values, cwd) {
|
|
11291
|
+
const unique = [...new Set(values)];
|
|
11292
|
+
const cacheKey = (value) => `${cwd}\0${value}`;
|
|
11293
|
+
const missing = unique.filter((value) => !shadowSupportCache.has(cacheKey(value)));
|
|
11294
|
+
if (missing.length > 0) {
|
|
11295
|
+
const child = spawnSync(process.execPath, ["--input-type=module", "--eval", SHADOW_THEME_WORKER], {
|
|
11296
|
+
cwd,
|
|
11297
|
+
input: JSON.stringify(missing),
|
|
11298
|
+
encoding: "utf8",
|
|
11299
|
+
timeout: 3e4,
|
|
11300
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
11301
|
+
windowsHide: true
|
|
11302
|
+
});
|
|
11303
|
+
let supported = [];
|
|
11304
|
+
if (!child.error && child.status === 0) {
|
|
11305
|
+
try {
|
|
11306
|
+
const parsed = JSON.parse(child.stdout);
|
|
11307
|
+
if (Array.isArray(parsed) && parsed.length === missing.length && parsed.every((value) => typeof value === "boolean")) {
|
|
11308
|
+
supported = parsed.filter((value) => typeof value === "boolean");
|
|
11309
|
+
}
|
|
11310
|
+
} catch {
|
|
11311
|
+
}
|
|
11312
|
+
}
|
|
11313
|
+
missing.forEach((value, index) => shadowSupportCache.set(cacheKey(value), supported[index] === true));
|
|
11314
|
+
}
|
|
11315
|
+
return new Set(unique.filter((value) => shadowSupportCache.get(cacheKey(value))));
|
|
11316
|
+
}
|
|
11269
11317
|
function themeCandidate(name, utilityText) {
|
|
11270
11318
|
const source = utilityText.trim();
|
|
11271
11319
|
const arbitrary = /^@utility\s+[\w-]+\s*\{\s*@apply\s+\[(?<property>[a-z-]+):(?<value>[^\]\r\n;{}]+)\];?\s*\}$/u.exec(
|
|
@@ -11521,6 +11569,15 @@ var utilityMappingRule = {
|
|
|
11521
11569
|
}
|
|
11522
11570
|
return void 0;
|
|
11523
11571
|
}
|
|
11572
|
+
const shadowCandidates = utilities.map(
|
|
11573
|
+
(utility) => themeCandidate(preludeIdentifiers(utility)[0] ?? "unknown", context.sourceCode.getText(utility))
|
|
11574
|
+
).filter((candidate) => candidate?.property === "box-shadow");
|
|
11575
|
+
const physicalDir = path78.dirname(context.physicalFilename);
|
|
11576
|
+
const tailwindCwd = path78.isAbsolute(physicalDir) && existsSync12(physicalDir) ? physicalDir : context.cwd;
|
|
11577
|
+
const themeShadows = themeSupportedShadows(
|
|
11578
|
+
shadowCandidates.map((candidate) => candidate.value),
|
|
11579
|
+
tailwindCwd
|
|
11580
|
+
);
|
|
11524
11581
|
for (const utility of utilities) {
|
|
11525
11582
|
const name = preludeIdentifiers(utility)[0] ?? "unknown";
|
|
11526
11583
|
const source = context.sourceCode.getText(utility);
|
|
@@ -11539,7 +11596,8 @@ var utilityMappingRule = {
|
|
|
11539
11596
|
});
|
|
11540
11597
|
continue;
|
|
11541
11598
|
}
|
|
11542
|
-
const
|
|
11599
|
+
const possibleCandidate = themeCandidate(name, source);
|
|
11600
|
+
const candidate = possibleCandidate?.property === "box-shadow" && !themeShadows.has(possibleCandidate.value) ? void 0 : possibleCandidate;
|
|
11543
11601
|
const equivalent = candidate ? matchingThemeToken(candidate) : void 0;
|
|
11544
11602
|
if (candidate && equivalent && nameCounts.get(name) === 1) {
|
|
11545
11603
|
context.report({
|
|
@@ -11560,7 +11618,7 @@ var utilityMappingRule = {
|
|
|
11560
11618
|
if (!candidate.token) {
|
|
11561
11619
|
context.report({
|
|
11562
11620
|
node: utility,
|
|
11563
|
-
message: `Custom utility "${name}" only maps ${candidate.property} (${candidate.value}); define an @theme token in the "--${candidate.namespace}-*" namespace and use its generated "${candidate.prefix}-*" class instead
|
|
11621
|
+
message: `Custom utility "${name}" only maps ${candidate.property} (${candidate.value}); define an @theme token in the "--${candidate.namespace}-*" namespace and use its generated "${candidate.prefix}-*" class instead.${candidate.property === "box-shadow" ? " Compare compiled CSS and ring/inset-shadow composition before migration." : ""}`
|
|
11564
11622
|
});
|
|
11565
11623
|
continue;
|
|
11566
11624
|
}
|
|
@@ -11626,9 +11684,9 @@ var utilityMappingRule = {
|
|
|
11626
11684
|
};
|
|
11627
11685
|
|
|
11628
11686
|
// eslint/rules/tailwind/utility-name-parity.ts
|
|
11629
|
-
import { spawnSync } from "child_process";
|
|
11687
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
11630
11688
|
import { createHash } from "crypto";
|
|
11631
|
-
import { existsSync as
|
|
11689
|
+
import { existsSync as existsSync13 } from "fs";
|
|
11632
11690
|
import path79 from "path";
|
|
11633
11691
|
import { generate as generate5, parse as parse8, toPlainObject as toPlainObject3 } from "@eslint/css-tree";
|
|
11634
11692
|
function numericPart(value) {
|
|
@@ -11702,7 +11760,7 @@ function compileApplies(applies, cwd) {
|
|
|
11702
11760
|
const key = `${cwd}\0${JSON.stringify(applies)}`;
|
|
11703
11761
|
const cached = compilerCache.get(key);
|
|
11704
11762
|
if (cached) return cached;
|
|
11705
|
-
const child =
|
|
11763
|
+
const child = spawnSync2(process.execPath, ["--input-type=module", "--eval", TAILWIND_WORKER], {
|
|
11706
11764
|
cwd,
|
|
11707
11765
|
input: JSON.stringify(applies),
|
|
11708
11766
|
encoding: "utf8",
|
|
@@ -11780,7 +11838,7 @@ var utilityNameParityRule = {
|
|
|
11780
11838
|
});
|
|
11781
11839
|
if (candidates.length === 0) return;
|
|
11782
11840
|
const physicalDir = path79.dirname(context.physicalFilename);
|
|
11783
|
-
const cwd = path79.isAbsolute(physicalDir) &&
|
|
11841
|
+
const cwd = path79.isAbsolute(physicalDir) && existsSync13(physicalDir) ? physicalDir : context.cwd;
|
|
11784
11842
|
const compiled = compileApplies(
|
|
11785
11843
|
candidates.map((candidate) => candidate.apply),
|
|
11786
11844
|
cwd
|
|
@@ -11978,7 +12036,7 @@ var uiStateRule = {
|
|
|
11978
12036
|
};
|
|
11979
12037
|
|
|
11980
12038
|
// eslint/rules/unknown-utility.ts
|
|
11981
|
-
import { existsSync as
|
|
12039
|
+
import { existsSync as existsSync14, readdirSync as readdirSync6, readFileSync as readFileSync15, statSync as statSync6 } from "fs";
|
|
11982
12040
|
import { createRequire } from "module";
|
|
11983
12041
|
import path81 from "path";
|
|
11984
12042
|
var PREFIX_NAMESPACES = {
|
|
@@ -12284,7 +12342,7 @@ function resolvePackageStylesheet(fromFile, specifier) {
|
|
|
12284
12342
|
while (directory !== path81.dirname(directory)) {
|
|
12285
12343
|
const packageRoot = path81.join(directory, "node_modules", packageName);
|
|
12286
12344
|
const manifestPath = path81.join(packageRoot, "package.json");
|
|
12287
|
-
if (
|
|
12345
|
+
if (existsSync14(manifestPath)) {
|
|
12288
12346
|
try {
|
|
12289
12347
|
const manifest = readFileSync15(manifestPath, "utf8");
|
|
12290
12348
|
const stylesheet = /"style"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
@@ -12292,7 +12350,7 @@ function resolvePackageStylesheet(fromFile, specifier) {
|
|
|
12292
12350
|
const target = stylesheet ?? main;
|
|
12293
12351
|
if (!target) return void 0;
|
|
12294
12352
|
const resolved = path81.resolve(packageRoot, target);
|
|
12295
|
-
return
|
|
12353
|
+
return existsSync14(resolved) ? resolved : void 0;
|
|
12296
12354
|
} catch {
|
|
12297
12355
|
return void 0;
|
|
12298
12356
|
}
|
|
@@ -12630,7 +12688,7 @@ var valueExtractionRule = {
|
|
|
12630
12688
|
};
|
|
12631
12689
|
|
|
12632
12690
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
12633
|
-
import { existsSync as
|
|
12691
|
+
import { existsSync as existsSync15, readFileSync as readFileSync16 } from "fs";
|
|
12634
12692
|
import path84 from "path";
|
|
12635
12693
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
12636
12694
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
@@ -12666,7 +12724,7 @@ var trackedDocsRule = {
|
|
|
12666
12724
|
if (root.type !== "Object") return;
|
|
12667
12725
|
const projectRoot = path84.dirname(path84.resolve(context.filename));
|
|
12668
12726
|
const configPath = path84.join(projectRoot, "vulyk.config.ts");
|
|
12669
|
-
if (!
|
|
12727
|
+
if (!existsSync15(configPath)) {
|
|
12670
12728
|
context.report({
|
|
12671
12729
|
node,
|
|
12672
12730
|
message: "No vulyk.config.ts found. Run npx vulyk init to create one that tracks the framework's required tracked docs."
|
|
@@ -12691,7 +12749,7 @@ var trackedDocsRule = {
|
|
|
12691
12749
|
}
|
|
12692
12750
|
}
|
|
12693
12751
|
const agentsPath = path84.join(projectRoot, "AGENTS.md");
|
|
12694
|
-
if (!
|
|
12752
|
+
if (!existsSync15(agentsPath)) {
|
|
12695
12753
|
context.report({
|
|
12696
12754
|
node,
|
|
12697
12755
|
message: "No AGENTS.md found. Run npx vulyk agents to generate the agent file that routes to the tracked docs."
|