Collapses UMD headers in bundled files.
This commit is contained in:
parent
0a21c8c365
commit
2f704f5957
11
make.js
11
make.js
@ -504,6 +504,9 @@ target.bundle = function(args) {
|
|||||||
// contains a license header, so the header of bundleContent can be removed.
|
// contains a license header, so the header of bundleContent can be removed.
|
||||||
bundleContent = stripCommentHeaders('\n' + bundleContent);
|
bundleContent = stripCommentHeaders('\n' + bundleContent);
|
||||||
|
|
||||||
|
// Removes AMD and CommonJS branches from UMD headers.
|
||||||
|
bundleContent = stripUMDHeaders(bundleContent);
|
||||||
|
|
||||||
// Append external files last since we don't want to modify them.
|
// Append external files last since we don't want to modify them.
|
||||||
bundleContent += cat(EXT_SRC_FILES);
|
bundleContent += cat(EXT_SRC_FILES);
|
||||||
|
|
||||||
@ -614,6 +617,14 @@ function stripCommentHeaders(content, filename) {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stripUMDHeaders(content) {
|
||||||
|
var reg = new RegExp(
|
||||||
|
'if \\(typeof define === \'function\' && define.amd\\) \\{[^}]*' +
|
||||||
|
'\\} else if \\(typeof exports !== \'undefined\'\\) \\{[^}]*' +
|
||||||
|
'\\} else ', 'g');
|
||||||
|
return content.replace(reg, '');
|
||||||
|
}
|
||||||
|
|
||||||
function cleanupJSSource(file) {
|
function cleanupJSSource(file) {
|
||||||
var content = cat(file);
|
var content = cat(file);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user