Skip to content

Commit

Permalink
Update edge for issue #41.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrburke committed Nov 21, 2011
1 parent d6553d5 commit 600e7f9
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions dist/r-edge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license r.js 1.0.1+ 20111116 2:10pm Pacific Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
* @license r.js 1.0.1+ 20111121 3pm Pacific Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
Expand All @@ -20,7 +20,7 @@ var requirejs, require, define;

var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
nodeDefine, exists, reqMain, loadedOptimizedLib,
version = '1.0.1+ 20111116 2:10pm Pacific',
version = '1.0.1+ 20111121 3pm Pacific',
jsSuffixRegExp = /\.js$/,
commandOption = '',
//Used by jslib/rhino/args.js
Expand Down Expand Up @@ -370,6 +370,10 @@ var requirejs, require, define;
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
name = pkgName;
}
} else if (name.indexOf("./") === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
name = name.substring(2);
}
}
return name;
Expand Down Expand Up @@ -7452,6 +7456,8 @@ function (lang, logger, envOptimize, file, parse,
}

optimize = {
licenseCommentRegExp: /\/\*[\s\S]*?\*\//g,

/**
* Optimizes a file that contains JavaScript content. Optionally collects
* plugin resources mentioned in a file, and then passes the content
Expand All @@ -7470,7 +7476,8 @@ function (lang, logger, envOptimize, file, parse,
var parts = (config.optimize + "").split('.'),
optimizerName = parts[0],
keepLines = parts[1] === 'keepLines',
fileContents, optFunc, deps, i, dep;
licenseContents = '',
fileContents, optFunc, match, comment;

fileContents = file.readFile(fileName);

Expand All @@ -7485,7 +7492,19 @@ function (lang, logger, envOptimize, file, parse,
optimizerName +
'" not found for this environment');
}
fileContents = optFunc(fileName, fileContents, keepLines,

//Pull out any license comments for prepending after optimization.
optimize.licenseCommentRegExp.lastIndex = 0;
while ((match = optimize.licenseCommentRegExp.exec(fileContents))) {
comment = match[0];
//Only keep the comments if they are license comments.
if (comment.indexOf('@license') !== -1 ||
comment.indexOf('/*!') === 0) {
licenseContents += comment + '\n';
}
}

fileContents = licenseContents + optFunc(fileName, fileContents, keepLines,
config[optimizerName]);
}

Expand Down

0 comments on commit 600e7f9

Please sign in to comment.