mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Unify build script capabilities between branches. Specifically, added a special comment pragma for removing certain lines.
This commit is contained in:
parent
96286498d6
commit
b24a3d5368
@ -56,10 +56,12 @@ module.exports = function( grunt ) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Ignore jQuery's return statement (the only necessary one)
|
// Ignore jQuery's exports (the only necessary one)
|
||||||
if ( name !== "jquery" ) {
|
if ( name !== "jquery" ) {
|
||||||
contents = contents
|
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
|
// Remove define wrappers, closure ends, and empty declarations
|
||||||
@ -67,13 +69,12 @@ module.exports = function( grunt ) {
|
|||||||
.replace( /define\([^{]*?{/, "" )
|
.replace( /define\([^{]*?{/, "" )
|
||||||
.replace( rdefineEnd, "" );
|
.replace( rdefineEnd, "" );
|
||||||
|
|
||||||
// Remove CommonJS-style require calls
|
// Remove anything wrapped with
|
||||||
// Keep an ending semicolon
|
// /* ExcludeStart */ /* ExcludeEnd */
|
||||||
|
// or a single line directly after a // BuildExclude comment
|
||||||
contents = contents
|
contents = contents
|
||||||
.replace( /(\s+\w+ = )?\s*require\(\s*(")[\w\.\/]+\2\s*\)([,;])/g,
|
.replace( /\/\*\s*ExcludeStart\s*\*\/[\w\W]*?\/\*\s*ExcludeEnd\s*\*\//ig, "" )
|
||||||
function( all, isVar, quote, commaSemicolon ) {
|
.replace( /\/\/\s*BuildExclude\n\r?[\w\W]*?\n\r?/ig, "" );
|
||||||
return isVar && commaSemicolon === ";" ? ";" : "";
|
|
||||||
});
|
|
||||||
|
|
||||||
// Remove empty definitions
|
// Remove empty definitions
|
||||||
contents = contents
|
contents = contents
|
||||||
|
Loading…
Reference in New Issue
Block a user