Fixes #14450. Remove CommonJS+AMD syntax.

- To keep file size unaffected, an extra pragma was added to build.js to remove certain lines when building with special comments.

Conflicts:
	src/core.js
	src/css.js
	src/effects.js
	src/event.js
	src/manipulation.js
	src/offset.js
This commit is contained in:
Timmy Willison
2013-10-15 10:40:48 -04:00
parent 03dd51494f
commit 62900a9edb
7 changed files with 101 additions and 105 deletions

View File

@@ -69,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*\)[\.\w]*([,;])/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