Skip to content

Commit 5322cc8

Browse files
authored
refactor: rename rspack default export var to rspack format (#12257)
1 parent 480f74a commit 5322cc8

File tree

127 files changed

+515
-516
lines changed

Some content is hidden

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

127 files changed

+515
-516
lines changed

crates/rspack_core/src/reserved_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub const RESERVED_NAMES: [&str; 188] = [
2-
"__WEBPACK_DEFAULT_EXPORT__",
2+
"__rspack_default_export",
33
"__WEBPACK_NAMESPACE_OBJECT__",
44
"abstract",
55
"arguments",

crates/rspack_core/src/utils/concatenation_scope.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ use crate::{
1414
concatenated_module::{ConcatenatedModuleInfo, ModuleInfo},
1515
};
1616

17-
pub static DEFAULT_EXPORT_ATOM: LazyLock<Atom> =
18-
LazyLock::new(|| "__WEBPACK_DEFAULT_EXPORT__".into());
17+
pub static DEFAULT_EXPORT_ATOM: LazyLock<Atom> = LazyLock::new(|| "__rspack_default_export".into());
1918
pub const NAMESPACE_OBJECT_EXPORT: &str = "__WEBPACK_NAMESPACE_OBJECT__";
20-
pub const DEFAULT_EXPORT: &str = "__WEBPACK_DEFAULT_EXPORT__";
19+
pub const DEFAULT_EXPORT: &str = "__rspack_default_export";
2120

2221
static MODULE_REFERENCE_REGEXP: LazyLock<Regex> = LazyLock::new(|| {
2322
Regex::new(

tests/rspack-test/builtinCases/plugin-javascript/builtins-define/__snapshots__/output.snap.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ __webpack_require__.r(__webpack_exports__);
198198
__webpack_require__.d(__webpack_exports__, {
199199
DO_NOT_CONVERTED7: () => (DO_NOT_CONVERTED7),
200200
DO_NOT_CONVERTED9: () => (DO_NOT_CONVERTED9),
201-
"default": () => (__WEBPACK_DEFAULT_EXPORT__)
201+
"default": () => (__rspack_default_export)
202202
});
203203
const DO_NOT_CONVERTED7 = 402;
204204
const DO_NOT_CONVERTED9 = 403;
205-
/* export default */ const __WEBPACK_DEFAULT_EXPORT__ = (401); // DO_NOT_CONVERTED8
205+
/* export default */ const __rspack_default_export = (401); // DO_NOT_CONVERTED8
206206

207207

208208

tests/rspack-test/builtinCases/plugin-javascript/provide/__snapshots__/output.snap.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ function a() {
2222
"use strict";
2323
__webpack_require__.r(__webpack_exports__);
2424
__webpack_require__.d(__webpack_exports__, {
25-
"default": () => (__WEBPACK_DEFAULT_EXPORT__)
25+
"default": () => (__rspack_default_export)
2626
});
2727
const lib = {
2828
get: () => {
2929
return "my-name";
3030
}
3131
};
3232

33-
/* export default */ const __WEBPACK_DEFAULT_EXPORT__ = (lib);
33+
/* export default */ const __rspack_default_export = (lib);
3434

3535

3636
}),

tests/rspack-test/configCases/parsing/default-export-const/supports-const.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ try {
44
d
55
} catch (e) {
66
it('should have TDZ error', () => {
7-
expect(e.message).toBe("Cannot access '__WEBPACK_DEFAULT_EXPORT__' before initialization");
7+
expect(e.message).toBe("Cannot access '__rspack_default_export' before initialization");
88
})
99
}
1010

tests/rspack-test/configCases/parsing/harmony-export-comment/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ it("should keep pure comment of unused export default", () => {
1111
});
1212

1313
it("should keep pure comment of used export default", () => {
14-
const methodName = "function __WEBPACK_DEFAULT_EXPORT__()";
14+
const methodName = "function __rspack_default_export()";
1515
expect(content).toContain(`${pureComment}${methodName}`)
1616
});

tests/rspack-test/diagnosticsCases/module-parse-failed/concatenate_parse_module/stats.err

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ ERROR in ./index.js + 1 modules
44
╭─[1:14]
55
1 │ console.log(1 2 3)
66
· ─
7-
2 │ /* export default */ const __WEBPACK_DEFAULT_EXPORT__ = (1);
7+
2 │ /* export default */ const __rspack_default_export = (1);
88
╰────

tests/rspack-test/hotCases/asset/parser-and-generator-states/__snapshots__/web/1.snap.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Asset Files
88
- Bundle: bundle.js
99
- Manifest: main.LAST_HASH.hot-update.json, size: 28
10-
- Update: main.LAST_HASH.hot-update.js, size: 2830
10+
- Update: main.LAST_HASH.hot-update.js, size: 2824
1111

1212
## Manifest
1313

@@ -41,12 +41,12 @@ self["webpackHotUpdate"]("main", {
4141
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4242
__webpack_require__.r(__webpack_exports__);
4343
__webpack_require__.d(__webpack_exports__, {
44-
"default": () => (__WEBPACK_DEFAULT_EXPORT__)
44+
"default": () => (__rspack_default_export)
4545
});
4646
/* import */var _logo_svg__rspack_import_0 = __webpack_require__(/*! ./logo.svg */ "./logo.svg");
4747

4848

49-
/* export default */ const __WEBPACK_DEFAULT_EXPORT__ = ((typeof _logo_svg__rspack_import_0) + ' result');
49+
/* export default */ const __rspack_default_export = ((typeof _logo_svg__rspack_import_0) + ' result');
5050

5151
}),
5252
"./logo.svg":

tests/rspack-test/hotCases/child-compiler/issue-9706/__snapshots__/web/1.snap.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Bundle: bundle.js
88
- Bundle: test.js
99
- Manifest: main.LAST_HASH.hot-update.json, size: 28
10-
- Update: main.LAST_HASH.hot-update.js, size: 736
10+
- Update: main.LAST_HASH.hot-update.js, size: 730
1111

1212
## Manifest
1313

@@ -41,10 +41,10 @@ self["webpackHotUpdate"]("main", {
4141
__webpack_require__.r(__webpack_exports__);
4242
__webpack_require__.d(__webpack_exports__, {
4343
assets: () => (assets),
44-
"default": () => (__WEBPACK_DEFAULT_EXPORT__)
44+
"default": () => (__rspack_default_export)
4545
});
4646
const assets = ["test.js"];
47-
/* export default */ const __WEBPACK_DEFAULT_EXPORT__ = (2);
47+
/* export default */ const __rspack_default_export = (2);
4848

4949

5050
}),

tests/rspack-test/hotCases/chunks/update-chunk-loading-runtime/__snapshots__/web/1.snap.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- Manifest: runtime~main.LAST_HASH.hot-update.json, size: 76
1313
- Update: main.LAST_HASH.hot-update.js, size: 686
1414
- Update: runtime~main.LAST_HASH.hot-update.js, size: 19042
15-
- Update: vendors-node_modules_vendor_js.LAST_HASH.hot-update.js, size: 509
15+
- Update: vendors-node_modules_vendor_js.LAST_HASH.hot-update.js, size: 503
1616

1717
## Manifest
1818

@@ -742,9 +742,9 @@ self["webpackHotUpdate"]("vendors-node_modules_vendor_js", {
742742
(function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
743743
__webpack_require__.r(__webpack_exports__);
744744
__webpack_require__.d(__webpack_exports__, {
745-
"default": () => (__WEBPACK_DEFAULT_EXPORT__)
745+
"default": () => (__rspack_default_export)
746746
});
747-
/* export default */ const __WEBPACK_DEFAULT_EXPORT__ = (2);
747+
/* export default */ const __rspack_default_export = (2);
748748

749749

750750
}),

0 commit comments

Comments
 (0)