diff --git a/package-lock.json b/package-lock.json index 095a6c3..d4a88ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,10 @@ "version": "2.0.2", "license": "MIT", "dependencies": { - "css-tree": "^3.0.0" + "@projectwallace/css-parser": "^0.6.3" }, "devDependencies": { "@codecov/vite-plugin": "^1.2.1", - "@types/css-tree": "^2.3.8", "c8": "^10.1.2", "prettier": "^3.3.3", "typescript": "5.4.2", @@ -29,6 +28,7 @@ "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz", "integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==", "dev": true, + "license": "MIT", "dependencies": { "@actions/exec": "^1.1.1", "@actions/http-client": "^2.0.1" @@ -39,20 +39,25 @@ "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", "dev": true, + "license": "MIT", "dependencies": { "@actions/io": "^1.0.1" } }, "node_modules/@actions/github": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz", - "integrity": "sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.1.tgz", + "integrity": "sha512-xbZVcaqD4XnQAe35qSQqskb3SqIAfRyLBrHMd/8TuL7hJSz2QtbDwnNM8zWx4zO5l2fnGtseNE3MbEvD7BxVMw==", "dev": true, + "license": "MIT", "dependencies": { "@actions/http-client": "^2.2.0", "@octokit/core": "^5.0.1", - "@octokit/plugin-paginate-rest": "^9.0.0", - "@octokit/plugin-rest-endpoint-methods": "^10.0.0" + "@octokit/plugin-paginate-rest": "^9.2.2", + "@octokit/plugin-rest-endpoint-methods": "^10.4.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", + "undici": "^5.28.5" } }, "node_modules/@actions/http-client": { @@ -60,6 +65,7 @@ "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz", "integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==", "dev": true, + "license": "MIT", "dependencies": { "tunnel": "^0.0.6", "undici": "^5.25.4" @@ -69,7 +75,8 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz", "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@bcoe/v8-coverage": { "version": "0.2.3", @@ -78,10 +85,11 @@ "dev": true }, "node_modules/@codecov/bundler-plugin-core": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@codecov/bundler-plugin-core/-/bundler-plugin-core-1.2.1.tgz", - "integrity": "sha512-9Iqr+PAQ/QVEnvKr56W/Jo8IaWJDFQkbcffNgG8Oc5GIQ1NRWsPmL/jxhkGrnp2LMJnpG2gPtV3+fet1jy6gbA==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@codecov/bundler-plugin-core/-/bundler-plugin-core-1.9.1.tgz", + "integrity": "sha512-dt3ic7gMswz4p/qdkYPVJwXlLiLsz55rBBn2I7mr0HTG8pCoLRqnANJIwo5WrqGBZgPyVSMPBqBra6VxLWfDyA==", "dev": true, + "license": "MIT", "dependencies": { "@actions/core": "^1.10.1", "@actions/github": "^6.0.0", @@ -95,19 +103,20 @@ } }, "node_modules/@codecov/vite-plugin": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@codecov/vite-plugin/-/vite-plugin-1.2.1.tgz", - "integrity": "sha512-fxlSsRpilO593qzpZ+7gOij/adWJmfcGkuR+b68OaBZq/kAH1IDssZX1RO6/mKtxr+BcjByZ7mcKU59SFHVWIA==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@codecov/vite-plugin/-/vite-plugin-1.9.1.tgz", + "integrity": "sha512-S6Yne7comVulJ1jD3T7rCfYFHPR0zUjAYoLjUDPXNJCUrdzWJdf/ak/UepE7TicqQG+yBa6eb5WusqcPgg+1AQ==", "dev": true, + "license": "MIT", "dependencies": { - "@codecov/bundler-plugin-core": "^1.2.1", + "@codecov/bundler-plugin-core": "^1.9.1", "unplugin": "^1.10.1" }, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "vite": "4.x || 5.x" + "vite": "4.x || 5.x || 6.x" } }, "node_modules/@esbuild/aix-ppc64": { @@ -483,6 +492,7 @@ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "dev": true, + "license": "MIT", "engines": { "node": ">=14" } @@ -543,21 +553,23 @@ "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } }, "node_modules/@octokit/core": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.0.tgz", - "integrity": "sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz", + "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { "@octokit/auth-token": "^4.0.0", "@octokit/graphql": "^7.1.0", - "@octokit/request": "^8.3.1", - "@octokit/request-error": "^5.1.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", "@octokit/types": "^13.0.0", "before-after-hook": "^2.2.0", "universal-user-agent": "^6.0.0" @@ -567,10 +579,11 @@ } }, "node_modules/@octokit/endpoint": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", - "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" @@ -580,12 +593,13 @@ } }, "node_modules/@octokit/graphql": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.0.tgz", - "integrity": "sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz", + "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==", "dev": true, + "license": "MIT", "dependencies": { - "@octokit/request": "^8.3.0", + "@octokit/request": "^8.4.1", "@octokit/types": "^13.0.0", "universal-user-agent": "^6.0.0" }, @@ -594,16 +608,18 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "22.2.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", - "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==", - "dev": true + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.1.tgz", - "integrity": "sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.2.tgz", + "integrity": "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^12.6.0" }, @@ -618,13 +634,15 @@ "version": "20.0.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { "version": "12.6.0", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/openapi-types": "^20.0.0" } @@ -634,6 +652,7 @@ "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^12.6.0" }, @@ -648,25 +667,28 @@ "version": "20.0.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": { "version": "12.6.0", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/openapi-types": "^20.0.0" } }, "node_modules/@octokit/request": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", - "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", + "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", "dev": true, + "license": "MIT", "dependencies": { - "@octokit/endpoint": "^9.0.1", - "@octokit/request-error": "^5.1.0", + "@octokit/endpoint": "^9.0.6", + "@octokit/request-error": "^5.1.1", "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" }, @@ -675,10 +697,11 @@ } }, "node_modules/@octokit/request-error": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", - "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz", + "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.1.0", "deprecation": "^2.0.0", @@ -689,12 +712,13 @@ } }, "node_modules/@octokit/types": { - "version": "13.6.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", - "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", "dev": true, + "license": "MIT", "dependencies": { - "@octokit/openapi-types": "^22.2.0" + "@octokit/openapi-types": "^24.2.0" } }, "node_modules/@pkgjs/parseargs": { @@ -707,6 +731,12 @@ "node": ">=14" } }, + "node_modules/@projectwallace/css-parser": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@projectwallace/css-parser/-/css-parser-0.6.3.tgz", + "integrity": "sha512-eyV8H19ZFsRNkSLsp3RCNecAcc1X6syO/glQAvpHp8nid64ILYi+apFSz3fKkz75KY+syjL5ZZsZiH/GeHT4Bw==", + "license": "MIT" + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.25.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.25.0.tgz", @@ -941,12 +971,6 @@ "win32" ] }, - "node_modules/@types/css-tree": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@types/css-tree/-/css-tree-2.3.8.tgz", - "integrity": "sha512-zABG3nI2UENsx7AQv63tI5/ptoAG/7kQR1H0OvG+WTWYHOR5pfAT3cGgC8SdyCrgX/TTxJBZNmx82IjCXs1juQ==", - "dev": true - }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -960,10 +984,11 @@ "dev": true }, "node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1008,13 +1033,15 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -1057,6 +1084,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1178,23 +1206,12 @@ "node": ">= 8" } }, - "node_modules/css-tree": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.0.1.tgz", - "integrity": "sha512-8Fxxv+tGhORlshCdCwnNJytvlvq46sOLSYEx2ZIGurahWvMucSRnyjPA3AmrMq4VPRYbHVpWj5VkiVasrM2H4Q==", - "dependencies": { - "mdn-data": "2.12.1", - "source-map-js": "^1.0.1" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" - } - }, "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/dequal": { "version": "2.0.3", @@ -1329,10 +1346,11 @@ } }, "node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "dev": true, + "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", @@ -1474,11 +1492,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mdn-data": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.12.1.tgz", - "integrity": "sha512-rsfnCbOHjqrhWxwt5/wtSLzpoKTzW7OXdT5lLOIH1OTYhWu9rRJveGq0sKvDZODABH7RX+uoR+DYcpFnq4Tf6Q==" - }, "node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -1513,9 +1526,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "dev": true, "funding": [ { @@ -1523,6 +1536,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -1535,6 +1549,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, + "license": "ISC", "dependencies": { "wrappy": "1" } @@ -1765,6 +1780,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -1896,6 +1912,7 @@ "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } @@ -1914,10 +1931,11 @@ } }, "node_modules/undici": { - "version": "5.28.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", - "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "version": "5.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz", + "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==", "dev": true, + "license": "MIT", "dependencies": { "@fastify/busboy": "^2.0.0" }, @@ -1929,27 +1947,21 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/unplugin": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.15.0.tgz", - "integrity": "sha512-jTPIs63W+DUEDW207ztbaoO7cQ4p5aVaB823LSlxpsFEU3Mykwxf3ZGC/wzxFJeZlASZYgVrWeo7LgOrqJZ8RA==", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.16.1.tgz", + "integrity": "sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w==", "dev": true, + "license": "MIT", "dependencies": { "acorn": "^8.14.0", "webpack-virtual-modules": "^0.6.2" }, "engines": { "node": ">=14.0.0" - }, - "peerDependencies": { - "webpack-sources": "^3" - }, - "peerDependenciesMeta": { - "webpack-sources": { - "optional": true - } } }, "node_modules/uvu": { @@ -1985,10 +1997,11 @@ } }, "node_modules/vite": { - "version": "5.4.10", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.10.tgz", - "integrity": "sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==", + "version": "5.4.21", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", + "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", "dev": true, + "license": "MIT", "peer": true, "dependencies": { "esbuild": "^0.21.3", @@ -2048,7 +2061,8 @@ "version": "0.6.2", "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz", "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/which": { "version": "2.0.2", @@ -2157,7 +2171,8 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/y18n": { "version": "5.0.8", @@ -2249,10 +2264,11 @@ } }, "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index 539a5f2..4d5fd09 100644 --- a/package.json +++ b/package.json @@ -25,21 +25,17 @@ "scripts": { "build": "vite build", "test": "c8 --reporter=lcov uvu", - "check": "tsc", + "check": "tsc --noEmit", "prettier": "prettier --check src/**/*.js test/**/*.js" }, "devDependencies": { "@codecov/vite-plugin": "^1.2.1", - "@types/css-tree": "^2.3.8", "c8": "^10.1.2", "prettier": "^3.3.3", "typescript": "5.4.2", "uvu": "^0.5.6", "vite": "^5.4.10" }, - "dependencies": { - "css-tree": "^3.0.0" - }, "files": [ "dist", "index.d.ts" @@ -58,5 +54,8 @@ "useTabs": true, "printWidth": 140, "singleQuote": true + }, + "dependencies": { + "@projectwallace/css-parser": "^0.6.3" } -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index 30bd728..fa080fb 100644 --- a/src/index.js +++ b/src/index.js @@ -1,49 +1,21 @@ -import * as csstree from 'css-tree' import { TreeNode } from './TreeNode.js' +import { NODE_AT_RULE, NODE_PRELUDE_IMPORT_LAYER, NODE_PRELUDE_LAYER_NAME, parse, traverse } from '@projectwallace/css-parser' -/** - * @typedef Location - * @property {number} line - * @property {number} column - * @property {number} start - * @property {number} end - */ +/** @param {string} name */ +function get_layer_names(name) { + return name.split('.').map((s) => s.trim()) +} -/** - * @param {import('css-tree').CssNode} node - * @returns {Location | undefined} - */ -function get_location(node) { - let loc = node.loc - if (!loc) return +/** @param {import('@projectwallace/css-parser').CSSNode} node */ +function create_location(node) { return { - line: loc.start.line, - column: loc.start.column, - start: loc.start.offset, - end: loc.end.offset, + line: node.line, + column: node.column, + start: node.offset, } } -/** @param {import('css-tree').Atrule} node */ -function is_layer(node) { - return node.name.toLowerCase() === 'layer' -} - -/** - * @param {import('css-tree').AtrulePrelude} prelude - * @returns {string[]} - */ -function get_layer_names(prelude) { - return csstree - // @todo: fewer loops plz - .generate(prelude) - .split('.') - .map((s) => s.trim()) -} - -/** - * @param {import('css-tree').CssNode} ast - */ +/** @param {import('@projectwallace/css-parser').CSSNode} ast */ export function layer_tree_from_ast(ast) { /** @type {string[]} */ let current_stack = [] @@ -56,79 +28,80 @@ export function layer_tree_from_ast(ast) { return `__anonymous-${anonymous_counter}__` } - csstree.walk(ast, { - visit: 'Atrule', + traverse(ast, { enter(node) { - if (is_layer(node)) { - let location = get_location(node) - - if (node.prelude === null) { - let layer_name = get_anonymous_id() - root.add_child(current_stack, layer_name, location) - current_stack.push(layer_name) - } else if (node.prelude.type === 'AtrulePrelude') { - if (node.block === null) { - // @ts-expect-error CSSTree types are not updated yet in @types/css-tree - let prelude = csstree.findAll(node.prelude, n => n.type === 'Layer').map(n => n.name) - for (let name of prelude) { - // Split the layer name by dots to handle nested layers - let parts = name.split('.').map((/** @type {string} */ s) => s.trim()) + if (node.type !== NODE_AT_RULE) return + if (node.name === 'layer') { + if (node.prelude !== null) { + let groups = node.prelude.split(',').map((s) => s.trim()) + if (!node.has_block) { + for (let name of groups) { + let parts = get_layer_names(name) // Ensure all parent layers exist and add them to the tree for (let i = 0; i < parts.length; i++) { let path = parts.slice(0, i) - let layerName = parts[i] - // Only add location to the final layer in dotted notation - // Create a new copy to avoid sharing references - let loc = i === parts.length - 1 ? {...location} : undefined - root.add_child(path, layerName, loc) + let layer_name = parts[i] + if (layer_name) { + // Only add location to the final layer in dotted notation + // Create a new copy to avoid sharing references + let loc = i === parts.length - 1 ? create_location(node) : undefined + root.add_child(path, layer_name, loc) + } } } } else { - for (let layer_name of get_layer_names(node.prelude)) { - root.add_child(current_stack, layer_name, location) - current_stack.push(layer_name) + for (let child of node.children) { + if (child.type === NODE_PRELUDE_LAYER_NAME) { + root.add_child(current_stack, child.text, create_location(node)) + current_stack.push(child.text) + } } } + } else { + let name = get_anonymous_id() + root.add_child(current_stack, name, create_location(node)) + current_stack.push(name) } - } else if (node.name.toLowerCase() === 'import' && node.prelude !== null && node.prelude.type === 'AtrulePrelude') { - let location = get_location(node) - let prelude = node.prelude - + } else if (node.name === 'import') { // @import url("foo.css") layer(test); // OR // @import url("foo.css") layer(test.nested); - // @ts-expect-error CSSTree types are not updated to v3 yet - let layer = csstree.find(prelude, n => n.type === 'Layer') - if (layer) { - // @ts-expect-error CSSTree types are not updated to v3 yet - for (let layer_name of get_layer_names(layer)) { - root.add_child(current_stack, layer_name, location) - current_stack.push(layer_name) + let layerNode = node.children.find((child) => child.type === NODE_PRELUDE_IMPORT_LAYER) + if (layerNode) { + if (layerNode.name.trim()) { + for (let layer_name of get_layer_names(layerNode.name)) { + root.add_child(current_stack, layer_name, create_location(node)) + current_stack.push(layer_name) + } + } else { + // @import url("foo.css") layer; + let name = get_anonymous_id() + root.add_child([], name, create_location(node)) } - return this.skip - } - - // @import url("foo.css") layer; - let layer_keyword = csstree.find(prelude, n => n.type === 'Identifier' && n.name.toLowerCase() === 'layer') - if (layer_keyword) { - root.add_child([], get_anonymous_id(), location) - return this.skip } } }, leave(node) { - if (is_layer(node)) { - if (node.prelude !== null && node.prelude.type === 'AtrulePrelude') { - let layer_names = get_layer_names(node.prelude) - for (let i = 0; i < layer_names.length; i++) { - current_stack.pop() + if (node.type !== NODE_AT_RULE) return + + if (node.name === 'layer') { + if (node.has_prelude) { + let has_block = node.has_children && node.children.some((c) => c.type !== NODE_PRELUDE_LAYER_NAME) + if (has_block) { + let name = node.children.find((child) => child.type === NODE_PRELUDE_LAYER_NAME) + if (name) { + let layer_names = get_layer_names(name.text) + for (let i = 0; i < layer_names.length; i++) { + current_stack.pop() + } + } } } else { // pop the anonymous layer current_stack.pop() } - } else if (node.name.toLowerCase() === 'import') { + } else if (node.name === 'import') { // clear the stack, imports can not be nested current_stack.length = 0 } @@ -142,13 +115,11 @@ export function layer_tree_from_ast(ast) { * @param {string} css */ export function layer_tree(css) { - let ast = csstree.parse(css, { - positions: true, - parseAtrulePrelude: true, - parseValue: false, - parseRulePrelude: false, - parseCustomProperty: false, + let ast = parse(css, { + parse_selectors: false, + parse_values: false, + skip_comments: true, }) return layer_tree_from_ast(ast) -} \ No newline at end of file +} diff --git a/test/global.spec.js b/test/global.spec.js index 0f08623..271cc6e 100644 --- a/test/global.spec.js +++ b/test/global.spec.js @@ -26,29 +26,29 @@ test('mixed imports and layers', () => { { name: '__anonymous-1__', is_anonymous: true, - locations: [{ line: 2, column: 3, start: 3, end: 33 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [], }, { name: 'test', is_anonymous: false, - locations: [{ line: 3, column: 3, start: 36, end: 72 }], + locations: [{ line: 3, column: 3, start: 36 }], children: [], }, { name: 'anotherTest', is_anonymous: false, - locations: [{ line: 4, column: 3, start: 75, end: 148 }], + locations: [{ line: 4, column: 3, start: 75 }], children: [ { name: 'moreTest', is_anonymous: false, - locations: [{ line: 5, column: 4, start: 99, end: 144 }], + locations: [{ line: 5, column: 4, start: 99 }], children: [ { name: 'deepTest', is_anonymous: false, - locations: [{ line: 6, column: 5, start: 121, end: 139 }], + locations: [{ line: 6, column: 5, start: 121 }], children: [], }, ], @@ -58,7 +58,7 @@ test('mixed imports and layers', () => { { name: '__anonymous-2__', is_anonymous: true, - locations: [{ line: 10, column: 3, start: 176, end: 185 }], + locations: [{ line: 10, column: 3, start: 176 }], children: [], }, ] @@ -76,24 +76,24 @@ test('the fokus.dev boilerplate', () => { { name: 'core', is_anonymous: false, - locations: [{ line: 2, column: 3, start: 3, end: 49 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [ { name: 'reset', is_anonymous: false, - locations: [{ line: 3, column: 3, start: 52, end: 94 }], + locations: [{ line: 3, column: 3, start: 52 }], children: [], }, { name: 'tokens', is_anonymous: false, - locations: [{ line: 3, column: 3, start: 52, end: 94 }], + locations: [{ line: 3, column: 3, start: 52 }], children: [], }, { name: 'base', is_anonymous: false, - locations: [{ line: 3, column: 3, start: 52, end: 94 }], + locations: [{ line: 3, column: 3, start: 52 }], children: [], }, ], @@ -101,18 +101,18 @@ test('the fokus.dev boilerplate', () => { { name: 'third-party', is_anonymous: false, - locations: [{ line: 2, column: 3, start: 3, end: 49 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [ { name: 'imports', is_anonymous: false, - locations: [{ line: 4, column: 3, start: 97, end: 147 }], + locations: [{ line: 4, column: 3, start: 97 }], children: [], }, { name: 'overrides', is_anonymous: false, - locations: [{ line: 4, column: 3, start: 97, end: 147 }], + locations: [{ line: 4, column: 3, start: 97 }], children: [], }, ], @@ -120,18 +120,18 @@ test('the fokus.dev boilerplate', () => { { name: 'components', is_anonymous: false, - locations: [{ line: 2, column: 3, start: 3, end: 49 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [ { name: 'base', is_anonymous: false, - locations: [{ line: 5, column: 3, start: 150, end: 196 }], + locations: [{ line: 5, column: 3, start: 150 }], children: [], }, { name: 'variations', is_anonymous: false, - locations: [{ line: 5, column: 3, start: 150, end: 196 }], + locations: [{ line: 5, column: 3, start: 150 }], children: [], }, ], @@ -139,7 +139,7 @@ test('the fokus.dev boilerplate', () => { { name: 'utility', is_anonymous: false, - locations: [{ line: 2, column: 3, start: 3, end: 49 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [], }, ] diff --git a/test/import.spec.js b/test/import.spec.js index 5e22b83..973575a 100644 --- a/test/import.spec.js +++ b/test/import.spec.js @@ -4,93 +4,113 @@ import { layer_tree } from '../src/index.js' test('@import url() layer', () => { let actual = layer_tree('@import url("foo.css") layer;') - let expected = [{ - name: '__anonymous-1__', - is_anonymous: true, - locations: [{ line: 1, column: 1, start: 0, end: 29 }], - children: [] - }] + let expected = [ + { + name: '__anonymous-1__', + is_anonymous: true, + locations: [{ line: 1, column: 1, start: 0 }], + children: [], + }, + ] assert.equal(actual, expected) }) test('@import url() LAYER', () => { let actual = layer_tree('@import url("foo.css") LAYER;') - let expected = [{ - "name": "__anonymous-1__", - is_anonymous: true, - locations: [{ line: 1, column: 1, start: 0, end: 29 }], - "children": [] - }] + let expected = [ + { + name: '__anonymous-1__', + is_anonymous: true, + locations: [{ line: 1, column: 1, start: 0 }], + children: [], + }, + ] assert.equal(actual, expected) }) test('@import url() layer(named)', () => { let actual = layer_tree('@import url("foo.css") layer(named);') - let expected = [{ - name: 'named', - is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 36 }], - children: [] - }] + let expected = [ + { + name: 'named', + is_anonymous: false, + locations: [{ line: 1, column: 1, start: 0 }], + children: [], + }, + ] assert.equal(actual, expected) }) test('@import url() LAYER(named)', () => { let actual = layer_tree('@import url("foo.css") LAYER(named);') - let expected = [{ - name: 'named', - is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 36 }], - children: [] - }] + let expected = [ + { + name: 'named', + is_anonymous: false, + locations: [{ line: 1, column: 1, start: 0 }], + children: [], + }, + ] assert.equal(actual, expected) }) test('@import url() layer(named.nested)', () => { let actual = layer_tree('@import url("foo.css") layer(named.nested);') - let expected = [{ - name: 'named', - is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 43 }], - children: [{ - name: 'nested', + let expected = [ + { + name: 'named', is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 43 }], - children: [] - }] - }] + locations: [{ line: 1, column: 1, start: 0 }], + children: [ + { + name: 'nested', + is_anonymous: false, + locations: [{ line: 1, column: 1, start: 0 }], + children: [], + }, + ], + }, + ] assert.equal(actual, expected) }) test('@import url() layer(named.nested )', () => { let actual = layer_tree('@import url("foo.css") layer(named.nested );') - let expected = [{ - name: 'named', - is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 48 }], - children: [{ - name: 'nested', + let expected = [ + { + name: 'named', is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 48 }], - children: [] - }] - }] + locations: [{ line: 1, column: 1, start: 0 }], + children: [ + { + name: 'nested', + is_anonymous: false, + locations: [{ line: 1, column: 1, start: 0 }], + children: [], + }, + ], + }, + ] assert.equal(actual, expected) }) test('@import url() layer(/* test */named.nested )', () => { let actual = layer_tree('@import url("foo.css") layer(/* test */named.nested );') - let expected = [{ - name: 'named', - is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 58 }], - children: [{ - name: 'nested', + let expected = [ + { + name: 'named', is_anonymous: false, - locations: [{ line: 1, column: 1, start: 0, end: 58 }], - children: [] - }] - }] + locations: [{ line: 1, column: 1, start: 0 }], + children: [ + { + name: 'nested', + is_anonymous: false, + locations: [{ line: 1, column: 1, start: 0 }], + children: [], + }, + ], + }, + ] assert.equal(actual, expected) }) diff --git a/test/layer.spec.js b/test/layer.spec.js index aa30478..eb35f43 100644 --- a/test/layer.spec.js +++ b/test/layer.spec.js @@ -9,7 +9,7 @@ test('single anonymous layer without body', () => { name: '__anonymous-1__', is_anonymous: true, children: [], - locations: [{ line: 1, column: 1, start: 0, end: 7 }], + locations: [{ line: 1, column: 1, start: 0 }], }, ] assert.equal(actual, expected) @@ -22,7 +22,7 @@ test('single anonymous layer with body', () => { name: '__anonymous-1__', is_anonymous: true, children: [], - locations: [{ line: 1, column: 1, start: 0, end: 9 }], + locations: [{ line: 1, column: 1, start: 0 }], }, ] assert.equal(actual, expected) @@ -35,7 +35,7 @@ test('single named layer without body', () => { name: 'first', is_anonymous: false, children: [], - locations: [{ line: 1, column: 1, start: 0, end: 13 }], + locations: [{ line: 1, column: 1, start: 0 }], }, ] assert.equal(actual, expected) @@ -48,7 +48,7 @@ test('single named layer with body', () => { name: 'first', is_anonymous: false, children: [], - locations: [{ line: 1, column: 1, start: 0, end: 15 }], + locations: [{ line: 1, column: 1, start: 0 }], }, ] assert.equal(actual, expected) @@ -61,13 +61,13 @@ test('multiple named layers in one line', () => { name: 'first', is_anonymous: false, children: [], - locations: [{ line: 1, column: 1, start: 0, end: 21 }], + locations: [{ line: 1, column: 1, start: 0 }], }, { name: 'second', is_anonymous: false, children: [], - locations: [{ line: 1, column: 1, start: 0, end: 21 }], + locations: [{ line: 1, column: 1, start: 0 }], }, ] assert.equal(actual, expected) @@ -84,8 +84,8 @@ test('repeated use of the same layer name', () => { is_anonymous: false, children: [], locations: [ - { line: 2, column: 3, start: 3, end: 18 }, - { line: 3, column: 3, start: 21, end: 36 }, + { line: 2, column: 3, start: 3 }, + { line: 3, column: 3, start: 21 }, ], }, ] @@ -106,23 +106,23 @@ test('nested layers', () => { { name: 'first', is_anonymous: false, - locations: [{ line: 2, column: 3, start: 3, end: 104 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [ { name: 'second', is_anonymous: false, - locations: [{ line: 3, column: 4, start: 21, end: 100 }], + locations: [{ line: 3, column: 4, start: 21 }], children: [ { name: 'third', is_anonymous: false, - locations: [{ line: 4, column: 5, start: 41, end: 56 }], + locations: [{ line: 4, column: 5, start: 41 }], children: [], }, { name: 'fourth', is_anonymous: false, - locations: [{ line: 6, column: 5, start: 79, end: 95 }], + locations: [{ line: 6, column: 5, start: 79 }], children: [], }, ], @@ -143,13 +143,13 @@ test('nested layers with anonymous layers', () => { { name: '__anonymous-1__', is_anonymous: true, - locations: [{ line: 2, column: 3, start: 3, end: 28 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [ { name: '__anonymous-2__', is_anonymous: true, children: [], - locations: [{ line: 3, column: 4, start: 15, end: 24 }], + locations: [{ line: 3, column: 4, start: 15 }], }, ], }, @@ -166,13 +166,13 @@ test('consecutive anonymous layers', () => { { name: '__anonymous-1__', is_anonymous: true, - locations: [{ line: 2, column: 3, start: 3, end: 12 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [], }, { name: '__anonymous-2__', is_anonymous: true, - locations: [{ line: 3, column: 3, start: 15, end: 24 }], + locations: [{ line: 3, column: 3, start: 15 }], children: [], }, ] @@ -191,20 +191,20 @@ test('nested layers with anonymous layers and duplicate names', () => { { name: '__anonymous-1__', is_anonymous: true, - locations: [{ line: 2, column: 3, start: 3, end: 34 }], + locations: [{ line: 2, column: 3, start: 3 }], children: [ { name: 'first', is_anonymous: false, children: [], - locations: [{ line: 3, column: 4, start: 15, end: 30 }], + locations: [{ line: 3, column: 4, start: 15 }], }, ], }, { name: 'first', is_anonymous: false, - locations: [{ line: 6, column: 3, start: 38, end: 53 }], + locations: [{ line: 6, column: 3, start: 38 }], children: [], }, ] diff --git a/vite.config.js b/vite.config.js index c1eedd2..cdb164f 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,24 +1,24 @@ -import { resolve } from "path" -import { defineConfig } from "vite" -import { codecovVitePlugin } from "@codecov/vite-plugin" +import { resolve } from 'path' +import { defineConfig } from 'vite' +import { codecovVitePlugin } from '@codecov/vite-plugin' export default defineConfig({ - build: { - lib: { - entry: resolve(__dirname, "src/index.js"), - formats: ['es'] - }, - rollupOptions: { - // make sure to externalize deps that shouldn't be bundled - // into your library - external: ['css-tree'], - }, - }, - plugins: [ - codecovVitePlugin({ - enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, - bundleName: "cssLayerTree", - uploadToken: process.env.CODECOV_TOKEN, - }), - ], + build: { + lib: { + entry: resolve(__dirname, 'src/index.js'), + formats: ['es'], + }, + rollupOptions: { + // make sure to externalize deps that shouldn't be bundled + // into your library + external: ['@projectwallace/css-parser'], + }, + }, + plugins: [ + codecovVitePlugin({ + enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, + bundleName: 'cssLayerTree', + uploadToken: process.env.CODECOV_TOKEN, + }), + ], })