1 module
.exports = function( grunt
) {
4 function readOptionalJSON( filepath
) {
5 var stripJSONComments
= require( "strip-json-comments" ),
8 data
= JSON
.parse( stripJSONComments(
9 fs
.readFileSync( filepath
, { encoding
: "utf8" } )
15 var fs
= require( "fs" ),
16 gzip
= require( "gzip-js" );
18 if ( !grunt
.option( "filename" ) ) {
19 grunt
.option( "filename", "jquery.js" );
23 pkg
: grunt
.file
.readJSON( "package.json" ),
24 dst
: readOptionalJSON( "dist/.destination.json" ),
26 files
: [ "dist/jquery.js", "dist/jquery.min.js" ],
29 gz: function( contents
) {
30 return gzip
.zip( contents
, {} ).length
;
33 cache
: "build/.sizecache.json"
40 plugins
: [ "transform-es2015-for-of" ]
44 "test/node_smoke_tests/lib/ensure_iterability.js":
45 "test/node_smoke_tests/lib/ensure_iterability_es6.js"
51 dest
: "dist/jquery.js",
57 // Exclude specified modules if the module matching the key is removed
59 ajax
: [ "manipulation/_evalUrl", "event/ajax" ],
60 callbacks
: [ "deferred" ],
61 css
: [ "effects", "dimensions", "offset" ],
62 "css/showHide": [ "effects" ],
64 remove
: [ "ajax", "effects", "queue", "core/ready" ],
65 include
: [ "core/ready-no-deferred" ]
67 sizzle
: [ "css/hiddenVisibleSelectors", "effects/animatedSelector" ]
74 destPrefix
: "external"
77 "sizzle/dist": "sizzle/dist",
78 "sizzle/LICENSE.txt": "sizzle/LICENSE.txt",
80 "npo/npo.js": "native-promise-only/npo.js",
82 "qunit/qunit.js": "qunitjs/qunit/qunit.js",
83 "qunit/qunit.css": "qunitjs/qunit/qunit.css",
84 "qunit/LICENSE.txt": "qunitjs/LICENSE.txt",
86 "qunit-assert-step/qunit-assert-step.js":
87 "qunit-assert-step/qunit-assert-step.js",
88 "qunit-assert-step/MIT-LICENSE.txt":
89 "qunit-assert-step/MIT-LICENSE.txt",
91 "requirejs/require.js": "requirejs/require.js",
93 "sinon/sinon.js": "sinon/pkg/sinon.js",
94 "sinon/LICENSE.txt": "sinon/LICENSE"
100 src
: [ "package.json" ]
106 // See https://github.com/sindresorhus/grunt-eslint/issues/119
110 // We have to explicitly declare "src" property otherwise "newer"
111 // task wouldn't work properly :/
113 src
: "dist/jquery.js"
116 src
: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
122 // A special module with basic tests, meant for
123 // not fully supported environments like Android 2.3,
124 // jsdom or PhantomJS. We run it everywhere, though,
125 // to make sure tests are not broken.
152 customContextFile
: "test/karma.context.html",
153 customDebugFile
: "test/karma.debug.html",
154 frameworks
: [ "qunit" ],
155 middleware
: [ "mockserver" ],
159 "middleware:mockserver": [
161 require( "./test/middleware-mockserver.js" )
166 "test/data/jquery-1.9.1.js",
167 "external/qunit-assert-step/qunit-assert-step.js",
168 "external/sinon/sinon.js",
169 "external/npo/npo.js",
170 "external/requirejs/require.js",
171 "test/data/testinit.js",
173 "dist/jquery.min.js",
175 // Replacement for testinit.js#loadTests()
176 "test/data/testrunner.js",
177 "test/unit/basic.js",
179 "test/unit/callbacks.js",
180 "test/unit/deferred.js",
181 "test/unit/deprecated.js",
182 "test/unit/support.js",
184 "test/unit/queue.js",
185 "test/unit/attributes.js",
186 "test/unit/event.js",
187 "test/unit/selector.js",
188 "test/unit/traversing.js",
189 "test/unit/manipulation.js",
192 "test/unit/serialize.js",
194 "test/unit/effects.js",
195 "test/unit/offset.js",
196 "test/unit/dimensions.js",
197 "test/unit/animation.js",
198 "test/unit/tween.js",
199 "test/unit/ready.js",
201 { pattern
: "dist/jquery.js", included
: false, served
: true },
202 { pattern
: "dist/*.map", included
: false, served
: true },
203 { pattern
: "external/qunit/qunit.css", included
: false, served
: true },
205 pattern
: "test/**/*.@(js|css|jpg|html|xml)",
210 reporters
: [ "dots" ],
213 captureTimeout
: 20 * 1000,
215 // To debug tests with Karma:
216 // - Run 'grunt karma:chrome' or 'grunt karma:firefox'
217 // (any karma subtask that has singleRun=false)
218 // - Press "Debug" in the opened browser window.
222 browsers
: [ "ChromeHeadless" ],
226 browsers
: [ "Chrome" ]
229 browsers
: [ "Firefox" ]
233 files
: [ "<%= eslint.dev.src %>" ],
239 "dist/<%= grunt.option('filename').replace('.js', '.min.js') %>":
240 "dist/<%= grunt.option('filename') %>"
243 preserveComments
: false,
246 "dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
251 // Support: Android 4.0 only
252 // UglifyJS 3 breaks Android 4.0 if this option is not enabled.
253 // This is in lieu of setting ie8 for all of mangle, compress, and output
256 banner
: "/*! jQuery v<%= pkg.version %> | " +
257 "(c) JS Foundation and other contributors | jquery.org/license */",
264 // typeofs transformation is unsafe for IE9-10
265 // See https://github.com/mishoo/UglifyJS2/issues/2198
273 // Load grunt tasks from NPM packages
274 require( "load-grunt-tasks" )( grunt
);
276 // Integrate jQuery specific tasks
277 grunt
.loadTasks( "build/tasks" );
279 grunt
.registerTask( "lint", [
282 // Running the full eslint task without breaking it down to targets
283 // would run the dist target first which would point to errors in the built
284 // file, making it harder to fix them. We want to check the built file only
285 // if we already know the source files pass the linter.
290 grunt
.registerTask( "lint:newer", [
293 // Don't replace it with just the task; see the above comment.
298 grunt
.registerTask( "test:fast", "node_smoke_tests" );
299 grunt
.registerTask( "test:slow", "promises_aplus_tests" );
301 grunt
.registerTask( "test", [
306 grunt
.registerTask( "dev", [
310 "remove_map_comment",
316 grunt
.registerTask( "default", [
320 "remove_map_comment",