diff --git a/package.json b/package.json index 4de7fb9..c9603c0 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "knip": "knip" }, "dependencies": { - "@projectwallace/css-parser": "~0.18.9" + "@projectwallace/css-parser": "~0.19.0" }, "devDependencies": { "@projectwallace/preset-oxlint": "^0.0.11", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3bc0d4..26430e1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@projectwallace/css-parser': - specifier: ~0.18.9 - version: 0.18.9 + specifier: ~0.19.0 + version: 0.19.0 devDependencies: '@projectwallace/preset-oxlint': specifier: ^0.0.11 @@ -564,8 +564,8 @@ packages: cpu: [x64] os: [win32] - '@projectwallace/css-parser@0.18.9': - resolution: {integrity: sha512-euAUMV2madmhqCeTVNGbeewj8x0VhUIxVik/aGpyIrVBbKfzDV3IxEu/YDTYdUTkwrf+RZPyDkiYQhDuZMW/cg==} + '@projectwallace/css-parser@0.19.0': + resolution: {integrity: sha512-Sgb2uCRJbVfsEHbGaypNd8XnBcwtofc8vwDuxLrXXMQ1BeYT0X7Jr/DuFgbDX4cvQT9HusLXcNWT8JdjFzV/cw==} engines: {pnpm: '>=11.0.0'} '@projectwallace/preset-oxlint@0.0.11': @@ -1681,7 +1681,7 @@ snapshots: '@oxlint/binding-win32-x64-msvc@1.89.0': optional: true - '@projectwallace/css-parser@0.18.9': {} + '@projectwallace/css-parser@0.19.0': {} '@projectwallace/preset-oxlint@0.0.11(oxlint@1.89.0)': dependencies: diff --git a/src/index.ts b/src/index.ts index aea77b0..7689832 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,9 +14,7 @@ import { is_atrule, is_selector, is_declaration, - is_supports_query, is_supports_declaration, - is_layer_name, is_identifier, is_attribute_selector, is_type_selector, @@ -315,10 +313,14 @@ function analyzeInternal(css: string, options: Options, useLo if (is_atrule_prelude(node.prelude) && node.prelude.has_children) { for (let child of node.prelude) { - if (is_supports_query(child)) { + if (!is_function(child)) { + continue + } + + if (str_equals('supports', child.name) && child.value) { supports.p(child.value, toLoc(child)) - } else if (is_layer_name(child) && child.value) { - // can be empty string + } else if (str_equals('layer', child.name) && child.value) { + // layer() can be empty layers.p(child.value, toLoc(child)) layerNamesTracking.use(child.value) } @@ -869,7 +871,7 @@ function analyzeInternal(css: string, options: Options, useLo } else if (is_url(node)) { let { value } = node let embed = unquote(value ?? '') - if (str_starts_with(embed, 'data:')) { + if (str_starts_with('data:', embed)) { let size = embed.length let type = getEmbedType(embed) diff --git a/src/selectors/utils.ts b/src/selectors/utils.ts index 7f55458..8f1d204 100644 --- a/src/selectors/utils.ts +++ b/src/selectors/utils.ts @@ -76,7 +76,7 @@ export function isAccessibility( walk(selector, function (node) { if (is_attribute_selector(node)) { const name = node.name || '' - if (str_equals('role', name) || str_starts_with(name, 'aria-')) { + if (str_equals('role', name) || str_starts_with('aria-', name)) { on_selector(normalize(node)) } }