Home / File/ attribute-selector-parser.bench.ts — tailwindcss Source File

attribute-selector-parser.bench.ts — tailwindcss Source File

Architecture documentation for attribute-selector-parser.bench.ts, a typescript file in the tailwindcss codebase. 2 imports, 0 dependents.

File typescript Oxide 2 imports

Entity Profile

Dependency Diagram

graph LR
  3fd2aa67_0f4f_95b7_fb2c_f92e9b44b15f["attribute-selector-parser.bench.ts"]
  73875259_ec95_9835_94d8_655298d1f0e9["attribute-selector-parser.ts"]
  3fd2aa67_0f4f_95b7_fb2c_f92e9b44b15f --> 73875259_ec95_9835_94d8_655298d1f0e9
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  3fd2aa67_0f4f_95b7_fb2c_f92e9b44b15f --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 3fd2aa67_0f4f_95b7_fb2c_f92e9b44b15f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { bench, describe } from 'vitest'
import * as AttributeSelectorParser from './attribute-selector-parser'

let examples = [
  '[open]',
  '[data-foo]',
  '[data-state=expanded]',
  '[data-state = expanded ]',
  '[data-state*="expanded"]',
  '[data-state*="expanded"i]',
  '[data-state*=expanded i]',
]

const ATTRIBUTE_REGEX =
  /\[\s*(?<attribute>[a-zA-Z_-][a-zA-Z0-9_-]*)\s*((?<operator>[*|~^$]?=)\s*(?<quote>['"])?\s*(?<value>.*?)\4\s*(?<sensitivity>[is])?\s*)?\]/

describe('parsing', () => {
  bench('AttributeSelectorParser.parse', () => {
    for (let example of examples) {
      AttributeSelectorParser.parse(example)
    }
  })

  bench('REGEX.test(…)', () => {
    for (let example of examples) {
      ATTRIBUTE_REGEX.exec(example)
    }
  })

  bench('….match(REGEX)', () => {
    for (let example of examples) {
      example.match(ATTRIBUTE_REGEX)
    }
  })
})

Domain

Dependencies

Frequently Asked Questions

What does attribute-selector-parser.bench.ts do?
attribute-selector-parser.bench.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain.
What does attribute-selector-parser.bench.ts depend on?
attribute-selector-parser.bench.ts imports 2 module(s): attribute-selector-parser.ts, vitest.
Where is attribute-selector-parser.bench.ts in the architecture?
attribute-selector-parser.bench.ts is located at packages/tailwindcss/src/attribute-selector-parser.bench.ts (domain: Oxide, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free