| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/gavin/workspace/readjs/node_modules/source-map-support/ |
Upload File : |
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var querystring = require('querystring');
var child_process = require('child_process');
var browserify = path.join('node_modules', '.bin', 'browserify');
var coffee = path.join('node_modules', '.bin', 'coffee');
function run(command, callback) {
console.log(command);
child_process.exec(command, callback);
}
// Use browserify to package up source-map-support.js
fs.writeFileSync('.temp.js', 'sourceMapSupport = require("./source-map-support");');
run(browserify + ' .temp.js', function(error, stdout) {
if (error) throw error;
// Wrap the code so it works both as a normal <script> module and as an AMD module
var header = [
'/*',
' * Support for source maps in V8 stack traces',
' * https://github.com/evanw/node-source-map-support',
' */',
].join('\n');
var code = [
'(this["define"] || function(name, callback) { this["sourceMapSupport"] = callback(); })("browser-source-map-support", function(sourceMapSupport) {',
stdout.replace(/\bbyte\b/g, 'bite').replace(new RegExp(__dirname + '/', 'g'), '').replace(/@license/g, 'license'),
'return sourceMapSupport});',
].join('\n');
// Use the online Google Closure Compiler service for minification
fs.writeFileSync('.temp.js', querystring.stringify({
compilation_level: 'SIMPLE_OPTIMIZATIONS',
output_info: 'compiled_code',
output_format: 'text',
js_code: code
}));
run('curl -d @.temp.js "http://closure-compiler.appspot.com/compile"', function(error, stdout) {
if (error) throw error;
var code = header + '\n' + stdout;
fs.unlinkSync('.temp.js');
fs.writeFileSync('browser-source-map-support.js', code);
fs.writeFileSync('amd-test/browser-source-map-support.js', code);
});
});
// Build the AMD test
run(coffee + ' --map --compile amd-test/script.coffee', function(error) {
if (error) throw error;
});
// Build the browserify test
run(coffee + ' --map --compile browserify-test/script.coffee', function(error) {
if (error) throw error;
run(browserify + ' --debug browserify-test/script.js > browserify-test/compiled.js', function(error) {
if (error) throw error;
})
});
// Build the browser test
run(coffee + ' --map --compile browser-test/script.coffee', function(error) {
if (error) throw error;
});
// Build the header test
run(coffee + ' --map --compile header-test/script.coffee', function(error) {
if (error) throw error;
var contents = fs.readFileSync('header-test/script.js', 'utf8');
fs.writeFileSync('header-test/script.js', contents.replace(/\/\/# sourceMappingURL=.*/g, ''))
});