Skip to content

Commit f4fda6e

Browse files
authored
Merge 182dc3a into d93ec90
2 parents d93ec90 + 182dc3a commit f4fda6e

File tree

64 files changed

+6
-343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6
-343
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ resolver = "2"
123123
thiserror = "1.0.30"
124124
tokio = { version = "1", default-features = false }
125125
toml = "0.8.2"
126-
tracing = "0.1.41"
126+
tracing = {version = "0.1.41", features= ["max_level_trace","release_max_level_trace"]}
127127
tracing-chrome = "0.7.2"
128128
tracing-subscriber = "0.3.20"
129129
triomphe = "0.1.13"

bindings/binding_core_node/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ pub struct JsCompiler {
5858
impl JsCompiler {
5959
#[napi(constructor)]
6060
#[allow(clippy::new_without_default)]
61-
#[tracing::instrument(level = "info", skip_all)]
6261
pub fn new() -> Self {
6362
Self {
6463
_compiler: COMPILER.clone(),

crates/swc/src/lib.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,7 @@ impl Compiler {
394394
};
395395
match result {
396396
Ok(r) => r,
397-
Err(err) => {
398-
tracing::error!("failed to read input source map: {:?}", err);
399-
None
400-
}
397+
Err(_) => None,
401398
}
402399
};
403400

@@ -465,7 +462,6 @@ impl Compiler {
465462
}
466463
}
467464

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

645-
#[tracing::instrument(skip_all)]
646640
pub fn transform(
647641
&self,
648642
handler: &Handler,
@@ -670,7 +664,6 @@ impl Compiler {
670664
///
671665
/// This means, you can use `noop_visit_type`, `noop_fold_type` and
672666
/// `noop_visit_mut_type` in your visitor to reduce the binary size.
673-
#[tracing::instrument(skip_all)]
674667
pub fn process_js_with_custom_pass<P1, P2>(
675668
&self,
676669
fm: Arc<SourceFile>,
@@ -727,7 +720,6 @@ impl Compiler {
727720
})
728721
}
729722

730-
#[tracing::instrument(skip(self, handler, opts))]
731723
pub fn process_js_file(
732724
&self,
733725
fm: Arc<SourceFile>,
@@ -745,7 +737,6 @@ impl Compiler {
745737
)
746738
}
747739

748-
#[tracing::instrument(skip_all)]
749740
pub fn minify(
750741
&self,
751742
fm: Arc<SourceFile>,
@@ -938,7 +929,6 @@ impl Compiler {
938929
/// You can use custom pass with this method.
939930
///
940931
/// Pass building logic has been inlined into the configuration system.
941-
#[tracing::instrument(skip_all)]
942932
pub fn process_js(
943933
&self,
944934
handler: &Handler,
@@ -959,7 +949,6 @@ impl Compiler {
959949
)
960950
}
961951

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

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

crates/swc/src/plugin.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ impl RustPlugins {
9191
.with_context(|| format!("failed to invoke plugin on '{filename:?}'"))
9292
}
9393

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

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

242240
inner_cache.store_bytes_from_path(plugin_runtime, &path, plugin_name)?;
243-
tracing::debug!("Initialized WASM plugin {plugin_name}");
244241
}
245242
}
246243

crates/swc_bundler/src/bundler/chunk/cjs.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ where
5858
return Ok(module);
5959
}
6060

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

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

@@ -86,7 +85,6 @@ where
8685
self.injected_ctxt,
8786
);
8887

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

9189
Ok(wrapped)
9290
}
@@ -216,7 +214,6 @@ where
216214
self.replaced = true;
217215
*node = load;
218216

219-
tracing::trace!("Found, and replacing require");
220217
}
221218
}
222219
}

crates/swc_bundler/src/bundler/chunk/merge.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ where
9898
let all_deps_of_entry =
9999
self.collect_all_deps(&ctx.graph, entry_id, &mut Default::default());
100100

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

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

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

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

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

