lightningcss-tailwindcss 0.0.0 → 1.0.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/index.js +19 -19
- package/package.json +13 -2
package/dist/index.js
CHANGED
|
@@ -39,9 +39,27 @@ function tokenToString(token) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function tokenOrValueListToString(nodes) {
|
|
42
|
+
function renderTokenOrValue(node) {
|
|
43
|
+
switch (node.type) {
|
|
44
|
+
case "token": return tokenToString(node.value);
|
|
45
|
+
case "function": return `${node.value.name}(${tokenOrValueListToString(node.value.arguments)})`;
|
|
46
|
+
case "dashed-ident":
|
|
47
|
+
case "animation-name": return String(node.value);
|
|
48
|
+
case "length": return `${node.value.value}${node.value.unit}`;
|
|
49
|
+
case "angle": return `${node.value.value}${node.value.type}`;
|
|
50
|
+
case "time": return `${node.value.value}${node.value.type === "seconds" ? "s" : "ms"}`;
|
|
51
|
+
case "resolution": return `${node.value.value}${node.value.type}`;
|
|
52
|
+
case "url": return `url(${String(node.value.url)})`;
|
|
53
|
+
case "var": return `var(${String(node.value.name)})`;
|
|
54
|
+
case "env": return `env(${String(node.value.name)})`;
|
|
55
|
+
case "color":
|
|
56
|
+
case "unresolved-color": return JSON.stringify(node.value);
|
|
57
|
+
default: return "";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
42
60
|
let output = "";
|
|
43
61
|
for (const [index, node] of nodes.entries()) {
|
|
44
|
-
const rendered =
|
|
62
|
+
const rendered = renderTokenOrValue(node);
|
|
45
63
|
if (node.type === "token" && node.value.type === "number" && index > 0) {
|
|
46
64
|
const previous = nodes[index - 1];
|
|
47
65
|
if (previous && previous.type === "token" && previous.value.type === "ident") {
|
|
@@ -55,24 +73,6 @@ function tokenOrValueListToString(nodes) {
|
|
|
55
73
|
}
|
|
56
74
|
return output;
|
|
57
75
|
}
|
|
58
|
-
function tokenOrValueToString(node) {
|
|
59
|
-
switch (node.type) {
|
|
60
|
-
case "token": return tokenToString(node.value);
|
|
61
|
-
case "function": return `${node.value.name}(${tokenOrValueListToString(node.value.arguments)})`;
|
|
62
|
-
case "dashed-ident":
|
|
63
|
-
case "animation-name": return String(node.value);
|
|
64
|
-
case "length": return `${node.value.value}${node.value.unit}`;
|
|
65
|
-
case "angle": return `${node.value.value}${node.value.type}`;
|
|
66
|
-
case "time": return `${node.value.value}${node.value.type === "seconds" ? "s" : "ms"}`;
|
|
67
|
-
case "resolution": return `${node.value.value}${node.value.type}`;
|
|
68
|
-
case "url": return `url(${String(node.value.url)})`;
|
|
69
|
-
case "var": return `var(${String(node.value.name)})`;
|
|
70
|
-
case "env": return `env(${String(node.value.name)})`;
|
|
71
|
-
case "color":
|
|
72
|
-
case "unresolved-color": return JSON.stringify(node.value);
|
|
73
|
-
default: return "";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
76
|
function splitCandidateList(input) {
|
|
77
77
|
const candidates = [];
|
|
78
78
|
let current = "";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lightningcss-tailwindcss",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"description": "Lightning CSS AST utilities for analyzing Tailwind CSS syntax",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,17 +35,28 @@
|
|
|
35
35
|
"README.zh.md",
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
40
|
+
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"lightningcss": "^1.
|
|
42
|
+
"lightningcss": "^1.32.0"
|
|
40
43
|
},
|
|
41
44
|
"publishConfig": {
|
|
42
45
|
"access": "public",
|
|
43
46
|
"registry": "https://registry.npmjs.org"
|
|
44
47
|
},
|
|
48
|
+
"tsd": {
|
|
49
|
+
"directory": "test-d",
|
|
50
|
+
"compilerOptions": {
|
|
51
|
+
"skipLibCheck": true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
45
54
|
"scripts": {
|
|
46
55
|
"dev": "tsdown --watch --sourcemap",
|
|
47
56
|
"build": "tsdown",
|
|
57
|
+
"lint": "eslint src test test-d",
|
|
48
58
|
"test": "vitest run",
|
|
59
|
+
"test:types": "tsd",
|
|
49
60
|
"test:dev": "vitest",
|
|
50
61
|
"release": "pnpm publish",
|
|
51
62
|
"sync": "cnpm sync lightningcss-tailwindcss",
|