Skip to content

Commit dd058fa

Browse files
authored
expose a whole lot of helper functions (#364)
1 parent d795b7b commit dd058fa

File tree

5 files changed

+430
-311
lines changed

5 files changed

+430
-311
lines changed

src/index.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import parse from 'css-tree/parser'
22
import walk from 'css-tree/walker'
33
import { calculate } from '@bramus/specificity/core'
44
import { isSupportsBrowserhack, isMediaBrowserhack } from './atrules/atrules.js'
5-
import { getCombinators, getComplexity, isAccessibility } from './selectors/utils.js'
5+
import { getCombinators, getComplexity, isAccessibility, isPrefixed } from './selectors/utils.js'
66
import { colorFunctions, colorKeywords, namedColors, systemColors } from './values/colors.js'
77
import { destructure, isSystemFont } from './values/destructure-font-shorthand.js'
88
import { isValueKeyword } from './values/values.js'
99
import { analyzeAnimation } from './values/animations.js'
10-
import { isAstVendorPrefixed } from './values/vendor-prefix.js'
10+
import { isValuePrefixed } from './values/vendor-prefix.js'
1111
import { ContextCollection } from './context-collection.js'
1212
import { Collection } from './collection.js'
1313
import { AggregateCollection } from './aggregate-collection.js'
@@ -284,9 +284,9 @@ export function analyze(css, options = {}) {
284284
a11y.p(selector, node.loc)
285285
}
286286

287-
let [complexity, isPrefixed] = getComplexity(node)
287+
let complexity = getComplexity(node)
288288

289-
if (isPrefixed) {
289+
if (isPrefixed(node)) {
290290
prefixedSelectors.p(selector, node.loc)
291291
}
292292

@@ -392,7 +392,7 @@ export function analyze(css, options = {}) {
392392
let declaration = this.declaration
393393
let { property, important } = declaration
394394

395-
if (isAstVendorPrefixed(node)) {
395+
if (isValuePrefixed(node)) {
396396
vendorPrefixedValues.p(stringifyNode(node), node.loc)
397397
}
398398

@@ -838,4 +838,29 @@ export function compareSpecificity(a, b) {
838838
}
839839

840840
return b[0] - a[0]
841-
}
841+
}
842+
843+
export {
844+
getComplexity as selectorComplexity,
845+
isPrefixed as isSelectorPrefixed,
846+
isAccessibility as isAccessibilitySelector,
847+
} from './selectors/utils.js'
848+
849+
export {
850+
isSupportsBrowserhack,
851+
isMediaBrowserhack
852+
} from './atrules/atrules.js'
853+
854+
export {
855+
isBrowserhack as isValueBrowserhack
856+
} from './values/browserhacks.js'
857+
858+
export {
859+
isHack as isPropertyHack,
860+
} from './properties/property-utils.js'
861+
862+
export {
863+
isValuePrefixed
864+
} from './values/vendor-prefix.js'
865+
866+
export { hasVendorPrefix } from './vendor-prefix.js'

0 commit comments

Comments
 (0)