HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
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/zaklada/html/node_modules/gulp-uglify/node_modules/uglify-js/bin/extract-props.js
#! /usr/bin/env node

"use strict";

var U2 = require("../tools/node");
var fs = require("fs");
var yargs = require("yargs");
var ARGS = yargs
    .describe("o", "Output file")
    .argv;
var files = ARGS._.slice();
var output = {
    vars: {},
    props: {}
};

if (ARGS.o) try {
    output = JSON.parse(fs.readFileSync(ARGS.o, "utf8"));
} catch(ex) {}

files.forEach(getProps);

if (ARGS.o) {
    fs.writeFileSync(ARGS.o, JSON.stringify(output, null, 2), "utf8");
} else {
    console.log("%s", JSON.stringify(output, null, 2));
}

function getProps(filename) {
    var code = fs.readFileSync(filename, "utf8");
    var ast = U2.parse(code);

    ast.walk(new U2.TreeWalker(function(node){
        if (node instanceof U2.AST_ObjectKeyVal) {
            add(node.key);
        }
        else if (node instanceof U2.AST_ObjectProperty) {
            add(node.key.name);
        }
        else if (node instanceof U2.AST_Dot) {
            add(node.property);
        }
        else if (node instanceof U2.AST_Sub) {
            addStrings(node.property);
        }
    }));

    function addStrings(node) {
        var out = {};
        try {
            (function walk(node){
                node.walk(new U2.TreeWalker(function(node){
                    if (node instanceof U2.AST_Seq) {
                        walk(node.cdr);
                        return true;
                    }
                    if (node instanceof U2.AST_String) {
                        add(node.value);
                        return true;
                    }
                    if (node instanceof U2.AST_Conditional) {
                        walk(node.consequent);
                        walk(node.alternative);
                        return true;
                    }
                    throw out;
                }));
            })(node);
        } catch(ex) {
            if (ex !== out) throw ex;
        }
    }

    function add(name) {
        output.props[name] = true;
    }
}