HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
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/vhost/disk-apps/dev-telemedicina.teky.com.co/public/lib/jsPDF-1.3.2/build.js
var fs = require('fs');
var rollup = require('rollup');
var uglify = require('uglify-js');
var babel = require('rollup-plugin-babel');
var execSync = require('child_process').execSync;

bundle({
    minified: 'dist/jspdf.min.js',
    debug: 'dist/jspdf.debug.js'
});

// Monkey patching adler32 and filesaver
function monkeyPatch() {
    return {
        transform: function (code, id) {
            var file = id.split('/').pop();
            if (file === 'adler32cs.js') {
                code = code.replace(/this, function/g, 'jsPDF, function');
                code = code.replace(/require\('buffer'\)/g, '{}');
            }
            return code;
        }
    }
}

// Rollup removes local variables unless used within a module.
// This plugin makes sure specified local variables are preserved 
// and kept local. This plugin wouldn't be necessary if es2015
// modules would be used.
function rawjs(opts) {
    opts = opts || {};
    return {
        transform: function (code, id) {
            var variable = opts[id.split('/').pop()];
            if (!variable) return code;

            var keepStr = '/*rollup-keeper-start*/window.tmp=' + variable + ';/*rollup-keeper-end*/';
            return code + keepStr;
        },
        transformBundle: function (code) {
            for (var file in opts) {
                var r = new RegExp(opts[file] + '\\$\\d+', 'g');
                code = code.replace(r, opts[file]);
            }
            var re = /\/\*rollup-keeper-start\*\/.*\/\*rollup-keeper-end\*\//g;
            return code.replace(re, '');
        }
    }
}

function bundle(paths) {
    rollup.rollup({
        entry: './main.js',
        plugins: [
            monkeyPatch(),
            rawjs({
                'jspdf.js': 'jsPDF',
                'filesaver.tmp.js': 'saveAs',
                'deflate.js': 'Deflater',
                'zlib.js': 'FlateStream',
                'css_colors.js': 'CssColors',
                'html2pdf.js': 'html2pdf'
            }),
            babel({
                presets: ['es2015-rollup'],
                exclude: ['node_modules/**', 'libs/**']
            })
        ]
    }).then(function (bundle) {
        var code = bundle.generate({format: 'umd', moduleName: 'jspdf'}).code;
        code = code.replace(/Permission\s+is\s+hereby\s+granted[\S\s]+?IN\s+THE\s+SOFTWARE\./, 'Licensed under the MIT License');
        code = code.replace(/Permission\s+is\s+hereby\s+granted[\S\s]+?IN\s+THE\s+SOFTWARE\./g, '');
        fs.writeFileSync(paths.debug, renew(code));

        var minified = uglify.minify(code, {fromString: true, output: {comments: /@preserve|@license|copyright/i}});
        fs.writeFileSync(paths.minified, renew(minified.code));
    }).catch(function (err) {
        console.error(err);
    });
}

function renew(code) {
    var date = new Date().toISOString();
    var version = require('./package.json').version;
    var whoami = execSync('whoami').toString().trim();
    var commit = execSync('git rev-parse --short=10 HEAD').toString().trim();

    code = code.replace('${versionID}', version + ' Built on ' + date);
    code = code.replace('${commitID}', commit);
    code = code.replace(/1\.0\.0-trunk/, version + ' ' + date + ':' + whoami);

    return code;
}