From b693b370a459ef89ef187518b832a45b6e848eca Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Fri, 16 Aug 2013 12:54:43 -0400 Subject: [PATCH] When converting the source to AMD, don't forget to AMD --- build/tasks/build.js | 7 +++++-- src/exports/amd.js | 8 +++++++- src/jquery.js | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/build/tasks/build.js b/build/tasks/build.js index 3193cd630..8256603a3 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -57,10 +57,13 @@ module.exports = function( grunt ) { } // Remove define wrappers, closure ends, and empty declarations + // Unless it's the proper AMD define contents = contents .replace( /define\([^{]*?{/, "" ) - .replace( rdefineEnd, "" ) - // Remove empty definitions + .replace( rdefineEnd, "" ); + + // Remove empty definitions + contents = contents .replace( /define\(\[[^\]]+\]\)[\W\n]+$/, "" ); } return contents; diff --git a/src/exports/amd.js b/src/exports/amd.js index abd874e81..4499d2def 100644 --- a/src/exports/amd.js +++ b/src/exports/amd.js @@ -1,3 +1,7 @@ +define([ + "../core" +], function( jQuery ) { + // Register as a named AMD module, since jQuery can be concatenated with other // files that may use define, but not via a proper concatenation script that // understands anonymous AMD modules. A named AMD is safest and most robust @@ -9,4 +13,6 @@ if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; }); -} \ No newline at end of file +} + +}); \ No newline at end of file diff --git a/src/jquery.js b/src/jquery.js index 644f29255..2c63e3606 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -27,7 +27,8 @@ define([ "./effects/animated-selector", "./offset", "./dimensions", - "./deprecated" + "./deprecated", + "./exports/amd" ], function( jQuery ) { // Expose jQuery and $ identifiers, even in -- 2.39.5