@@ -5,7 +5,7 @@ import { isSupportsBrowserhack, isMediaBrowserhack } from './atrules/atrules.js'
55import { getCombinators, getComplexity, isAccessibility, isPrefixed } from './selectors/utils.js'
66import { colorFunctions, colorKeywords, namedColors, systemColors } from './values/colors.js'
77import { destructure, isSystemFont } from './values/destructure-font-shorthand.js'
8- import { isValueKeyword } from './values/values.js'
8+ import { isValueKeyword, keywords } from './values/values.js'
99import { analyzeAnimation } from './values/animations.js'
1010import { isValuePrefixed } from './values/vendor-prefix.js'
1111import { ContextCollection } from './context-collection.js'
@@ -175,6 +175,7 @@ export function analyze(css, options = {}) {
175175 let colorFormats = new Collection(useLocations)
176176 let units = new ContextCollection(useLocations)
177177 let gradients = new Collection(useLocations)
178+ let valueKeywords = new Collection(useLocations)
178179
179180 walk(ast, function (node) {
180181 switch (node.type) {
@@ -412,6 +413,7 @@ export function analyze(css, options = {}) {
412413 case Value: {
413414 if (isValueKeyword(node)) {
414415 valueComplexities.push(1)
416+ valueKeywords.p(stringifyNode(node), node.loc)
415417 break
416418 }
417419
@@ -450,7 +452,11 @@ export function analyze(css, options = {}) {
450452 } else if (isProperty('font', property)) {
451453 if (isSystemFont(node)) return
452454
453- let { font_size, line_height, font_family } = destructure(node, stringifyNode)
455+ let { font_size, line_height, font_family } = destructure(node, stringifyNode, function (item) {
456+ if (item.type === 'keyword') {
457+ valueKeywords.p(item.value, loc)
458+ }
459+ })
454460
455461 if (font_family) {
456462 fontFamilies.p(font_family, loc)
@@ -481,6 +487,8 @@ export function analyze(css, options = {}) {
481487 timingFunctions.p(stringifyNode(item.value), loc)
482488 } else if (item.type === 'duration') {
483489 durations.p(stringifyNode(item.value), loc)
490+ } else if (item.type === 'keyword') {
491+ valueKeywords.p(stringifyNode(item.value), loc)
484492 }
485493 })
486494 break
@@ -533,6 +541,10 @@ export function analyze(css, options = {}) {
533541 return this.skip
534542 }
535543 case Identifier: {
544+ if (keywords.has(nodeName)) {
545+ valueKeywords.p(nodeName, loc)
546+ }
547+
536548 // Bail out if it can't be a color name
537549 // 20 === 'lightgoldenrodyellow'.length
538550 // 3 === 'red'.length
@@ -870,6 +882,7 @@ export function analyze(css, options = {}) {
870882 browserhacks: valueBrowserhacks.c(),
871883 units: units.count(),
872884 complexity: valueComplexity,
885+ keywords: valueKeywords.c(),
873886 },
874887 __meta__: {
875888 parseTime: startAnalysis - startParse,
0 commit comments