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

Commit f75daab

Browse files
authored
Core: Use named exports in src/
The `default` export is treated differently across tooling when transpiled to CommonJS - tools differ on whether `module.exports` represents the full module object or just its default export. Switch `src/` modules to named exports for tooling consistency. Fixes gh-5262 Closes gh-5292
1 parent 42e50f8 commit f75daab

File tree

136 files changed

+424
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+424
-478
lines changed

build/tasks/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ module.exports = function( grunt ) {
221221
// Remove the jQuery export from the entry file, we'll use our own
222222
// custom wrapper.
223223
setOverride( inputRollupOptions.input,
224-
read( inputFileName ).replace( /\n*export default jQuery;\n*/, "\n" ) );
224+
read( inputFileName ).replace( /\n*export \{ jQuery, jQuery as \$ };\n*/, "\n" ) );
225225

226226
// Replace exports/global with a noop noConflict
227227
if ( excluded.includes( "exports/global" ) ) {

src/ajax.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import jQuery from "./core.js";
2-
import document from "./var/document.js";
3-
import rnothtmlwhite from "./var/rnothtmlwhite.js";
4-
import location from "./ajax/var/location.js";
5-
import nonce from "./ajax/var/nonce.js";
6-
import rquery from "./ajax/var/rquery.js";
1+
import { jQuery } from "./core.js";
2+
import { document } from "./var/document.js";
3+
import { rnothtmlwhite } from "./var/rnothtmlwhite.js";
4+
import { location } from "./ajax/var/location.js";
5+
import { nonce } from "./ajax/var/nonce.js";
6+
import { rquery } from "./ajax/var/rquery.js";
77

88
import "./core/init.js";
99
import "./core/parseXML.js";
@@ -874,4 +874,4 @@ jQuery.ajaxPrefilter( function( s ) {
874874
}
875875
} );
876876

877-
export default jQuery;
877+
export { jQuery, jQuery as $ };

src/ajax/binary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import jQuery from "../core.js";
1+
import { jQuery } from "../core.js";
22

33
import "../ajax.js";
44

src/ajax/jsonp.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import jQuery from "../core.js";
2-
import nonce from "./var/nonce.js";
3-
import rquery from "./var/rquery.js";
1+
import { jQuery } from "../core.js";
2+
import { nonce } from "./var/nonce.js";
3+
import { rquery } from "./var/rquery.js";
44

55
import "../ajax.js";
66

src/ajax/load.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import jQuery from "../core.js";
2-
import stripAndCollapse from "../core/stripAndCollapse.js";
1+
import { jQuery } from "../core.js";
2+
import { stripAndCollapse } from "../core/stripAndCollapse.js";
33

44
import "../core/parseHTML.js";
55
import "../ajax.js";

src/ajax/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import jQuery from "../core.js";
2-
import document from "../var/document.js";
1+
import { jQuery } from "../core.js";
2+
import { document } from "../var/document.js";
33

44
import "../ajax.js";
55

src/ajax/var/location.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default window.location;
1+
export var location = window.location;

src/ajax/var/nonce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default { guid: Date.now() };
1+
export var nonce = { guid: Date.now() };

src/ajax/var/rquery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default ( /\?/ );
1+
export var rquery = /\?/;

src/ajax/xhr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import jQuery from "../core.js";
1+
import { jQuery } from "../core.js";
22

33
import "../ajax.js";
44

0 commit comments

Comments
 (0)