Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Transport should include function wrapper to be compatible with minif…
Browse files Browse the repository at this point in the history
…iers.
  • Loading branch information
Charles Jolley committed Jul 28, 2011
1 parent a9011d8 commit c1d9f50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/spade.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function execFactory(id, factory, sandbox, spade) {

// The __evalFunc keeps IE 9 happy since it doesn't like
// unassigned anonymous functions
factoryData = sandbox.evaluate('__evalFunc = function(require, exports, __module, ARGV, ENV, __filename) {'+factoryData+'} //@ sourceURL='+filename+'\n', filename);
factoryData = sandbox.evaluate('__evalFunc = '+factoryData+'\n//@ sourceURL='+filename+'\n', filename);
sandbox._factories[id] = factoryData;
sandbox._loading[id] = false;
}
Expand Down
7 changes: 1 addition & 6 deletions transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ BPM_PLUGIN.compileTransport = function(code, context, filename) {
if (context.settings['spade:format'] === 'function') {
code = 'function(require, exports, __module, ARGV, ENV, __filename){\n'+code+'\n}';
} else {
code = context.minify("(function(require, exports, __module, ARGV, ENV, __filename){\n"+code+"\n//@ sourceURL="+id+"\n})()");

var lines = code.split("\n");
lines[0] = lines[0].replace(/^\(function\([^\)]+\)\{/, '');
lines[lines.length-1] = lines[lines.length-1].replace(/\}\)\(\)$/, '');
code = lines.join("\n");
code = context.minify("(function(require, exports, __module, ARGV, ENV, __filename){"+code+"\n});");
code = JSON.stringify(code);
}

Expand Down

0 comments on commit c1d9f50

Please sign in to comment.