| Server IP : 82.148.16.210 / Your IP : 216.73.216.169 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : 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, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/projects/env4/src/dev/frontend3/node_modules/postcss-syntax/ |
Upload File : |
"use strict";
const path = require("path");
const patched = {};
function isPromise (obj) {
return typeof obj === "object" && typeof obj.then === "function";
}
function runDocument (plugin) {
const result = this.result;
result.lastPlugin = plugin;
const promise = result.root.nodes.map(root => {
try {
return plugin(root, result);
} catch (error) {
this.handleError(error, plugin);
throw error;
}
});
if (promise.some(isPromise)) {
return Promise.all(promise);
}
}
function patchDocument (Document, LazyResult) {
LazyResult = LazyResult.prototype;
const runRoot = LazyResult.run;
LazyResult.run = function run () {
return (this.result.root instanceof Document ? runDocument : runRoot).apply(this, arguments);
};
}
function patchNode (Node) {
Node = Node.prototype;
const NodeToString = Node.toString;
Node.toString = function toString (stringifier) {
return NodeToString.call(this, stringifier || this.root().source.syntax);
};
}
function patch (Document) {
let fn;
let file;
if (Document) {
patch();
fn = patchDocument.bind(this, Document);
file = "lazy-result";
} else {
fn = patchNode;
file = "node";
}
findPostcss().map(dir => (
[dir + "lib", file].join(path.sep)
)).filter(file => (
!patched[file]
)).forEach(file => {
try {
fn(require(file));
} catch (ex) {
//
}
patched[file] = true;
});
}
function findPostcss () {
const result = {};
for (const file in require.cache) {
if (/^(.+?(\\|\/))postcss(\2)/.test(file)) {
result[RegExp.lastMatch] = true;
}
}
return Object.keys(result);
}
module.exports = patch;