Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 align get provided exports with webpack #9050

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions crates/rspack_core/src/exports_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,20 +526,20 @@ impl ExportsInfo {

pub fn get_provided_exports(&self, mg: &ModuleGraph) -> ProvidedExports {
let info = self.as_exports_info(mg);
if let Some(_redirect_to) = info.redirect_to {
match info.other_exports_info.provided(mg) {
Some(ExportInfoProvided::Null) => {
return ProvidedExports::True;
}
Some(ExportInfoProvided::True) => {
return ProvidedExports::True;
}
None => {
return ProvidedExports::Null;
}
_ => {}

match info.other_exports_info.provided(mg) {
Some(ExportInfoProvided::Null) => {
return ProvidedExports::True;
}
Some(ExportInfoProvided::True) => {
return ProvidedExports::True;
}
None => {
return ProvidedExports::Null;
}
_ => {}
}

let mut ret = vec![];
for export_info_id in info.exports.values() {
let export_info = export_info_id.as_export_info(mg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ modules by path ./ 235 bytes (javascript) 7 bytes (asset)
[no exports used]
ModuleConcatenation bailout: Module is an entry point
./stringModule.js 1 bytes [depth 1] [orphan] [built]
[no exports]
[module unused]
ModuleConcatenation bailout: Module is not an ECMAScript module
esm import ./stringModule [686] ./index.js 1:0-41
Expand Down Expand Up @@ -414,7 +413,6 @@ webpack/runtime/make_namespace_object 280 bytes [code generated]
exports[`new code splitting stats output new code splitting stats output/runtime-specific-exports should print correct stats for: NewCodeSplittingStatsOutput 1`] = `
asset main.js 1.8 KiB [emitted] (name: main)
./example.js 70 bytes [built] [code generated]
[no exports]
[no exports used]
./increment.js 251 bytes [built] [code generated]
[exports: decrement, increment, incrementBy2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Object {
orphan: false,
postOrderIndex: 0,
preOrderIndex: 0,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -216,7 +216,7 @@ Object {
orphan: false,
postOrderIndex: 0,
preOrderIndex: 0,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -1712,7 +1712,7 @@ Object {
orphan: false,
postOrderIndex: 1,
preOrderIndex: 3,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -1793,7 +1793,7 @@ Object {
orphan: false,
postOrderIndex: 0,
preOrderIndex: 1,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -1935,7 +1935,7 @@ exports.c = require("./c?c=3");,
orphan: false,
postOrderIndex: 2,
preOrderIndex: 2,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -2134,7 +2134,7 @@ exports.c = require("./c?c=3");,
orphan: false,
postOrderIndex: 0,
preOrderIndex: 1,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -2215,7 +2215,7 @@ exports.c = require("./c?c=3");,
orphan: false,
postOrderIndex: 2,
preOrderIndex: 2,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -2302,7 +2302,7 @@ exports.c = require("./c?c=3");,
orphan: false,
postOrderIndex: 1,
preOrderIndex: 3,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ modules by path ./ 235 bytes (javascript) 7 bytes (asset)
[no exports used]
ModuleConcatenation bailout: Module is an entry point
./stringModule.js 1 bytes [depth 1] [orphan] [built]
[no exports]
[module unused]
ModuleConcatenation bailout: Module is not an ECMAScript module
esm import ./stringModule [686] ./index.js 1:0-41
Expand Down Expand Up @@ -414,7 +413,6 @@ webpack/runtime/make_namespace_object 280 bytes [code generated]
exports[`statsOutput statsOutput/runtime-specific-exports should print correct stats for 1`] = `
asset main.js 1.8 KiB [emitted] (name: main)
./example.js 70 bytes [built] [code generated]
[no exports]
[no exports used]
./increment.js 251 bytes [built] [code generated]
[exports: decrement, increment, incrementBy2]
Expand Down
2 changes: 0 additions & 2 deletions packages/rspack-test-tools/tests/statsAPICases/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ module.exports = {
chunk {909} (runtime: main) main.js (main) 55 bytes [entry] [rendered]
> ./fixtures/a main
./fixtures/a.js [585] 55 bytes {909} [depth 0] [built] [code generated]
[no exports]
[used exports unknown]
Statement with side_effects in source code at ./fixtures/a.js<LINE_COL_RANGE>
ModuleConcatenation bailout: Module is not an ECMAScript module
entry ./fixtures/a
cjs self exports reference self [585] ./fixtures/a.js
./fixtures/a.js [585] 55 bytes {909} [depth 0] [built] [code generated]
[no exports]
[used exports unknown]
Statement with side_effects in source code at ./fixtures/a.js<LINE_COL_RANGE>
ModuleConcatenation bailout: Module is not an ECMAScript module
Expand Down
4 changes: 2 additions & 2 deletions packages/rspack-test-tools/tests/statsAPICases/chunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = {
orphan: false,
postOrderIndex: 1,
preOrderIndex: 1,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down Expand Up @@ -190,7 +190,7 @@ module.exports = {
orphan: false,
postOrderIndex: 0,
preOrderIndex: 0,
providedExports: Array [],
providedExports: null,
reasons: Array [
Object {
active: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,8 @@ exports[`StatsTestCases should print correct stats for concat-and-sideeffects 1`
exports[`StatsTestCases should print correct stats for custom-terser 1`] = `
"asset bundle.js 593 bytes [emitted] [minimized] (name: main)
./index.js 128 bytes [built] [code generated]
[no exports]
[no exports used]
./a.js 49 bytes [built] [code generated]
[no exports]
[used exports unknown]
Rspack x.x.x compiled successfully in X.23"
`;
Expand Down
Loading