From: Timmy Willison Date: Mon, 9 Sep 2013 13:50:12 +0000 (-0400) Subject: Add AMD+CommonJS capabilities to the build script (for modules with long unreadable... X-Git-Tag: 1.11.0-beta1~39 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee0343dd1bf3d8b39a6cd10deb5b3ca59178bb65;p=jquery.git Add AMD+CommonJS capabilities to the build script (for modules with long unreadable dependency lists) Conflicts: src/core.js --- diff --git a/build/tasks/build.js b/build/tasks/build.js index 79c7860e1..93c47c0ff 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -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]+$/, "" ); diff --git a/src/core.js b/src/core.js index 62fac0045..b1cca1942 100644 --- a/src/core.js +++ b/src/core.js @@ -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) diff --git a/src/var/class2type.js b/src/var/class2type.js index 52f2d38a6..e674c3ba6 100644 --- a/src/var/class2type.js +++ b/src/var/class2type.js @@ -1,3 +1,4 @@ define(function() { + // [[Class]] -> type pairs return {}; });