448-
tracing::debug!("Inlining injected variables");
449445

450446
inline(self.injected_ctxt, entry);
451447

@@ -495,7 +491,6 @@ where
495491
true
496492
});
497493

498-
tracing::debug!("Renaming keywords");
499494

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

@@ -511,10 +506,8 @@ where
511506

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

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

519512
module.retain_mut(|_, item| {
520513
if let ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport {
@@ -552,7 +545,6 @@ where
552545
true
553546
});
554547

555-
tracing::debug!("Removed wrong exports");
556548
}
557549

558550
/// This method handles imports and exports.
@@ -779,10 +771,6 @@ where
779771
}
780772

781773
// Create `export { local_default as default }`
782-
tracing::trace!(
783-
"Exporting `default` with `export default decl` ({})",
784-
local.sym
785-
);
786774

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

@@ -851,7 +839,6 @@ where
851839
exported: Some(ModuleExportName::Ident(exported)),
852840
is_type_only: false,
853841
});
854-
tracing::trace!("Exporting `default` with `export default expr`");
855842
extra.push(
856843
NamedExport {
857844
span: export.span,
@@ -904,11 +891,6 @@ where
904891
info.export_ctxt(),
905892
);
906893

907-
tracing::trace!(
908-
"Exporting `{}{:?}` with `export decl`",
909-
id.sym,
910-
id.ctxt
911-
);
912894

913895
new.push(
914896
id.clone()
@@ -952,10 +934,6 @@ where
952934
_ => panic!("unable to access unknown nodes"),
953935
};
954936

955-
tracing::trace!(
956-
"Exporting `default` with `export default decl` ({})",
957-
local.sym
958-
);
959937

960938
// Create `export { local_ident as exported_ident }`
961939
let exported =

crates/swc_bundler/src/bundler/chunk/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ where
3535
#[cfg(not(target_arch = "wasm32"))]
3636
let dur = Instant::now() - start;
3737
#[cfg(not(target_arch = "wasm32"))]
38-
tracing::debug!("Dependency analysis took {:?}", dur);
3938

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

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

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

10097
(id, entry)
10198
})
@@ -121,7 +118,6 @@ where
121118
let mut a = all.clone();
122119
self.merge_into_entry(&ctx, id, &mut entry, &mut a);
123120

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

126122
(id, entry)
127123
})

crates/swc_bundler/src/bundler/finalize.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ where
123123
let path = match &*self.scope.get_module(bundle.id).unwrap().fm.name {
124124
FileName::Real(ref v) => v.clone(),
125125
_ => {
126-
tracing::error!("Cannot rename: not a real file");
127126
return bundle;
128127
}
129128
};

crates/swc_bundler/src/bundler/load.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,9 @@ where
7474
file_name: &FileName,
7575
) -> Result<Option<TransformedModule>, Error> {
7676
self.run(|| {
77-
tracing::trace!("load_transformed: ({})", file_name);
7877

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

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

91-
tracing::debug!(
92-
"({:?}, {:?}, {:?}) Storing module: {}",
93-
v.id,
94-
v.local_ctxt(),
95-
v.export_ctxt(),
96-
file_name
97-
);
9889
self.scope.store_module(v.clone());
9990

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

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

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

288275
let mut merged = Imports::default();

crates/swc_bundler/src/bundler/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,8 @@ where
117117
) -> Self {
118118
GLOBALS.set(globals, || {
119119
let helper_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
120-
tracing::debug!("Helper ctxt: {:?}", helper_ctxt);
121120
let synthesized_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
122-
tracing::debug!("Synthesized ctxt: {:?}", synthesized_ctxt);
123121
let injected_ctxt = SyntaxContext::empty().apply_mark(Mark::fresh(Mark::root()));
124-
tracing::debug!("Injected ctxt: {:?}", injected_ctxt);
125122

126123
Bundler {
127124
config,

0 commit comments

Comments
 (0)