@master/css-mcp 2.1.0 → 2.1.2
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/format.js +1 -1
- package/dist/lint.js +2 -2
- package/dist/preview-write-lock.js +18 -5
- package/dist/scan.js +8 -2
- package/package.json +8 -8
package/dist/format.js
CHANGED
|
@@ -52,7 +52,7 @@ async function previewDirectiveFormat(context, options = {}) {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
const files = await resolveSourceFiles(context, options.patterns
|
|
55
|
+
const files = await resolveSourceFiles(context, options.patterns, void 0, DEFAULT_DIRECTIVE_FORMAT_PATTERNS);
|
|
56
56
|
const formattedFiles = await Promise.all(files.map(async (filePath) => {
|
|
57
57
|
const content = await readFile(filePath, "utf8");
|
|
58
58
|
return formatContent(service, filePath, content, options.range);
|
package/dist/lint.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFile } from "node:fs/promises";
|
|
|
4
4
|
import { createToolingSessionSync } from "@master/css-tooling/node";
|
|
5
5
|
import { fixMasterCSSContent, lintMasterCSSContent, resolveMasterCSSLintRules, summarizeMasterCSSLintFiles } from "@master/css-tooling/lint";
|
|
6
6
|
// src/lint.ts
|
|
7
|
-
const DEFAULT_LINT_SOURCE_PATTERNS = ["**/*.{html,htm,js,jsx,cjs,ts,tsx,mts,cts,svelte,astro,vue,md,mdx,pug,php,css,scss,less}"];
|
|
7
|
+
const DEFAULT_LINT_SOURCE_PATTERNS = ["**/*.{html,htm,js,mjs,jsx,cjs,ts,tsx,mts,cts,svelte,astro,vue,md,mdx,pug,php,css,scss,less}"];
|
|
8
8
|
const DEFAULT_IGNORE_PATTERNS = ["**/node_modules/**", "node_modules"];
|
|
9
9
|
const LINT_REPORT_VERSION = 5;
|
|
10
10
|
async function loadLintState(context, options = {}) {
|
|
@@ -14,7 +14,7 @@ async function loadLintState(context, options = {}) {
|
|
|
14
14
|
manifest: requireWorkspaceManifest(manifest),
|
|
15
15
|
nativeClassNames: manifest.nativeClassNames
|
|
16
16
|
});
|
|
17
|
-
const files = await resolveSourceFiles(context, options.patterns
|
|
17
|
+
const files = await resolveSourceFiles(context, options.patterns, options.patterns ? [] : DEFAULT_IGNORE_PATTERNS, DEFAULT_LINT_SOURCE_PATTERNS);
|
|
18
18
|
return {
|
|
19
19
|
rules,
|
|
20
20
|
manifest,
|
|
@@ -8,6 +8,19 @@ const NAME = /^(\d+)-[a-f0-9-]+\.json$/;
|
|
|
8
8
|
function missing(error) {
|
|
9
9
|
return error?.code === "ENOENT";
|
|
10
10
|
}
|
|
11
|
+
const SHARING = /* @__PURE__ */ new Set([
|
|
12
|
+
"EPERM",
|
|
13
|
+
"EACCES",
|
|
14
|
+
"EBUSY"
|
|
15
|
+
]);
|
|
16
|
+
async function retrySharing(operation, deadline) {
|
|
17
|
+
while (true) try {
|
|
18
|
+
return await operation();
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (!SHARING.has(error?.code ?? "") || performance.now() >= deadline) throw error;
|
|
21
|
+
await setTimeout(5);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
11
24
|
async function remove(file) {
|
|
12
25
|
try {
|
|
13
26
|
await unlink(file);
|
|
@@ -23,7 +36,7 @@ function alive(pid) {
|
|
|
23
36
|
return error.code !== "ESRCH";
|
|
24
37
|
}
|
|
25
38
|
}
|
|
26
|
-
async function tickets(directory) {
|
|
39
|
+
async function tickets(directory, deadline) {
|
|
27
40
|
const entries = [];
|
|
28
41
|
for (const id of await readdir(directory)) {
|
|
29
42
|
const register = id.endsWith(".next") ? id.slice(0, -5) : id;
|
|
@@ -38,7 +51,7 @@ async function tickets(directory) {
|
|
|
38
51
|
if (id !== register) continue;
|
|
39
52
|
let text;
|
|
40
53
|
try {
|
|
41
|
-
text = await readFile(file, "utf8");
|
|
54
|
+
text = await retrySharing(() => readFile(file, "utf8"), deadline);
|
|
42
55
|
} catch (error) {
|
|
43
56
|
if (missing(error)) continue;
|
|
44
57
|
throw error;
|
|
@@ -65,21 +78,21 @@ async function withPreviewWriteLock(work, options = {}) {
|
|
|
65
78
|
});
|
|
66
79
|
const publish = async (value) => {
|
|
67
80
|
await writeFile(file + ".next", JSON.stringify(value), { mode: 384 });
|
|
68
|
-
await rename(file + ".next", file);
|
|
81
|
+
await retrySharing(() => rename(file + ".next", file), deadline);
|
|
69
82
|
};
|
|
70
83
|
try {
|
|
71
84
|
await publish({
|
|
72
85
|
choosing: true,
|
|
73
86
|
number: "0"
|
|
74
87
|
});
|
|
75
|
-
const number = (await tickets(directory)).reduce((max, peer) => peer.number > max ? peer.number : max, 0n) + 1n;
|
|
88
|
+
const number = (await tickets(directory, deadline)).reduce((max, peer) => peer.number > max ? peer.number : max, 0n) + 1n;
|
|
76
89
|
await publish({
|
|
77
90
|
choosing: false,
|
|
78
91
|
number: String(number)
|
|
79
92
|
});
|
|
80
93
|
while (true) {
|
|
81
94
|
if (performance.now() >= deadline) throw new Error("Timed out waiting for another MCP preview apply.");
|
|
82
|
-
if (!(await tickets(directory)).some((peer) => peer.id !== id && (peer.choosing || peer.number < number || peer.number === number && peer.id < id))) return await work();
|
|
95
|
+
if (!(await tickets(directory, deadline)).some((peer) => peer.id !== id && (peer.choosing || peer.number < number || peer.number === number && peer.id < id))) return await work();
|
|
83
96
|
await setTimeout(10);
|
|
84
97
|
}
|
|
85
98
|
} finally {
|
package/dist/scan.js
CHANGED
|
@@ -9,7 +9,13 @@ import { captureMasterCSSProject, createMasterCSSInspectionReport } from "@maste
|
|
|
9
9
|
// src/scan.ts
|
|
10
10
|
const DEFAULT_SOURCE_PATTERNS = ["**/*.{html,htm,js,jsx,mjs,cjs,ts,tsx,mts,cts,svelte,astro,vue,md,mdx,pug,php}"];
|
|
11
11
|
const DEFAULT_IGNORE_PATTERNS = ["**/node_modules/**", "node_modules"];
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Resolve source files for a tool. Default patterns follow the source policy, which
|
|
14
|
+
* skips ignored build output such as `dist/`; only patterns the caller was given
|
|
15
|
+
* select ignored files explicitly.
|
|
16
|
+
*/
|
|
17
|
+
async function resolveSourceFiles(context, explicitPatterns, ignore = DEFAULT_IGNORE_PATTERNS, defaultPatterns = DEFAULT_SOURCE_PATTERNS) {
|
|
18
|
+
const patterns = [...explicitPatterns ?? defaultPatterns];
|
|
13
19
|
context.validateGlobPatterns(patterns);
|
|
14
20
|
const sources = await fg(patterns, {
|
|
15
21
|
cwd: context.root,
|
|
@@ -18,7 +24,7 @@ async function resolveSourceFiles(context, patterns = DEFAULT_SOURCE_PATTERNS, i
|
|
|
18
24
|
followSymbolicLinks: false
|
|
19
25
|
});
|
|
20
26
|
const policy = new SourcePolicy(context.root, { exclude: ignore });
|
|
21
|
-
return Promise.all(sources.filter((source) => policy.accepts(source,
|
|
27
|
+
return Promise.all(sources.filter((source) => policy.accepts(source, explicitPatterns !== void 0)).map((source) => context.resolveExistingFile(source)));
|
|
22
28
|
}
|
|
23
29
|
async function scanProject(context, options = {}) {
|
|
24
30
|
if (options.designSystem && options.context === "preset") throw new Error("designSystem inspection requires project context; omit context or select \"project\".");
|
package/package.json
CHANGED
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
"provenance": true
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@master/css": "2.1.
|
|
54
|
-
"@master/css-compiler": "2.1.
|
|
55
|
-
"@master/css-language-service": "2.1.
|
|
56
|
-
"@master/css-tooling": "2.1.
|
|
57
|
-
"@master/css-preset": "2.1.
|
|
58
|
-
"@master/css-schema": "2.1.
|
|
53
|
+
"@master/css": "2.1.2",
|
|
54
|
+
"@master/css-compiler": "2.1.2",
|
|
55
|
+
"@master/css-language-service": "2.1.2",
|
|
56
|
+
"@master/css-tooling": "2.1.2",
|
|
57
|
+
"@master/css-preset": "2.1.2",
|
|
58
|
+
"@master/css-schema": "2.1.2",
|
|
59
59
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
60
60
|
"fast-glob": "^3.3.3",
|
|
61
61
|
"vscode-languageserver-textdocument": "^1.0.16",
|
|
62
62
|
"zod": "^4.6.7"
|
|
63
63
|
},
|
|
64
|
-
"version": "2.1.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "2.1.2",
|
|
65
|
+
"gitHead": "0ad01fb1255150ce0e11cd5cf3093517fe9acd0d"
|
|
66
66
|
}
|