Repository: vercel/next.js
File: turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs (Rust)

Code before:
    /// Unexpanded `export * from ...` statements (expanded in `expand_star_exports`)
    pub star_exports: Vec<ResolvedVc<Box<dyn ModuleReference>>>,
}

/// The expanded version of [`EsmExports`], the `exports` field here includes all exports that could
/// be expanded from `star_exports`.
///
/// [`EsmExports::star_exports`] that could not be (fully) expanded end up in `dynamic_exports`.
#[turbo_tasks::value(shared)]
#[derive(Hash, Debug)]
pub struct ExpandedExports {
    pub exports: BTreeMap<RcStr, EsmExport>,
    /// Modules we couldn't analyze all exports of.
    pub dynamic_exports: Vec<ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>>,
}

#[turbo_tasks::value_impl]
impl EsmExports {
    /// Creates an EsmExports that re-exports all exports from another module.
    /// This is useful for wrapper modules that simply forward all exports.
    ///
    /// The resulting exports will have:
    /// - A default export binding to the module's default
    /// - A star export that re-exports all named exports
    #[turbo_tasks::function]
    pub async fn reexport(
        module_reference: Vc<Box<dyn ModuleReference>>,
    ) -> Result<Vc<EcmascriptExports>> {
        let module_reference = module_reference.to_resolved().await?;
        let mut exports = BTreeMap::new();
        let default = rcstr!("default");
        exports.insert(
            default.clone(),
            EsmExport::ImportedBinding(module_reference, default, false),
        );

        Ok(EcmascriptExports::EsmExports(
            EsmExports {
                exports,
                star_exports: vec![module_reference],
            }
            .resolved_cell(),
        )
        .cell())
    }

    #[turbo_tasks::function]
    pub async fn expand_exports(
        &self,
        export_usage_info: Vc<ModuleExportUsageInfo>,
    ) -> Result<Vc<ExpandedExports>> {

Review comment (suggestion):
```suggestion
    pub async fn reexport_including_default(
```

make it more clear

Code after:
#[derive(Hash, Debug)]
pub struct EsmExports {
    /// Explicit exports
    pub exports: BTreeMap<RcStr, EsmExport>,
    /// Unexpanded `export * from ...` statements (expanded in `expand_star_exports`)
    pub star_exports: Vec<ResolvedVc<Box<dyn ModuleReference>>>,
}

/// The expanded version of [`EsmExports`], the `exports` field here includes all exports that could
/// be expanded from `star_exports`.
///
/// [`EsmExports::star_exports`] that could not be (fully) expanded end up in `dynamic_exports`.
#[turbo_tasks::value(shared)]
#[derive(Hash, Debug)]
pub struct ExpandedExports {
    pub exports: BTreeMap<RcStr, EsmExport>,
    /// Modules we couldn't analyze all exports of.
    pub dynamic_exports: Vec<ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>>,
}

#[turbo_tasks::value_impl]
impl EsmExports {
    /// Creates an EsmExports that re-exports all exports from another module.
    /// This is useful for wrapper modules that simply forward all exports.
    ///
    /// The resulting exports will have:
    /// - A default export binding to the module's default
    /// - A star export that re-exports all named exports
    #[turbo_tasks::function]
    pub async fn reexport_including_default(
        module_reference: Vc<Box<dyn ModuleReference>>,
    ) -> Result<Vc<EcmascriptExports>> {
        let module_reference = module_reference.to_resolved().await?;
        let mut exports = BTreeMap::new();
        let default = rcstr!("default");
        exports.insert(
            default.clone(),
            EsmExport::ImportedBinding(module_reference, default, false),
        );

        Ok(EcmascriptExports::EsmExports(
            EsmExports {
                exports,
                star_exports: vec![module_reference],
            }
            .resolved_cell(),
        )
        .cell())
    }

    #[turbo_tasks::function]