@unocss/eslint-plugin 0.57.7 → 0.58.0
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/worker.cjs +27 -2
- package/dist/worker.d.cts +4 -1
- package/dist/worker.d.mts +4 -1
- package/dist/worker.d.ts +4 -1
- package/dist/worker.mjs +26 -3
- package/package.json +8 -8
package/dist/worker.cjs
CHANGED
|
@@ -52,15 +52,35 @@ async function getGenerator() {
|
|
|
52
52
|
promise = promise || _getGenerator();
|
|
53
53
|
return await promise;
|
|
54
54
|
}
|
|
55
|
+
function setGenerator(generator) {
|
|
56
|
+
promise = Promise.resolve(generator);
|
|
57
|
+
}
|
|
55
58
|
async function actionSort(classes) {
|
|
56
59
|
return await sortRules(classes, await getGenerator());
|
|
57
60
|
}
|
|
58
61
|
async function actionBlocklist(classes, id) {
|
|
59
62
|
const uno = await getGenerator();
|
|
63
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
60
64
|
const extracted = await uno.applyExtractors(classes, id);
|
|
61
|
-
|
|
65
|
+
const values = [...extracted.values()];
|
|
66
|
+
const matchBlocked = async (raw) => {
|
|
67
|
+
if (blocked.has(raw))
|
|
68
|
+
return;
|
|
69
|
+
if (uno.isBlocked(raw)) {
|
|
70
|
+
blocked.add(raw);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let current = raw;
|
|
74
|
+
for (const p of uno.config.preprocess)
|
|
75
|
+
current = p(raw);
|
|
76
|
+
const applied = await uno.matchVariants(raw, current);
|
|
77
|
+
if (applied && uno.isBlocked(applied[1]))
|
|
78
|
+
blocked.add(raw);
|
|
79
|
+
};
|
|
80
|
+
await Promise.all(values.map(matchBlocked));
|
|
81
|
+
return [...blocked];
|
|
62
82
|
}
|
|
63
|
-
function
|
|
83
|
+
async function runAsync(action, ...args) {
|
|
64
84
|
switch (action) {
|
|
65
85
|
case "sort":
|
|
66
86
|
return actionSort(...args);
|
|
@@ -68,7 +88,12 @@ function run(action, ...args) {
|
|
|
68
88
|
return actionBlocklist(...args);
|
|
69
89
|
}
|
|
70
90
|
}
|
|
91
|
+
function run(action, ...args) {
|
|
92
|
+
return runAsync(action, ...args);
|
|
93
|
+
}
|
|
71
94
|
synckit.runAsWorker(run);
|
|
72
95
|
|
|
73
96
|
exports.getGenerator = getGenerator;
|
|
74
97
|
exports.run = run;
|
|
98
|
+
exports.runAsync = runAsync;
|
|
99
|
+
exports.setGenerator = setGenerator;
|
package/dist/worker.d.cts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { UnoGenerator } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
declare function getGenerator(): Promise<UnoGenerator<any>>;
|
|
4
|
+
declare function setGenerator(generator: Awaited<UnoGenerator<any>>): void;
|
|
5
|
+
declare function runAsync(action: 'sort', classes: string): Promise<string>;
|
|
6
|
+
declare function runAsync(action: 'blocklist', classes: string, id?: string): Promise<string[]>;
|
|
4
7
|
declare function run(action: 'sort', classes: string): string;
|
|
5
8
|
declare function run(action: 'blocklist', classes: string, id?: string): string[];
|
|
6
9
|
|
|
7
|
-
export { getGenerator, run };
|
|
10
|
+
export { getGenerator, run, runAsync, setGenerator };
|
package/dist/worker.d.mts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { UnoGenerator } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
declare function getGenerator(): Promise<UnoGenerator<any>>;
|
|
4
|
+
declare function setGenerator(generator: Awaited<UnoGenerator<any>>): void;
|
|
5
|
+
declare function runAsync(action: 'sort', classes: string): Promise<string>;
|
|
6
|
+
declare function runAsync(action: 'blocklist', classes: string, id?: string): Promise<string[]>;
|
|
4
7
|
declare function run(action: 'sort', classes: string): string;
|
|
5
8
|
declare function run(action: 'blocklist', classes: string, id?: string): string[];
|
|
6
9
|
|
|
7
|
-
export { getGenerator, run };
|
|
10
|
+
export { getGenerator, run, runAsync, setGenerator };
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { UnoGenerator } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
declare function getGenerator(): Promise<UnoGenerator<any>>;
|
|
4
|
+
declare function setGenerator(generator: Awaited<UnoGenerator<any>>): void;
|
|
5
|
+
declare function runAsync(action: 'sort', classes: string): Promise<string>;
|
|
6
|
+
declare function runAsync(action: 'blocklist', classes: string, id?: string): Promise<string[]>;
|
|
4
7
|
declare function run(action: 'sort', classes: string): string;
|
|
5
8
|
declare function run(action: 'blocklist', classes: string, id?: string): string[];
|
|
6
9
|
|
|
7
|
-
export { getGenerator, run };
|
|
10
|
+
export { getGenerator, run, runAsync, setGenerator };
|
package/dist/worker.mjs
CHANGED
|
@@ -46,15 +46,35 @@ async function getGenerator() {
|
|
|
46
46
|
promise = promise || _getGenerator();
|
|
47
47
|
return await promise;
|
|
48
48
|
}
|
|
49
|
+
function setGenerator(generator) {
|
|
50
|
+
promise = Promise.resolve(generator);
|
|
51
|
+
}
|
|
49
52
|
async function actionSort(classes) {
|
|
50
53
|
return await sortRules(classes, await getGenerator());
|
|
51
54
|
}
|
|
52
55
|
async function actionBlocklist(classes, id) {
|
|
53
56
|
const uno = await getGenerator();
|
|
57
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
54
58
|
const extracted = await uno.applyExtractors(classes, id);
|
|
55
|
-
|
|
59
|
+
const values = [...extracted.values()];
|
|
60
|
+
const matchBlocked = async (raw) => {
|
|
61
|
+
if (blocked.has(raw))
|
|
62
|
+
return;
|
|
63
|
+
if (uno.isBlocked(raw)) {
|
|
64
|
+
blocked.add(raw);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
let current = raw;
|
|
68
|
+
for (const p of uno.config.preprocess)
|
|
69
|
+
current = p(raw);
|
|
70
|
+
const applied = await uno.matchVariants(raw, current);
|
|
71
|
+
if (applied && uno.isBlocked(applied[1]))
|
|
72
|
+
blocked.add(raw);
|
|
73
|
+
};
|
|
74
|
+
await Promise.all(values.map(matchBlocked));
|
|
75
|
+
return [...blocked];
|
|
56
76
|
}
|
|
57
|
-
function
|
|
77
|
+
async function runAsync(action, ...args) {
|
|
58
78
|
switch (action) {
|
|
59
79
|
case "sort":
|
|
60
80
|
return actionSort(...args);
|
|
@@ -62,6 +82,9 @@ function run(action, ...args) {
|
|
|
62
82
|
return actionBlocklist(...args);
|
|
63
83
|
}
|
|
64
84
|
}
|
|
85
|
+
function run(action, ...args) {
|
|
86
|
+
return runAsync(action, ...args);
|
|
87
|
+
}
|
|
65
88
|
runAsWorker(run);
|
|
66
89
|
|
|
67
|
-
export { getGenerator, run };
|
|
90
|
+
export { getGenerator, run, runAsync, setGenerator };
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.0",
|
|
4
4
|
"description": "ESLint plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/antfu",
|
|
8
|
-
"homepage": "https://github.com/unocss/unocss/tree/main/packages/
|
|
8
|
+
"homepage": "https://github.com/unocss/unocss/tree/main/packages/eslint-plugin#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/unocss/unocss",
|
|
12
|
-
"directory": "packages/
|
|
12
|
+
"directory": "packages/eslint-plugin"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/unocss/unocss/issues"
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"node": ">=14"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@typescript-eslint/utils": "^6.
|
|
37
|
+
"@typescript-eslint/utils": "^6.13.1",
|
|
38
38
|
"magic-string": "^0.30.5",
|
|
39
|
-
"synckit": "^0.8.
|
|
40
|
-
"@unocss/config": "0.
|
|
41
|
-
"@unocss/core": "0.
|
|
39
|
+
"synckit": "^0.8.6",
|
|
40
|
+
"@unocss/config": "0.58.0",
|
|
41
|
+
"@unocss/core": "0.58.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@unocss/eslint-plugin": "0.
|
|
44
|
+
"@unocss/eslint-plugin": "0.58.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "unbuild",
|