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/quadcode-site/node_modules/css-resolve-import/src/parse.js
module.exports = parse

var fs = require('fs')
var path = require('path')
var format = require('util').format
var stripUTF8ByteOrder = require('./strip-utf8-byte-order')
var stringImportMatcher = /@import ["'](.+)["'];?/g
var importMatcher = /@import +(?:url\()?([^()]+)\)?(:? *;)?/g
var urlMatcher = /url\(["']?((?:[^"'()]+?)(?:\?.*?)?)["']?\)/g
var queryParamsMatcher = /(\?.*)$/i
var urlWithScheme = /^(?:[a-z][a-z-+.0-9]*:)?\/\//i
var absoluteUrl = /^\//i
var dataUrl = /^data:/

function parse(file, absRoot, transform) {
	if(!transform) transform = function(content) { return content }
	var root = path.dirname(file)
	var absRoot = absRoot || ''
	var relRoot = path.relative(absRoot, root)
	var content = transform(stripUTF8ByteOrder(fs.readFileSync(file, 'utf8')))

	return content
		.replace(stringImportMatcher, function(match, url) {
			return format('@import url(%s);', url)
		})
		.replace(urlMatcher, function(match, url) {
			url = url.trim()
			if(!url.match(dataUrl) && !url.match(urlWithScheme) && !url.match(absoluteUrl)) {
				url = path.join(relRoot, url).replace(/\\/g, '/')
			}
			return format('url(%s)', url)
		})
		.replace(importMatcher, function(match, file) {
			if(file.match(urlWithScheme)) {
				return format('@import url(%s);', file)
			}

			if(!file.match(absoluteUrl)) {
				file = file.replace(queryParamsMatcher, '')
				file = path.join(absRoot, file)
			}
			var parsedFile = parse(file, absRoot, transform)
			return parsedFile +'\n'
		})
		.trim()
}