]> source.dussan.org Git - jquery.git/commitdiff
Add AMD+CommonJS capabilities to the build script (for modules with long unreadable...
authorTimmy Willison <timmywillisn@gmail.com>
Mon, 9 Sep 2013 13:50:12 +0000 (09:50 -0400)
committerTimmy Willison <timmywillisn@gmail.com>
Mon, 9 Sep 2013 15:47:03 +0000 (11:47 -0400)
Conflicts:
src/core.js

build/tasks/build.js
src/core.js
src/var/class2type.js

index 79c7860e1c78ae4932cb39d9d9b159057436a4c7..93c47c0ff4a20ff5305e5aea207d1521885de42c 100644 (file)
@@ -62,6 +62,14 @@ module.exports = function( grunt ) {
                                .replace( /define\([^{]*?{/, "" )
                                .replace( rdefineEnd, "" );
 
+                       // Remove CommonJS-style require calls
+                       // Keep an ending semicolon
+                       contents = contents
+                               .replace( /\w+ = require\(\s*(")[\w\.\/]+\1\s*\)([,;])/g,
+                                       function( all, quote, commaSemicolon ) {
+                                               return commaSemicolon === ";" ? ";" : "";
+                                       });
+
                        // Remove empty definitions
                        contents = contents
                                .replace( /define\(\[[^\]]+\]\)[\W\n]+$/, "" );
index 62fac0045b35c79ae43798c78e36ede54a128bc7..b1cca19424389bcef83e44b9023fcd1ce562de80 100644 (file)
@@ -1,21 +1,18 @@
-define([
-       "./var/strundefined",
-       "./var/deletedIds",
-       "./var/slice",
-       "./var/concat",
-       "./var/push",
-       "./var/indexOf",
-       // [[Class]] -> type pairs
-       "./var/class2type",
-       "./var/toString",
-       "./var/hasOwn",
-       "./var/trim",
-       "./var/rsingleTag",
-       "./var/support"
-], function( strundefined, deletedIds, slice, concat, push, indexOf,
-       class2type, toString, hasOwn, trim, rsingleTag, support ) {
+define(function( require ) {
 
 var
+       deletedIds = require( "./var/deletedIds" ),
+       slice = require( "./var/slice" ),
+       concat = require( "./var/concat" ),
+       push = require( "./var/push" ),
+       indexOf = require( "./var/indexOf" ),
+       class2type = require( "./var/class2type" ),
+       toString = require( "./var/toString" ),
+       hasOwn = require( "./var/hasOwn" ),
+       trim = require( "./var/trim" ),
+       rsingleTag = require( "./var/rsingleTag" ),
+       support = require( "./var/support" ),
+
        i,
 
        // A central reference to the root jQuery(document)
index 52f2d38a6b1d9f0add437d39419c863c16454157..e674c3ba651c6ee6a6da0a4457cf705df5157440 100644 (file)
@@ -1,3 +1,4 @@
 define(function() {
+       // [[Class]] -> type pairs
        return {};
 });