🌐 AI搜索 & 代理 主页
Skip to content

Commit 5701957

Browse files
authored
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
1 parent 62b9a25 commit 5701957

File tree

13 files changed

+12
-110
lines changed

13 files changed

+12
-110
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
amd
21
external
32
node_modules
43
*.min.js

.github/workflows/node.js.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ jobs:
3636
NODE_VERSION: "18.x"
3737
NPM_SCRIPT: "test:esmodules"
3838
BROWSERS: "ChromeHeadless"
39-
- NAME: "Browser tests: AMD build, Chrome"
40-
NODE_VERSION: "18.x"
41-
NPM_SCRIPT: "test:amd"
42-
BROWSERS: "ChromeHeadless"
4339
- NAME: "Browser tests: full build, Firefox ESR"
4440
NODE_VERSION: "18.x"
4541
NPM_SCRIPT: "test:browser"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ npm-debug.log*
1616
/dist/*
1717
!/dist/.eslintrc.json
1818

19-
/amd
2019
/external
2120
/node_modules
2221

Gruntfile.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,6 @@ module.exports = function( grunt ) {
225225
served: true,
226226
nocache: true
227227
},
228-
{
229-
pattern: "amd/**",
230-
included: false,
231-
served: true,
232-
nocache: true
233-
},
234228
{ pattern: "external/**", included: false, served: true },
235229
{
236230
pattern: "test/**/*.@(js|css|jpg|html|xml|svg)",
@@ -268,21 +262,6 @@ module.exports = function( grunt ) {
268262
}
269263
}
270264
},
271-
amd: {
272-
browsers: customBrowsers || [ "ChromeHeadless" ],
273-
options: {
274-
client: {
275-
qunit: {
276-
277-
// We're running `QUnit.start()` ourselves via `loadTests()`
278-
// in test/jquery.js
279-
autostart: false,
280-
281-
amd: true
282-
}
283-
}
284-
}
285-
},
286265

287266
jsdom: {
288267
options: {
@@ -431,7 +410,6 @@ module.exports = function( grunt ) {
431410
grunt.registerTask( "default", [
432411
runIfNewNode( "eslint:dev" ),
433412
"build:*:*",
434-
"amd",
435413
"terser",
436414
"remove_map_comment",
437415
"dist:*",

build/release.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ module.exports = function( Release ) {
3232
issueTracker: "github",
3333

3434
/**
35-
* Set the version in the src folder for distributing ES modules
36-
* and in the amd folder for AMD.
35+
* Set the version in the src folder for distributing ES modules.
3736
*/
3837
_setSrcVersion: function() {
3938
setSrcVersion( `${ __dirname }/../src/core.js` );
40-
setSrcVersion( `${ __dirname }/../amd/core.js` );
4139
},
4240

4341
/**

build/release/dist.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module.exports = function( Release, files, complete ) {
1313

1414
// These files are included with the distribution
1515
const extras = [
16-
"amd",
1716
"src",
1817
"LICENSE.txt",
1918
"AUTHORS.txt",

build/tasks/amd.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@
7676
"test:browserless": "grunt && grunt test:slow",
7777
"test:browser": "grunt && grunt karma:main",
7878
"test:esmodules": "grunt && grunt karma:esmodules",
79-
"test:amd": "grunt && grunt karma:amd",
8079
"test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
8180
"test:selector-native": "grunt test:prepare && grunt custom:-selector && grunt karma:main",
8281
"test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main",
83-
"test": "npm run test:slim && npm run test:no-deprecated && npm run test:selector-native && grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
82+
"test": "npm run test:slim && npm run test:no-deprecated && npm run test:selector-native && grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules",
8483
"jenkins": "npm run test:browserless"
8584
},
8685
"commitplease": {

test/data/testinit.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,10 @@ this.loadTests = function() {
366366

367367
// QUnit.config is populated from QUnit.urlParams but only at the beginning
368368
// of the test run. We need to read both.
369-
var esmodules = QUnit.config.esmodules || QUnit.urlParams.esmodules,
370-
amd = QUnit.config.amd || QUnit.urlParams.amd;
369+
var esmodules = QUnit.config.esmodules || QUnit.urlParams.esmodules;
371370

372371
// Directly load tests that need evaluation before DOMContentLoaded.
373-
if ( ( !esmodules && !amd ) || document.readyState === "loading" ) {
372+
if ( !esmodules || document.readyState === "loading" ) {
374373
document.write( "<script src='" + parentUrl + "test/unit/ready.js'><\x2Fscript>" );
375374
} else {
376375
QUnit.module( "ready", function() {

test/index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<!-- See testinit for the list of tests -->
2020
<script src="data/testinit.js"></script>
2121

22-
<!-- A script that includes jQuery min, dev, ES modules or AMD modules -->
22+
<!-- A script that includes jQuery min, dev or ES modules -->
2323
<!-- Adds "basic" URL option, even to iframes -->
24-
<!-- iframes will not load AMD as loading needs to be synchronous for some tests -->
24+
<!-- iframes will not load ESM as loading needs to be synchronous for some tests -->
2525
<!-- Also executes the function above to load tests -->
2626
<script src="jquery.js"></script>
2727

@@ -31,13 +31,12 @@
3131
// jQuery is on the page when the testrunner executes
3232
// QUnit.config is populated from QUnit.urlParams but only at the beginning
3333
// of the test run. We need to read both.
34-
var esmodules = QUnit.config.esmodules || QUnit.urlParams.esmodules,
35-
amd = QUnit.config.amd || QUnit.urlParams.amd;
34+
var esmodules = QUnit.config.esmodules || QUnit.urlParams.esmodules;
3635

3736
// Workaround: Remove call to `window.__karma__.loaded()`
3837
// in favor of calling `window.__karma__.start()` from `loadTests()`
3938
// because tests such as unit/ready.js should run after document ready.
40-
if ( !esmodules && !amd ) {
39+
if ( !esmodules ) {
4140
loadTests();
4241
}
4342
</script>

0 commit comments

Comments
 (0)