From 5701957b7223659c52a43f8c2c5465fdf2803df4 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski-Owczarek Date: Tue, 27 Jun 2023 18:23:58 +0200 Subject: Build: Drop individual AMD modules With this change, jQuery build no longer generates the `amd` directory with AMD modules transpiled from source `src` ECMAScript Modules. To use individual jQuery modules from source, ESM is now required. Note that this DOES NOT affect the main `"jquery"` AMD module defined by built jQuery files; those remain supported. Closes gh-5276 --- build/release.js | 4 +--- build/release/dist.js | 1 - build/tasks/amd.js | 44 -------------------------------------------- 3 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 build/tasks/amd.js (limited to 'build') diff --git a/build/release.js b/build/release.js index e7399c968..379f7de0a 100644 --- a/build/release.js +++ b/build/release.js @@ -32,12 +32,10 @@ module.exports = function( Release ) { issueTracker: "github", /** - * Set the version in the src folder for distributing ES modules - * and in the amd folder for AMD. + * Set the version in the src folder for distributing ES modules. */ _setSrcVersion: function() { setSrcVersion( `${ __dirname }/../src/core.js` ); - setSrcVersion( `${ __dirname }/../amd/core.js` ); }, /** diff --git a/build/release/dist.js b/build/release/dist.js index ea7c64b8a..eb8adc7e7 100644 --- a/build/release/dist.js +++ b/build/release/dist.js @@ -13,7 +13,6 @@ module.exports = function( Release, files, complete ) { // These files are included with the distribution const extras = [ - "amd", "src", "LICENSE.txt", "AUTHORS.txt", diff --git a/build/tasks/amd.js b/build/tasks/amd.js deleted file mode 100644 index c4c9c8941..000000000 --- a/build/tasks/amd.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Compiles sources from ES Modules in `src/` to AMD in `amd/`. - */ - -"use strict"; - -module.exports = function( grunt ) { - const path = require( "path" ); - const rimraf = require( "rimraf" ); - const rollup = require( "rollup" ); - const srcFolder = path.resolve( __dirname, "..", "..", "src" ); - const amdFolder = path.resolve( srcFolder, "..", "amd" ); - const inputFileName = "jquery.js"; - - const inputRollupOptions = { - input: path.resolve( srcFolder, inputFileName ), - preserveModules: true - }; - - const outputRollupOptions = { - format: "amd", - dir: "amd", - indent: false - }; - - grunt.registerTask( - "amd", - "Convert ES modules from `src/` to AMD modules in `amd/`", - async function() { - const done = this.async(); - - try { - grunt.verbose.writeln( "Removing the 'amd' directory..." ); - rimraf( amdFolder, async function() { - const bundle = await rollup.rollup( inputRollupOptions ); - await bundle.write( outputRollupOptions ); - grunt.log.ok( "Sources from 'src' converted to AMD in 'amd'." ); - done(); - } ); - } catch ( err ) { - done( err ); - } - } ); -}; -- cgit v1.2.3