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.

Entity Profile

Dependency Diagram

graph LR
  ca83c373_c965_8bcf_df6e_ba93e9fd4c69["attribute-selector-parser.bench.ts"]
  73e07df9_b6bc_e7d7_b7c1_3151a7ee5c27["attribute-selector-parser.ts"]
  ca83c373_c965_8bcf_df6e_ba93e9fd4c69 --> 73e07df9_b6bc_e7d7_b7c1_3151a7ee5c27
  696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"]
  ca83c373_c965_8bcf_df6e_ba93e9fd4c69 --> 696bd648_5f24_1b59_8e8b_7a97a692869e
  style ca83c373_c965_8bcf_df6e_ba93e9fd4c69 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 OxideEngine 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: OxideEngine, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

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

Try Supermodel Free