aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2013-10-15 12:03:55 -0400
committerTimmy Willison <timmywillisn@gmail.com>2013-10-15 12:03:55 -0400
commitb24a3d5368ab1243ac43c773b318519da2f0ae7b (patch)
tree41e9a6b72195166d9a63a9a638750e37620af0d8 /build
parent96286498d6aa1f65880d53c742f76c7f4fdcaa16 (diff)
downloadjquery-b24a3d5368ab1243ac43c773b318519da2f0ae7b.tar.gz
jquery-b24a3d5368ab1243ac43c773b318519da2f0ae7b.zip
Unify build script capabilities between branches. Specifically, added a special comment pragma for removing certain lines.
Diffstat (limited to 'build')
-rw-r--r--build/tasks/build.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js
index fb7b0cdac..4b37da81e 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -56,10 +56,12 @@ module.exports = function( grunt ) {
} else {
- // Ignore jQuery's return statement (the only necessary one)
+ // Ignore jQuery's exports (the only necessary one)
if ( name !== "jquery" ) {
contents = contents
- .replace( /\s*return\s+[^\}]+(\}\);[^\w\}]*)$/, "$1" );
+ .replace( /\s*return\s+[^\}]+(\}\);[^\w\}]*)$/, "$1" )
+ // Multiple exports
+ .replace( /\s*exports\.\w+\s*=\s*\w+;/g, "" );
}
// Remove define wrappers, closure ends, and empty declarations
@@ -67,13 +69,12 @@ module.exports = function( grunt ) {
.replace( /define\([^{]*?{/, "" )
.replace( rdefineEnd, "" );
- // Remove CommonJS-style require calls
- // Keep an ending semicolon
+ // Remove anything wrapped with
+ // /* ExcludeStart */ /* ExcludeEnd */
+ // or a single line directly after a // BuildExclude comment
contents = contents
- .replace( /(\s+\w+ = )?\s*require\(\s*(")[\w\.\/]+\2\s*\)([,;])/g,
- function( all, isVar, quote, commaSemicolon ) {
- return isVar && commaSemicolon === ";" ? ";" : "";
- });
+ .replace( /\/\*\s*ExcludeStart\s*\*\/[\w\W]*?\/\*\s*ExcludeEnd\s*\*\//ig, "" )
+ .replace( /\/\/\s*BuildExclude\n\r?[\w\W]*?\n\r?/ig, "" );
// Remove empty definitions
contents = contents