HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/exnova-telegram-bot-v2/node_modules/tailwindcss/src/lib/findAtConfigPath.js
import fs from 'fs'
import path from 'path'

/**
 * Find the @config at-rule in the given CSS AST and return the relative path to the config file
 *
 * @param {import('postcss').Root} root
 * @param {import('postcss').Result} result
 */
export function findAtConfigPath(root, result) {
  let configPath = null
  let relativeTo = null

  root.walkAtRules('config', (rule) => {
    relativeTo = rule.source?.input.file ?? result.opts.from ?? null

    if (relativeTo === null) {
      throw rule.error(
        'The `@config` directive cannot be used without setting `from` in your PostCSS config.'
      )
    }

    if (configPath) {
      throw rule.error('Only one `@config` directive is allowed per file.')
    }

    let matches = rule.params.match(/(['"])(.*?)\1/)
    if (!matches) {
      throw rule.error('A path is required when using the `@config` directive.')
    }

    let inputPath = matches[2]
    if (path.isAbsolute(inputPath)) {
      throw rule.error('The `@config` directive cannot be used with an absolute path.')
    }

    configPath = path.resolve(path.dirname(relativeTo), inputPath)
    if (!fs.existsSync(configPath)) {
      throw rule.error(
        `The config file at "${inputPath}" does not exist. Make sure the path is correct and the file exists.`
      )
    }

    rule.remove()
  })

  return configPath ? configPath : null
}