Permalink
Browse files

Removed minify from rex. Bumped to next version.

  • Loading branch information...
1 parent c7f93d1 commit 3c8307355655347c3a03bfc3d3e49a170b067eb6 @kapetan kapetan committed Dec 19, 2012
Showing with 8 additions and 24 deletions.
  1. +0 −3 cli/index.js
  2. +2 −2 cli/package.json
  3. +4 −17 index.js
  4. +2 −2 package.json
View
@@ -5,7 +5,6 @@
var argv = require('optimist')
.alias('o', 'out')
.alias('b', 'base')
- .alias('m', 'minify')
.alias('h', 'help')
.alias('w', 'watch')
.alias('l', 'listen')
@@ -24,7 +23,6 @@ if (process.argv.length < 3 || argv.help) {
'if you create a rex.json file in your js dir rex will use its settings\n\n'+
'--source -s: a string to compile instead of a file\n'+
'--base -b: specify a base js file that rex can assume is loaded before any other file\n'+
- '--minify -m: minify the compiled code\n'+
'--out, -o: compile to a specific path or file suffix if input path is a dir\n'+
'--watch, -w: watch the file and recompile if it or its dependencies changes. requires -o\n'+
'--noeval, -n: do not use eval in the compiled code\n'+
@@ -38,7 +36,6 @@ try {
options = JSON.parse(fs.readFileSync('rex.json', 'utf-8'));
} catch (err) {}
-if (!('minify' in options)) options.minify = argv.minify;
if (!('base' in options)) options.base = typeof argv.base === 'string' && argv.base;
if (!('eval' in options)) options.eval = !argv.noeval;
View
@@ -2,13 +2,13 @@
"name":"rex-cli",
"description":"rex-cli is the cli equivivalent of rex",
"keywords": ["browser", "commonjs", "cli", "require"],
- "version":"0.2.6",
+ "version":"0.3.0",
"author": "Ge.tt <hello@ge.tt>",
"contributors": [
"Mathias Buus Madsen <m@ge.tt>"
],
"bin": {
"rex":"index.js"
},
- "dependencies": {"common":">=0.2.0", "uglify-js":">=1.2.6", "rex":"0.6.x", "optimist":"0.3.x", "cat":"*"}
+ "dependencies": {"common":">=0.2.0", "rex":"0.6.x", "optimist":"0.3.x", "cat":"*"}
}
View
@@ -2,21 +2,10 @@ var fs = require('fs');
var path = require('path');
var common = require('common');
var crypto = require('crypto');
-var ujs = require('uglify-js');
var zlib = require('zlib');
var trees = require('./trees');
-var minify = function(source) {
- try {
- source = ujs.uglify.gen_code(ujs.uglify.ast_squeeze(ujs.uglify.ast_mangle(ujs.parser.parse('(function(){\n'+source+'\n})'))));
- return source.substring(12, source.length-2).trim();
- } catch (err) {
- return source;
- }
-};
-
var REX_SOURCE = fs.readFileSync(__dirname+'/rex.js', 'utf-8');
-var REX_SOURCE_MIN = minify(REX_SOURCE).replace(/<\/script>/g, '<\\\/script>');
module.exports = function(options) {
options = options || {};
@@ -28,15 +17,13 @@ module.exports = function(options) {
return typeof url === 'string';
});
- var parse = trees(options);
- var boiler = options.minify ? REX_SOURCE_MIN : REX_SOURCE;
+ var parse = trees(options);
var wrap = function(mod) {
var requires = {};
- var src = (options.minify ? minify(mod.source) : mod.source)+'\n//@ sourceURL='+mod.name;
- var padding = options.minify ? '' : '\t';
+ var src = mod.source+'\n//@ sourceURL='+mod.name;
- src = options.eval !== false ? JSON.stringify(src) : 'function(module, exports, require) {\n'+padding+src.split('\n').join('\n'+padding)+'\n}';
+ src = options.eval !== false ? JSON.stringify(src) : 'function(module, exports, require) {\n\t'+src.split('\n').join('\n\t')+'\n}';
Object.keys(mod.dependencies).forEach(function(req) {
requires[req] = mod.dependencies[req].id;
@@ -59,7 +46,7 @@ module.exports = function(options) {
});
if (based) return result+'rex.run("'+tree.id+'");\n';
- return boiler+'\n'+result+'rex.run("'+tree.id+'",'+JSON.stringify(urls)+');\n';
+ return REX_SOURCE+'\n'+result+'rex.run("'+tree.id+'",'+JSON.stringify(urls)+');\n';
};
return function(url, callback) {
View
@@ -2,10 +2,10 @@
"name":"rex",
"description":"rex is browserside commonjs",
"keywords": ["browser", "commonjs", "require"],
- "version":"0.6.7",
+ "version":"0.7.0",
"author": "Ge.tt <hello@ge.tt>",
"contributors": [
"Mathias Buus Madsen <m@ge.tt>"
],
- "dependencies": {"common":">=0.2.0", "uglify-js":">=1.2.6", "find-module":"~0.1.1", "detective":"~0.2.1"}
+ "dependencies": {"common":">=0.2.0", "find-module":"~0.1.1", "detective":"~0.2.1"}
}

0 comments on commit 3c83073

Please sign in to comment.