Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed minify from rex. Bumped to next version.

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

0 notes on commit 3c83073

Please sign in to comment.
Something went wrong with that request. Please try again.