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: 2.1.0-beta1~37 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1b3c0c00fa4a9f128e0478e0d010b618517347f4;p=jquery.git Add AMD+CommonJS capabilities to the build script (for modules with long unreadable dependency lists) --- diff --git a/build/tasks/build.js b/build/tasks/build.js index 9f4f429ea..3992d284b 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 ef5df4f65..c95f6f386 100644 --- a/src/core.js +++ b/src/core.js @@ -1,21 +1,18 @@ -define([ - "./var/strundefined", - "./var/arr", - "./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, arr, slice, concat, push, indexOf, - class2type, toString, hasOwn, trim, rsingleTag, support ) { +define(function( require ) { var + arr = require( "./var/arr" ), + 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" ), + // A central reference to the root jQuery(document) rootjQuery, 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 {}; });