mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7355 - Update jQuery-migrate to 3.4.1
This commit is contained in:
240
node_modules/jquery-migrate/Gruntfile.js
generated
vendored
240
node_modules/jquery-migrate/Gruntfile.js
generated
vendored
@@ -1,40 +1,100 @@
|
||||
/*global module:false*/
|
||||
"use strict";
|
||||
|
||||
/* global module:false */
|
||||
|
||||
module.exports = function( grunt ) {
|
||||
|
||||
"use strict";
|
||||
const gzip = require( "gzip-js" );
|
||||
|
||||
var isTravis = process.env.TRAVIS;
|
||||
const oldNode = /^v10\./.test( process.version );
|
||||
|
||||
const karmaQunitConfig = {
|
||||
showUI: true,
|
||||
testTimeout: 5000,
|
||||
|
||||
// We're running `QUnit.start()` ourselves in
|
||||
// test/data/qunit-start.js
|
||||
autostart: false
|
||||
};
|
||||
|
||||
const karmaFilesExceptJQueryAndMigrate = [
|
||||
|
||||
// In esmodules mode only object entries of this array with `type: "js"`
|
||||
// get the `type: "module"` tweak. npo is incompatible with being loaded as
|
||||
// a module so leverage this hack to prevent loading it in this way.
|
||||
"external/npo/npo.js",
|
||||
|
||||
{ pattern: "test/data/compareVersions.js", type: "js", nocache: true },
|
||||
|
||||
{ pattern: "test/data/testinit.js", type: "js", nocache: true },
|
||||
{ pattern: "test/data/test-utils.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/migrate.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/core.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/ajax.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/attributes.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/css.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/data.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/deferred.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/effects.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/event.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/manipulation.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/offset.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/serialize.js", type: "js", nocache: true },
|
||||
{ pattern: "test/unit/jquery/traversing.js", type: "js", nocache: true },
|
||||
|
||||
{ pattern: "test/data/qunit-start.js", type: "js", nocache: true },
|
||||
|
||||
{ pattern: "dist/jquery-migrate.js", included: false, served: true, nocache: true },
|
||||
{ pattern: "test/**/*.@(js|json|css|jpg|html|xml)", included: false, served: true }
|
||||
];
|
||||
|
||||
// Support: Node.js <12
|
||||
// Skip running tasks that dropped support for Node.js 10
|
||||
// in this Node version.
|
||||
function runIfNewNode( task ) {
|
||||
return oldNode ? "print_old_node_message:" + task : task;
|
||||
}
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig( {
|
||||
pkg: grunt.file.readJSON( "package.json" ),
|
||||
files: [
|
||||
"src/intro.js",
|
||||
"src/version.js",
|
||||
"src/compareVersions.js",
|
||||
"src/migrate.js",
|
||||
"src/core.js",
|
||||
"src/ajax.js",
|
||||
"src/attributes.js",
|
||||
"src/css.js",
|
||||
"src/data.js",
|
||||
"src/effects.js",
|
||||
"src/event.js",
|
||||
"src/offset.js",
|
||||
"src/serialize.js",
|
||||
"src/traversing.js",
|
||||
"src/deferred.js",
|
||||
"src/outro.js"
|
||||
],
|
||||
compare_size: {
|
||||
files: [ "dist/jquery-migrate.js", "dist/jquery-migrate.min.js" ],
|
||||
options: {
|
||||
compress: {
|
||||
gz: function( contents ) {
|
||||
return gzip.zip( contents, {} ).length;
|
||||
}
|
||||
},
|
||||
cache: "build/.sizecache.json"
|
||||
}
|
||||
},
|
||||
tests: {
|
||||
jquery: [
|
||||
"dev+git",
|
||||
"min+git.min",
|
||||
"dev+git.slim",
|
||||
"min+git.slim.min"
|
||||
],
|
||||
"jquery-3": [
|
||||
"dev+3.x-git",
|
||||
"min+3.x-git.min",
|
||||
"dev+3.x-git.slim",
|
||||
"min+3.x-git.slim.min",
|
||||
"dev+3.6.3",
|
||||
"dev+3.6.3.slim",
|
||||
"dev+3.5.1",
|
||||
"dev+3.5.1.slim",
|
||||
"dev+3.4.1",
|
||||
"dev+3.4.1.slim",
|
||||
"dev+3.3.1",
|
||||
"dev+3.3.1.slim",
|
||||
"dev+3.2.1",
|
||||
"dev+3.2.1.slim",
|
||||
"dev+3.1.1",
|
||||
"dev+3.0.0"
|
||||
"dev+3.1.1.slim",
|
||||
"dev+3.0.0",
|
||||
"dev+3.0.0.slim"
|
||||
]
|
||||
},
|
||||
banners: {
|
||||
@@ -51,6 +111,12 @@ module.exports = function( grunt ) {
|
||||
dest: "dist/<%= pkg.name %>.js"
|
||||
}
|
||||
},
|
||||
build: {
|
||||
all: {
|
||||
src: "src/migrate.js",
|
||||
dest: "dist/jquery-migrate.js"
|
||||
}
|
||||
},
|
||||
qunit: {
|
||||
files: [ "test/**/index.html" ]
|
||||
},
|
||||
@@ -73,6 +139,20 @@ module.exports = function( grunt ) {
|
||||
]
|
||||
}
|
||||
},
|
||||
npmcopy: {
|
||||
all: {
|
||||
options: {
|
||||
destPrefix: "external"
|
||||
},
|
||||
files: {
|
||||
"npo/npo.js": "native-promise-only/lib/npo.src.js",
|
||||
|
||||
"qunit/qunit.js": "qunit/qunit/qunit.js",
|
||||
"qunit/qunit.css": "qunit/qunit/qunit.css",
|
||||
"qunit/LICENSE.txt": "qunit/LICENSE.txt"
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
all: {
|
||||
files: {
|
||||
@@ -85,17 +165,17 @@ module.exports = function( grunt ) {
|
||||
sourceMapName: "dist/jquery-migrate.min.map",
|
||||
report: "min",
|
||||
output: {
|
||||
"ascii_only": true,
|
||||
ascii_only: true,
|
||||
|
||||
// Support: Android 4.0 only
|
||||
// UglifyJS 3 breaks Android 4.0 if this option is not enabled.
|
||||
// This is in lieu of setting ie8 for all of mangle, compress, and output
|
||||
"ie8": true
|
||||
ie8: true
|
||||
},
|
||||
banner: "/*! jQuery Migrate v<%= pkg.version %>" +
|
||||
" | (c) <%= pkg.author.name %> | jquery.org/license */",
|
||||
compress: {
|
||||
"hoist_funs": false,
|
||||
hoist_funs: false,
|
||||
loops: false,
|
||||
|
||||
// Support: IE <11
|
||||
@@ -116,33 +196,13 @@ module.exports = function( grunt ) {
|
||||
},
|
||||
frameworks: [ "qunit" ],
|
||||
files: [
|
||||
"https://code.jquery.com/jquery-3.x-git.min.js",
|
||||
"https://releases.jquery.com/git/jquery-3.x-git.min.js",
|
||||
"dist/jquery-migrate.min.js",
|
||||
"src/compareVersions.js",
|
||||
|
||||
"test/testinit.js",
|
||||
"test/migrate.js",
|
||||
"test/core.js",
|
||||
"test/ajax.js",
|
||||
"test/attributes.js",
|
||||
"test/css.js",
|
||||
"test/data.js",
|
||||
"test/deferred.js",
|
||||
"test/effects.js",
|
||||
"test/event.js",
|
||||
"test/offset.js",
|
||||
"test/serialize.js",
|
||||
"test/traversing.js",
|
||||
|
||||
{ pattern: "dist/jquery-migrate.js", included: false, served: true },
|
||||
{ pattern: "test/**/*.@(js|css|jpg|html|xml)", included: false, served: true }
|
||||
...karmaFilesExceptJQueryAndMigrate
|
||||
],
|
||||
client: {
|
||||
clearContext: false,
|
||||
qunit: {
|
||||
showUI: true,
|
||||
testTimeout: 5000
|
||||
}
|
||||
qunit: karmaQunitConfig
|
||||
},
|
||||
reporters: [ "dots" ],
|
||||
autoWatch: false,
|
||||
@@ -151,9 +211,58 @@ module.exports = function( grunt ) {
|
||||
singleRun: true
|
||||
},
|
||||
main: {
|
||||
browsers: [ "ChromeHeadless", "FirefoxHeadless" ]
|
||||
},
|
||||
|
||||
// The Chrome sandbox doesn't work on Travis.
|
||||
browsers: [ isTravis ? "ChromeHeadlessNoSandbox" : "ChromeHeadless" ]
|
||||
"jquery-slim": {
|
||||
browsers: [ "ChromeHeadless", "FirefoxHeadless" ],
|
||||
|
||||
options: {
|
||||
files: [
|
||||
"https://releases.jquery.com/git/jquery-3.x-git.slim.min.js",
|
||||
"dist/jquery-migrate.min.js",
|
||||
...karmaFilesExceptJQueryAndMigrate
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
esmodules: {
|
||||
browsers: [ "ChromeHeadless", "FirefoxHeadless" ],
|
||||
options: {
|
||||
files: [
|
||||
"https://releases.jquery.com/git/jquery-3.x-git.slim.min.js",
|
||||
{ pattern: "src/migrate.js", type: "module" },
|
||||
|
||||
// Silence console warnings to avoid flooding the console.
|
||||
{ pattern: "src/migratemute.js", type: "module" },
|
||||
|
||||
// Only object entries with `type: "js"` get
|
||||
// the `type: "module"` tweak.
|
||||
...karmaFilesExceptJQueryAndMigrate.map( file => {
|
||||
if ( file && typeof file === "object" && file.type === "js" ) {
|
||||
return {
|
||||
...file,
|
||||
type: "module"
|
||||
};
|
||||
} else {
|
||||
return file;
|
||||
}
|
||||
} ),
|
||||
|
||||
{
|
||||
pattern: "src/**",
|
||||
included: false,
|
||||
type: "module",
|
||||
served: true
|
||||
}
|
||||
],
|
||||
client: {
|
||||
qunit: {
|
||||
...karmaQunitConfig,
|
||||
plugin: "esmodules"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// To debug tests with Karma:
|
||||
@@ -183,8 +292,17 @@ module.exports = function( grunt ) {
|
||||
// Integrate jQuery migrate specific tasks
|
||||
grunt.loadTasks( "build/tasks" );
|
||||
|
||||
grunt.registerTask( "print_old_node_message", ( ...args ) => {
|
||||
var task = args.join( ":" );
|
||||
grunt.log.writeln( "Old Node.js detected, running the task \"" + task + "\" skipped..." );
|
||||
} );
|
||||
|
||||
// Just an alias
|
||||
grunt.registerTask( "test", [ "karma:main" ] );
|
||||
grunt.registerTask( "test", [
|
||||
"karma:main",
|
||||
"karma:jquery-slim",
|
||||
"karma:esmodules"
|
||||
] );
|
||||
|
||||
grunt.registerTask( "lint", [
|
||||
|
||||
@@ -192,13 +310,23 @@ module.exports = function( grunt ) {
|
||||
// would run the dist target first which would point to errors in the built
|
||||
// file, making it harder to fix them. We want to check the built file only
|
||||
// if we already know the source files pass the linter.
|
||||
"eslint:dev",
|
||||
"eslint:dist"
|
||||
runIfNewNode( "eslint:dev" ),
|
||||
runIfNewNode( "eslint:dist" )
|
||||
] );
|
||||
grunt.registerTask( "build", [ "concat", "uglify", "lint" ] );
|
||||
|
||||
grunt.registerTask( "default", [ "build", "test" ] );
|
||||
grunt.registerTask( "default-no-test", [
|
||||
"npmcopy",
|
||||
"build",
|
||||
"uglify",
|
||||
"lint",
|
||||
"compare_size"
|
||||
] );
|
||||
|
||||
grunt.registerTask( "default", [
|
||||
"default-no-test",
|
||||
"test"
|
||||
] );
|
||||
|
||||
// For CI
|
||||
grunt.registerTask( "ci", [ "build", "test" ] );
|
||||
grunt.registerTask( "ci", [ "default" ] );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user