Core: Migrate from AMD to ES modules 🎉

Migrate all source AMD modules to ECMAScript modules. The final bundle
is compiled by a custom build process that uses Rollup under the hood.

Test files themselves are still loaded via RequireJS as that has to work in
IE 11.

Tests can now be run in "Load as modules" mode which replaces the previous
"Load with AMD" option. That option of running tests doesn't work in IE
and Edge as it requires support for dynamic imports.

Some of the changes required by the migration:
* check `typeof` of `noGlobal` instead of using the variable directly
  as it's not available when modules are used
* change the nonce module to be an object as ECMASscript module exports
  are immutable
* remove some unused exports
* import `./core/parseHTML.js` directly in `jquery.js` so that it's not
  being cut out when the `ajax` module is excluded in a custom compilation

Closes gh-4541
This commit is contained in:
Michał Gołębiowski-Owczarek
2019-11-18 21:15:03 +01:00
committed by GitHub
parent a612733be0
commit d0ce00cdfa
124 changed files with 787 additions and 1310 deletions

View File

@@ -1,10 +1,7 @@
define( [
"../core",
"../queue",
"../effects" // Delay is optional because of this dependency
], function( jQuery ) {
import jQuery from "../core.js";
"use strict";
import "../queue.js";
import "../effects.js"; // Delay is optional because of this dependency
// Based off of the plugin by Clint Helfers, with permission.
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
@@ -19,6 +16,3 @@ jQuery.fn.delay = function( time, type ) {
};
} );
};
return jQuery.fn.delay;
} );