Repository: tailwindlabs/tailwindcss
File: src/corePlugins.js (JavaScript)

Code before:
      sort: maxSort,
      values: areSimpleScreens ? buildScreenValues('max') : {},
    })

    // screens and min-* are sorted together when they can be
    let id = 'min-screens'
    for (let screen of screens) {
      addVariant(screen.name, `@media ${buildMediaQuery(screen)}`, {
        id,
        sort: areSimpleScreens && screensUseConsistentUnits ? minSort : undefined,
        value: screen,
      })
    }

    matchVariant('min', buildScreenVariant('min'), {
      id,
      sort: minSort,
    })
  },

  supportsVariants: ({ matchVariant, theme }) => {
    matchVariant(
      'supports',
      (value = '') => {
        let check = value.startsWith('--') ? value : normalize(value)
        let isRaw = /^[\w-]*\s*\(/.test(check)

        // Chrome has a bug where `(condtion1)or(condition2)` is not valid
        // But `(condition1) or (condition2)` is supported.
        check = isRaw ? check.replace(/\b(and|or|not)\b/g, ' $1 ') : check

        if (isRaw) {
          return `@supports ${check}`
        }

        if (!check.includes(':')) {
          check = `${check}: var(--tw)`
        }

        if (!(check.startsWith('(') && check.endsWith(')'))) {
          check = `(${check})`
        }

        return `@supports ${check}`
      },
      { values: theme('supports') ?? {} }
    )
  },

  hasVariants: ({ matchVariant }) => {
    matchVariant('has', (value) => `&:has(${normalize(value)})`, { values: {} })

Review comment (security):
2 changes made
- added a `value.startsWith('--')` pre-normalization check that operates in line with #13537 to prevent automatic `var(…)` injection when checking support for custom properties
   
   example: `supports-[--test]:flex` with vs. without with the `value.startsWith('--')` to prevent normalizing:
   - ❌ `@supports var(--test)` (before, without check)
   - ✅ `@supports (--test: var(--tw))` (after, with check)
- added hyphen-support for regex pattern matching raw `supports` queries

Code after:
      sort: maxSort,
      values: areSimpleScreens ? buildScreenValues('max') : {},
    })

    // screens and min-* are sorted together when they can be
    let id = 'min-screens'
    for (let screen of screens) {
      addVariant(screen.name, `@media ${buildMediaQuery(screen)}`, {
        id,
        sort: areSimpleScreens && screensUseConsistentUnits ? minSort : undefined,
        value: screen,
      })
    }

    matchVariant('min', buildScreenVariant('min'), {
      id,
      sort: minSort,
    })
  },

  supportsVariants: ({ matchVariant, theme }) => {
    matchVariant(
      'supports',
      (value = '') => {
        let check = value.startsWith('--') ? value : normalize(value)
        let isRaw = /^[\w-]*\s*\(/.test(check)

        // Chrome has a bug where `(condition1)or(condition2)` is not valid
        // But `(condition1) or (condition2)` is supported.
        check = isRaw ? check.replace(/\b(and|or|not)\b/g, ' $1 ') : check

        if (isRaw) {
          return `@supports ${check}`
        }

        if (!check.includes(':')) {
          check = `${check}: var(--tw)`
        }

        if (!(check.startsWith('(') && check.endsWith(')'))) {
          check = `(${check})`
        }

        return `@supports ${check}`
      },
      { values: theme('supports') ?? {} }
    )
  },

  hasVariants: ({ matchVariant, prefix }) => {
    matchVariant('has', (value) => `&:has(${normalize(value)})`, {