Skip to content

Commit

Permalink
Merge branch 'main' into feat/exp-keep-options-swc
Browse files Browse the repository at this point in the history
  • Loading branch information
xinxinhe1810 authored Sep 8, 2023
2 parents ad2aa21 + bd64126 commit 37a54e3
Show file tree
Hide file tree
Showing 9 changed files with 534 additions and 162 deletions.
12 changes: 8 additions & 4 deletions crates/rspack_core/src/exports_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ impl From<u32> for ExportInfoId {
#[derive(Debug, Clone, Default)]
#[allow(unused)]
pub struct ExportInfo {
name: JsWord,
pub name: JsWord,
module_identifier: Option<ModuleIdentifier>,
pub usage_state: UsageState,
used_name: Option<String>,
Expand Down Expand Up @@ -1146,11 +1146,15 @@ pub fn process_export_info(
runtime: Option<&RuntimeSpec>,
referenced_export: &mut Vec<Vec<JsWord>>,
prefix: Vec<JsWord>,
export_info: Option<&ExportInfo>,
export_info: Option<ExportInfoId>,
default_points_to_self: bool,
already_visited: &mut HashSet<ExportInfoId>,
) {
if let Some(export_info) = export_info {
if let Some(export_info_id) = export_info {
let export_info = module_graph
.export_info_map
.get(&export_info_id)
.expect("should have export info");
let used = export_info.get_used(runtime);
if used == UsageState::Unused {
return;
Expand Down Expand Up @@ -1185,7 +1189,7 @@ pub fn process_export_info(
value.push(export_info.name.clone());
value
},
Some(export_info),
Some(export_info.id),
false,
already_visited,
);
Expand Down
8 changes: 6 additions & 2 deletions crates/rspack_core/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ use rspack_identifier::{Identifiable, Identifier};
use rspack_sources::Source;
use rspack_util::ext::{AsAny, DynEq, DynHash};
use rustc_hash::FxHashSet as HashSet;
use swc_core::ecma::atoms::JsWord;

use crate::tree_shaking::visitor::OptimizeAnalyzeResult;
use crate::{
BoxDependency, ChunkUkey, CodeGenerationResult, Compilation, CompilerContext, CompilerOptions,
ConnectionState, Context, ContextModule, DependencyTemplate, ExternalModule, ModuleDependency,
ModuleGraph, ModuleType, NormalModule, RawModule, Resolve, SharedPluginDriver, SourceType,
ConnectionState, Context, ContextModule, DependencyId, DependencyTemplate, ExternalModule,
ModuleDependency, ModuleGraph, ModuleType, NormalModule, RawModule, Resolve, SharedPluginDriver,
SourceType,
};

pub struct BuildContext<'a> {
Expand All @@ -42,6 +44,8 @@ pub struct BuildInfo {
pub missing_dependencies: HashSet<PathBuf>,
pub build_dependencies: HashSet<PathBuf>,
pub asset_filenames: HashSet<String>,
pub harmony_named_exports: HashSet<JsWord>,
pub all_star_exports: Vec<DependencyId>,
}

#[derive(Debug, Default, Clone, Hash)]
Expand Down
Loading

0 comments on commit 37a54e3

Please sign in to comment.