Skip to content
Draft
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ resolver = "2"
thiserror = "1.0.30"
tokio = { version = "1", default-features = false }
toml = "0.8.2"
tracing = "0.1.41"
tracing = {version = "0.1.41", features= ["max_level_trace","release_max_level_trace"]}
tracing-chrome = "0.7.2"
tracing-subscriber = "0.3.20"
triomphe = "0.1.13"
Expand Down
1 change: 0 additions & 1 deletion bindings/binding_core_node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub struct JsCompiler {
impl JsCompiler {
#[napi(constructor)]
#[allow(clippy::new_without_default)]
#[tracing::instrument(level = "info", skip_all)]
pub fn new() -> Self {
Self {
_compiler: COMPILER.clone(),
Expand Down
14 changes: 1 addition & 13 deletions crates/swc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,7 @@ impl Compiler {
};
match result {
Ok(r) => r,
Err(err) => {
tracing::error!("failed to read input source map: {:?}", err);
None
}
Err(_) => None,
}
};

Expand Down Expand Up @@ -465,7 +462,6 @@ impl Compiler {
}
}

#[tracing::instrument(skip_all)]
pub fn read_config(&self, opts: &Options, name: &FileName) -> Result<Option<Config>, Error> {
static CUR_DIR: Lazy<PathBuf> = Lazy::new(|| {
if cfg!(target_arch = "wasm32") {
Expand Down Expand Up @@ -577,7 +573,6 @@ impl Compiler {
/// This method handles merging of config.
///
/// This method does **not** parse module.
#[tracing::instrument(skip_all)]
pub fn parse_js_as_input<'a, P>(
&'a self,
fm: Lrc<SourceFile>,
Expand Down Expand Up @@ -642,7 +637,6 @@ impl Compiler {
})
}

#[tracing::instrument(skip_all)]
pub fn transform(
&self,
handler: &Handler,
Expand Down Expand Up @@ -670,7 +664,6 @@ impl Compiler {
///
/// This means, you can use `noop_visit_type`, `noop_fold_type` and
/// `noop_visit_mut_type` in your visitor to reduce the binary size.
#[tracing::instrument(skip_all)]
pub fn process_js_with_custom_pass<P1, P2>(
&self,
fm: Arc<SourceFile>,
Expand Down Expand Up @@ -727,7 +720,6 @@ impl Compiler {
})
}

#[tracing::instrument(skip(self, handler, opts))]
pub fn process_js_file(
&self,
fm: Arc<SourceFile>,
Expand All @@ -745,7 +737,6 @@ impl Compiler {
)
}

#[tracing::instrument(skip_all)]
pub fn minify(
&self,
fm: Arc<SourceFile>,
Expand Down Expand Up @@ -938,7 +929,6 @@ impl Compiler {
/// You can use custom pass with this method.
///
/// Pass building logic has been inlined into the configuration system.
#[tracing::instrument(skip_all)]
pub fn process_js(
&self,
handler: &Handler,
Expand All @@ -959,7 +949,6 @@ impl Compiler {
)
}

#[tracing::instrument(name = "swc::Compiler::apply_transforms", skip_all)]
fn apply_transforms(
&self,
handler: &Handler,
Expand Down Expand Up @@ -1124,7 +1113,6 @@ fn find_swcrc(path: &Path, root: &Path, root_mode: RootMode) -> Option<PathBuf>
None
}

#[tracing::instrument(skip_all)]
fn load_swcrc(path: &Path) -> Result<Rc, Error> {
let content = read_to_string(path).context("failed to read config (.swcrc) file")?;

Expand Down
3 changes: 0 additions & 3 deletions crates/swc/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ impl RustPlugins {
.with_context(|| format!("failed to invoke plugin on '{filename:?}'"))
}

#[tracing::instrument(level = "info", skip_all, name = "apply_plugins")]
#[cfg(all(feature = "plugin", not(target_arch = "wasm32")))]
fn apply_inner(&mut self, n: Program) -> Result<Program, anyhow::Error> {
use anyhow::Context;
Expand Down Expand Up @@ -167,7 +166,6 @@ impl RustPlugins {
}

#[cfg(all(feature = "plugin", target_arch = "wasm32"))]
#[tracing::instrument(level = "info", skip_all)]
fn apply_inner(&mut self, n: Program) -> Result<Program, anyhow::Error> {
// [TODO]: unimplemented
n
Expand Down Expand Up @@ -240,7 +238,6 @@ pub(crate) fn compile_wasm_plugins(
};

inner_cache.store_bytes_from_path(plugin_runtime, &path, plugin_name)?;
tracing::debug!("Initialized WASM plugin {plugin_name}");
}
}

Expand Down
3 changes: 0 additions & 3 deletions crates/swc_bundler/src/bundler/chunk/cjs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ where
return Ok(module);
}

tracing::debug!("Merging as a common js module: {}", info.fm.name);

let load_var = self.make_cjs_load_var(info, DUMMY_SP);

Expand Down Expand Up @@ -86,7 +85,6 @@ where
self.injected_ctxt,
);

tracing::debug!("Injected a variable named `load` for a common js module");

Ok(wrapped)
}
Expand Down Expand Up @@ -216,7 +214,6 @@ where
self.replaced = true;
*node = load;

tracing::trace!("Found, and replacing require");
}
}
}
Expand Down
22 changes: 0 additions & 22 deletions crates/swc_bundler/src/bundler/chunk/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ where
let all_deps_of_entry =
self.collect_all_deps(&ctx.graph, entry_id, &mut Default::default());

tracing::debug!("Merging dependencies: {:?}", all_deps_of_entry);

let deps = all_deps_of_entry.iter().map(|id| {
let dep_info = self.scope.get_module(*id).unwrap();
Expand Down Expand Up @@ -438,14 +437,11 @@ where
}

fn finalize_merging_of_entry(&self, ctx: &Ctx, id: ModuleId, entry: &mut Modules) {
tracing::trace!("All modules are merged");

tracing::debug!("Injecting reexports");
self.inject_reexports(ctx, id, entry);

// entry.print(&self.cm, "before inline");

tracing::debug!("Inlining injected variables");

inline(self.injected_ctxt, entry);

Expand Down Expand Up @@ -495,7 +491,6 @@ where
true
});

tracing::debug!("Renaming keywords");

entry.visit_mut_with(&mut KeywordRenamer::default());

Expand All @@ -511,10 +506,8 @@ where

/// Remove exports with wrong syntax context
fn remove_wrong_exports(&self, ctx: &Ctx, info: &TransformedModule, module: &mut Modules) {
tracing::debug!("Removing wrong exports");

let item_count = module.iter().count();
tracing::trace!("Item count = {}", item_count);

module.retain_mut(|_, item| {
if let ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport {
Expand Down Expand Up @@ -552,7 +545,6 @@ where
true
});

tracing::debug!("Removed wrong exports");
}

/// This method handles imports and exports.
Expand Down Expand Up @@ -779,10 +771,6 @@ where
}

// Create `export { local_default as default }`
tracing::trace!(
"Exporting `default` with `export default decl` ({})",
local.sym
);

let exported = Ident::new(atom!("default"), DUMMY_SP, info.export_ctxt());

Expand Down Expand Up @@ -851,7 +839,6 @@ where
exported: Some(ModuleExportName::Ident(exported)),
is_type_only: false,
});
tracing::trace!("Exporting `default` with `export default expr`");
extra.push(
NamedExport {
span: export.span,
Expand Down Expand Up @@ -904,11 +891,6 @@ where
info.export_ctxt(),
);

tracing::trace!(
"Exporting `{}{:?}` with `export decl`",
id.sym,
id.ctxt
);

new.push(
id.clone()
Expand Down Expand Up @@ -952,10 +934,6 @@ where
_ => panic!("unable to access unknown nodes"),
};

tracing::trace!(
"Exporting `default` with `export default decl` ({})",
local.sym
);

// Create `export { local_ident as exported_ident }`
let exported =
Expand Down
4 changes: 0 additions & 4 deletions crates/swc_bundler/src/bundler/chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ where
#[cfg(not(target_arch = "wasm32"))]
let dur = Instant::now() - start;
#[cfg(not(target_arch = "wasm32"))]
tracing::debug!("Dependency analysis took {:?}", dur);

if cfg!(debug_assertions) {
for (i, id1) in plan.all.iter().enumerate() {
Expand Down Expand Up @@ -77,7 +76,6 @@ where
#[cfg(not(target_arch = "wasm32"))]
let dur = Instant::now() - start;
#[cfg(not(target_arch = "wasm32"))]
tracing::debug!("Module preparation took {:?}", dur);

let entries = all
.iter()
Expand All @@ -95,7 +93,6 @@ where
.map(|(id, mut entry)| {
self.merge_into_entry(&ctx, id, &mut entry, &mut all);

tracing::debug!("Merged `{}` and it's dep into an entry", id);

(id, entry)
})
Expand All @@ -121,7 +118,6 @@ where
let mut a = all.clone();
self.merge_into_entry(&ctx, id, &mut entry, &mut a);

tracing::debug!("Merged `{}` and it's dep into an entry", id);

(id, entry)
})
Expand Down
1 change: 0 additions & 1 deletion crates/swc_bundler/src/bundler/finalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ where
let path = match &*self.scope.get_module(bundle.id).unwrap().fm.name {
FileName::Real(ref v) => v.clone(),
_ => {
tracing::error!("Cannot rename: not a real file");
return bundle;
}
};
Expand Down
13 changes: 0 additions & 13 deletions crates/swc_bundler/src/bundler/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ where
file_name: &FileName,
) -> Result<Option<TransformedModule>, Error> {
self.run(|| {
tracing::trace!("load_transformed: ({})", file_name);

// In case of common module
if let Some(cached) = self.scope.get_module_by_path(file_name) {
tracing::debug!("Cached: {}", file_name);
return Ok(Some(cached));
}

Expand All @@ -88,20 +86,12 @@ where
.context("failed to analyze module")?;
files.dedup_by_key(|v| v.1.clone());

tracing::debug!(
"({:?}, {:?}, {:?}) Storing module: {}",
v.id,
v.local_ctxt(),
v.export_ctxt(),
file_name
);
self.scope.store_module(v.clone());

// Load dependencies and store them in the `Scope`
let results = files
.into_par_iter()
.map(|(_src, path)| {
tracing::trace!("loading dependency: {}", path);
self.load_transformed(&path)
})
.collect::<Vec<_>>();
Expand Down Expand Up @@ -135,7 +125,6 @@ where
mut data: ModuleData,
) -> Result<(TransformedModule, Vec<(Source, Lrc<FileName>)>), Error> {
self.run(|| {
tracing::trace!("transform_module({})", data.fm.name);
let (id, local_mark, export_mark) = self.scope.module_id_gen.gen(file_name);

data.module.visit_mut_with(&mut ClearMark);
Expand Down Expand Up @@ -225,7 +214,6 @@ where
raw: RawExports,
) -> Result<(Exports, Vec<(Source, Lrc<FileName>)>), Error> {
self.run(|| {
tracing::trace!("resolve_exports({})", base);
let mut files = Vec::new();

let mut exports = Exports::default();
Expand Down Expand Up @@ -282,7 +270,6 @@ where
info: RawImports,
) -> Result<(Imports, Vec<(Source, Lrc<FileName>)>), Error> {
self.run(|| {
tracing::trace!("resolve_imports({})", base);
let mut files = Vec::new();

let mut merged = Imports::default();
Expand Down
3 changes: 0 additions & 3 deletions crates/swc_bundler/src/bundler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,8 @@ where
) -> Self {
GLOBALS.set(globals, || {
let helper_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
tracing::debug!("Helper ctxt: {:?}", helper_ctxt);
let synthesized_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
tracing::debug!("Synthesized ctxt: {:?}", synthesized_ctxt);
let injected_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
tracing::debug!("Injected ctxt: {:?}", injected_ctxt);

Bundler {
config,
Expand Down
1 change: 0 additions & 1 deletion crates/swc_bundler/src/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub(crate) struct InlineData {

/// Inline **injected** variables.
pub(crate) fn inline(injected_ctxt: SyntaxContext, module: &mut Modules) {
tracing::debug!("Inlining injected variables");

let mut data = Default::default();

Expand Down
6 changes: 0 additions & 6 deletions crates/swc_bundler/src/modules/sort/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,13 @@ fn toposort_real_modules<'a>(

let mut chunks = Vec::new();

tracing::debug!(
"Topologically sorting modules based on the dependency graph: ({} items)",
modules.len()
);

#[cfg(not(target_arch = "wasm32"))]
let start = Instant::now();
let sorted_ids = toposort_real_module_ids(queue, graph, cycles).collect::<Vec<_>>();
#[cfg(not(target_arch = "wasm32"))]
let end = Instant::now();
#[cfg(not(target_arch = "wasm32"))]
tracing::debug!("Toposort of module ids took {:?}", end - start);
for ids in sorted_ids {
if ids.is_empty() {
continue;
Expand Down Expand Up @@ -226,7 +221,6 @@ fn toposort_real_module_ids<'a>(

continue;
}
tracing::info!("Using slow, fallback logic for topological sorting");
all_modules_in_circle.extend(deps_of_circle);
}

Expand Down
Loading
Loading