Skip to content

Commit 7033258

Browse files
authored
chore: add comment to other export info (#10417)
1 parent 1890d8f commit 7033258

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

crates/rspack_core/src/exports_info.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,16 @@ impl ExportsInfo {
776776
#[derive(Debug, Clone)]
777777
pub struct ExportsInfoData {
778778
exports: BTreeMap<Atom, ExportInfo>,
779+
780+
/// other export info is a strange name and hard to understand
781+
/// it has 2 meanings:
782+
/// 1. it is used as factory template, so that we can set one property in one exportsInfo,
783+
/// then export info created by it can extends those property
784+
/// 2. it is used to flag if the whole exportsInfo can be statically analyzed. In many commonjs
785+
/// case, we can not statically analyze the exportsInfo, its other_export_info.provided will
786+
/// be ExportInfoProvided::Null
779787
other_exports_info: ExportInfo,
788+
780789
side_effects_only_info: ExportInfo,
781790
redirect_to: Option<ExportsInfo>,
782791
id: ExportsInfo,
@@ -1502,9 +1511,13 @@ pub struct ExportInfoData {
15021511

15031512
#[derive(Debug, Hash, Clone, Copy)]
15041513
pub enum ExportInfoProvided {
1514+
/// The export can be statically analyzed, and it is provided
15051515
True,
1516+
1517+
/// The export can be statically analyzed, and the it is not provided
15061518
False,
1507-
/// `Null` has real semantic in webpack https://github.com/webpack/webpack/blob/853bfda35a0080605c09e1bdeb0103bcb9367a10/lib/ExportsInfo.js#L830
1519+
1520+
/// The export is unknown, we don't know if module really has this export, eg. cjs module
15081521
Null,
15091522
}
15101523

0 commit comments

Comments
 (0)