Build: Followups after introducing ES modules compiled via Rollup

This commit cleans up a few comments & configurations that are out of date
after the migration to ES modules backed by a Rollup-based compilation.

Also, de-indent AMD modules. This will preserve a more similar
structure to the one on 3.x-stable where the body of the main `define`
wrapper is not indented.

Closes gh-4705
This commit is contained in:
Michał Gołębiowski-Owczarek 2020-05-05 14:30:14 +02:00 committed by GitHub
parent 297d18dd13
commit 55cd3a4436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 17 deletions

View File

@ -1,14 +1,5 @@
{ {
"root": true, "root": true,
"extends": "./.eslintrc-node.json", "extends": "./.eslintrc-node.json"
"overrides": [
{
"files": "rollup.config.js",
"parserOptions": {
"sourceType": "module"
}
}
]
} }

View File

@ -24,7 +24,7 @@ module.exports = function( grunt ) {
grunt.initConfig( { grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ), pkg: grunt.file.readJSON( "package.json" ),
dst: readOptionalJSON( "dist/.destination.json" ), dst: readOptionalJSON( "dist/.destination.json" ),
"compare_size": { compare_size: {
files: [ "dist/jquery.js", "dist/jquery.min.js" ], files: [ "dist/jquery.js", "dist/jquery.min.js" ],
options: { options: {
compress: { compress: {
@ -232,7 +232,7 @@ module.exports = function( grunt ) {
"test/data/jquery-1.9.1.js", "test/data/jquery-1.9.1.js",
"test/data/testinit-jsdom.js", "test/data/testinit-jsdom.js",
// We don't support various loading methods like AMD, // We don't support various loading methods like esmodules,
// choosing a version etc. for jsdom. // choosing a version etc. for jsdom.
"dist/jquery.js", "dist/jquery.js",

View File

@ -19,7 +19,8 @@ module.exports = function( grunt ) {
const outputRollupOptions = { const outputRollupOptions = {
format: "amd", format: "amd",
dir: "amd" dir: "amd",
indent: false
}; };
grunt.registerTask( grunt.registerTask(

View File

@ -54,7 +54,7 @@ module.exports = function( grunt ) {
grunt.registerMultiTask( grunt.registerMultiTask(
"build", "build",
"Concatenate source, remove sub AMD definitions, " + "Build jQuery ECMAScript modules, " +
"(include/exclude modules with +/- flags), embed date/version", "(include/exclude modules with +/- flags), embed date/version",
async function() { async function() {
const done = this.async(); const done = this.async();
@ -302,7 +302,7 @@ module.exports = function( grunt ) {
); );
grunt.file.write( name, compiledContents ); grunt.file.write( name, compiledContents );
grunt.log.ok( "File '" + name + "' created." ); grunt.log.ok( `File '${ name }' created.` );
done(); done();
} catch ( err ) { } catch ( err ) {
done( err ); done( err );

View File

@ -34,7 +34,7 @@
// Code Style. This makes that indentation check is not // Code Style. This makes that indentation check is not
// performed for 1 depth of outer FunctionExpressions // performed for 1 depth of outer FunctionExpressions
"ignoredNodes": [ "ignoredNodes": [
"Program > ExpressionStatement > CallExpression > FunctionExpression > *" "Program > ExpressionStatement > CallExpression > :last-child > *"
] ]
} ] } ]
}, },

View File

@ -576,7 +576,7 @@ jQuery.extend( {
} }
// We can fire global events as of now if asked to // We can fire global events as of now if asked to
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) // Don't fire events if jQuery.event is undefined in an ESM-usage scenario (trac-15118)
fireGlobals = jQuery.event && s.global; fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests // Watch for a new set of requests