From 4061e06265c189855dfaf602699a0a4f2764376a Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 10 Jun 2024 15:28:21 +0200 Subject: [PATCH] Tree Shaking shared state and side effects (#8370) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Description adds more test cases ### Testing Instructions --------- Co-authored-by: 강동윤 (Donny) --- .../src/tree_shake/graph.rs | 39 +- .../src/tree_shake/util.rs | 237 +- .../tests/tree-shaker/analyzer/1/output.md | 2 +- .../tests/tree-shaker/analyzer/2/output.md | 2 +- .../tree-shaker/analyzer/app-route/output.md | 271 +- .../tree-shaker/analyzer/complex/output.md | 6 +- .../tree-shaker/analyzer/failed-1/output.md | 7 +- .../tree-shaker/analyzer/failed-2/output.md | 58 +- .../tree-shaker/analyzer/failed-3/output.md | 480 +++- .../analyzer/ipc-evaluate/output.md | 3 +- .../tree-shaker/analyzer/ipc-index/input.js | 172 ++ .../tree-shaker/analyzer/ipc-index/output.md | 2394 +++++++++++++++++ .../analyzer/node-globals/output.md | 1 - .../tree-shaker/analyzer/shared-2/input.js | 9 + .../tree-shaker/analyzer/shared-2/output.md | 528 ++++ .../analyzer/shared-and-side-effects/input.js | 11 + .../shared-and-side-effects/output.md | 647 +++++ .../analyzer/template-pages/output.md | 8 +- .../analyzer/test-config-1/output.md | 2 +- .../tree-shaker/analyzer/tla-1/output.md | 2 +- .../tree-shaker/analyzer/write-order/input.js | 11 + .../analyzer/write-order/output.md | 554 ++++ .../split-chunks-shared-state/input/a.js | 3 + .../split-chunks-shared-state/input/b.js | 3 + .../split-chunks-shared-state/input/index.js | 14 + .../split-chunks-shared-state/input/module.js | 9 + .../split-chunks-shared-state/input/order.js | 3 + .../split-chunks-shared-state/options.json | 3 + ...e-shake_export-namespace_input_b8c6d3._.js | 8 +- ...ake_export-namespace_input_b8c6d3._.js.map | 8 +- ...e-shake_import-namespace_input_66459d._.js | 5 +- ...ake_import-namespace_input_66459d._.js.map | 8 +- 32 files changed, 5115 insertions(+), 393 deletions(-) create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/input.js create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/input.js create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/output.md create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/input.js create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/input.js create mode 100644 crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/output.md create mode 100644 crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/a.js create mode 100644 crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/b.js create mode 100644 crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/index.js create mode 100644 crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/module.js create mode 100644 crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/order.js create mode 100644 crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/options.json diff --git a/crates/turbopack-ecmascript/src/tree_shake/graph.rs b/crates/turbopack-ecmascript/src/tree_shake/graph.rs index fa31ae5ceff7b..c8b5b50dd2f0a 100644 --- a/crates/turbopack-ecmascript/src/tree_shake/graph.rs +++ b/crates/turbopack-ecmascript/src/tree_shake/graph.rs @@ -698,10 +698,11 @@ impl DepGraph { { let used_ids = ids_used_by_ignoring_nested( &export.decl, - [unresolved_ctxt, top_level_ctxt], + unresolved_ctxt, + top_level_ctxt, ); let captured_ids = - ids_captured_by(&export.decl, [unresolved_ctxt, top_level_ctxt]); + ids_captured_by(&export.decl, unresolved_ctxt, top_level_ctxt); let data = ItemData { read_vars: used_ids.read, eventual_read_vars: captured_ids.read, @@ -736,10 +737,11 @@ impl DepGraph { let mut used_ids = ids_used_by_ignoring_nested( &export.expr, - [unresolved_ctxt, top_level_ctxt], + unresolved_ctxt, + top_level_ctxt, ); let captured_ids = - ids_captured_by(&export.expr, [unresolved_ctxt, top_level_ctxt]); + ids_captured_by(&export.expr, unresolved_ctxt, top_level_ctxt); used_ids.write.insert(default_var.to_id()); @@ -871,7 +873,7 @@ impl DepGraph { }; ids.push(id.clone()); - let vars = ids_used_by(&f.function, [unresolved_ctxt, top_level_ctxt]); + let vars = ids_used_by(&f.function, unresolved_ctxt, top_level_ctxt); let var_decls = { let mut v = IndexSet::with_capacity_and_hasher(1, Default::default()); v.insert(f.ident.to_id()); @@ -901,7 +903,7 @@ impl DepGraph { }; ids.push(id.clone()); - let vars = ids_used_by(&c.class, [unresolved_ctxt, top_level_ctxt]); + let vars = ids_used_by(&c.class, unresolved_ctxt, top_level_ctxt); let var_decls = { let mut v = IndexSet::with_capacity_and_hasher(1, Default::default()); v.insert(c.ident.to_id()); @@ -935,10 +937,13 @@ impl DepGraph { let decl_ids: Vec = find_pat_ids(&decl.name); let vars = ids_used_by_ignoring_nested( &decl.init, - [unresolved_ctxt, top_level_ctxt], + unresolved_ctxt, + top_level_ctxt, ); let eventual_vars = - ids_captured_by(&decl.init, [unresolved_ctxt, top_level_ctxt]); + ids_captured_by(&decl.init, unresolved_ctxt, top_level_ctxt); + + let side_effects = vars.found_unresolved; let var_decl = Box::new(VarDecl { decls: vec![decl.clone()], @@ -954,6 +959,7 @@ impl DepGraph { write_vars: decl_ids.into_iter().chain(vars.write).collect(), eventual_write_vars: eventual_vars.write, content, + side_effects, ..Default::default() }, ); @@ -965,25 +971,22 @@ impl DepGraph { .. })) => { let mut used_ids = - ids_used_by_ignoring_nested(item, [unresolved_ctxt, top_level_ctxt]); - let captured_ids = ids_captured_by(item, [unresolved_ctxt, top_level_ctxt]); + ids_used_by_ignoring_nested(item, unresolved_ctxt, top_level_ctxt); + let captured_ids = ids_captured_by(item, unresolved_ctxt, top_level_ctxt); if assign.op != op!("=") { used_ids.read.extend(used_ids.write.iter().cloned()); let extra_ids = ids_used_by_ignoring_nested( &assign.left, - [unresolved_ctxt, top_level_ctxt], + unresolved_ctxt, + top_level_ctxt, ); used_ids.read.extend(extra_ids.read); used_ids.write.extend(extra_ids.write); } - let side_effects = used_ids - .read - .iter() - .chain(used_ids.write.iter()) - .any(|id| id.1 == unresolved_ctxt); + let side_effects = used_ids.found_unresolved; let data = ItemData { read_vars: used_ids.read, @@ -1013,8 +1016,8 @@ impl DepGraph { // Default to normal let used_ids = - ids_used_by_ignoring_nested(item, [unresolved_ctxt, top_level_ctxt]); - let captured_ids = ids_captured_by(item, [unresolved_ctxt, top_level_ctxt]); + ids_used_by_ignoring_nested(item, unresolved_ctxt, top_level_ctxt); + let captured_ids = ids_captured_by(item, unresolved_ctxt, top_level_ctxt); let data = ItemData { read_vars: used_ids.read, eventual_read_vars: captured_ids.read, diff --git a/crates/turbopack-ecmascript/src/tree_shake/util.rs b/crates/turbopack-ecmascript/src/tree_shake/util.rs index 15d4e92f493a6..79224046c7dd7 100644 --- a/crates/turbopack-ecmascript/src/tree_shake/util.rs +++ b/crates/turbopack-ecmascript/src/tree_shake/util.rs @@ -7,9 +7,9 @@ use swc_core::{ ecma::{ ast::{ AssignTarget, BlockStmtOrExpr, Constructor, ExportNamedSpecifier, ExportSpecifier, - Expr, Function, Id, Ident, MemberProp, NamedExport, Pat, PropName, + Expr, Function, Id, Ident, MemberExpr, MemberProp, NamedExport, Pat, PropName, }, - visit::{noop_visit_type, visit_obj_and_computed, Visit, VisitWith}, + visit::{noop_visit_type, Visit, VisitWith}, }, }; @@ -20,138 +20,37 @@ enum Mode { Write, } +#[derive(Default)] +struct Target { + direct: bool, + eventual: bool, +} + /// A visitor which collects variables which are read or written. #[derive(Default)] pub(crate) struct IdentUsageCollector { - only: [SyntaxContext; 2], + unresolved: SyntaxContext, + top_level: SyntaxContext, vars: Vars, - ignore_nested: bool, - mode: Mode, -} -impl IdentUsageCollector { - fn with_mode(&mut self, mode: Mode, f: impl FnOnce(&mut Self)) { - let old = self.mode; - self.mode = mode; - f(self); - self.mode = old; - } + is_nested: bool, + target: Target, + /// None means both read and write + mode: Option, } -impl Visit for IdentUsageCollector { - fn visit_assign_target(&mut self, n: &AssignTarget) { - self.with_mode(Mode::Write, |this| { - n.visit_children_with(this); - }) - } - - fn visit_block_stmt_or_expr(&mut self, n: &BlockStmtOrExpr) { - if self.ignore_nested { - return; - } - - n.visit_children_with(self); - } - - fn visit_constructor(&mut self, n: &Constructor) { - if self.ignore_nested { - return; - } - - n.visit_children_with(self); - } - - fn visit_export_named_specifier(&mut self, n: &ExportNamedSpecifier) { - n.orig.visit_with(self); - } - - fn visit_export_specifier(&mut self, n: &ExportSpecifier) { - self.with_mode(Mode::Read, |this| { - n.visit_children_with(this); - }) - } - - fn visit_expr(&mut self, e: &Expr) { - self.with_mode(Mode::Read, |this| { - e.visit_children_with(this); - }) - } - - fn visit_function(&mut self, n: &Function) { - if self.ignore_nested { - return; - } - - n.visit_children_with(self); - } - - fn visit_ident(&mut self, n: &Ident) { - // We allow SyntaxContext::empty() because Some built-in files do not go into - // resolver() - if !self.only.contains(&n.span.ctxt) && n.span.ctxt != SyntaxContext::empty() { - return; - } - - match self.mode { - Mode::Read => { - self.vars.read.insert(n.to_id()); - } - Mode::Write => { - self.vars.write.insert(n.to_id()); - } - } - } - - fn visit_member_prop(&mut self, n: &MemberProp) { - if let MemberProp::Computed(..) = n { - n.visit_children_with(self); - } - } - - fn visit_named_export(&mut self, n: &NamedExport) { - if n.src.is_some() { +impl IdentUsageCollector { + fn with_nested(&mut self, f: impl FnOnce(&mut Self)) { + if !self.target.eventual { return; } - n.visit_children_with(self); - } - - fn visit_pat(&mut self, p: &Pat) { - self.with_mode(Mode::Write, |this| { - p.visit_children_with(this); - }) - } - - fn visit_prop_name(&mut self, n: &PropName) { - if let PropName::Computed(..) = n { - n.visit_children_with(self); - } - } - - noop_visit_type!(); - - visit_obj_and_computed!(); -} - -/// A visitor which collects variables which are read or written, but not at the -/// evaluation time. -#[derive(Default)] -pub(crate) struct CapturedIdCollector { - only: [SyntaxContext; 2], - vars: Vars, - is_nested: bool, - mode: Mode, -} - -impl CapturedIdCollector { - fn with_nested(&mut self, f: impl FnOnce(&mut Self)) { let old = self.is_nested; self.is_nested = true; f(self); self.is_nested = old; } - - fn with_mode(&mut self, mode: Mode, f: impl FnOnce(&mut Self)) { + fn with_mode(&mut self, mode: Option, f: impl FnOnce(&mut Self)) { let old = self.mode; self.mode = mode; f(self); @@ -159,9 +58,9 @@ impl CapturedIdCollector { } } -impl Visit for CapturedIdCollector { +impl Visit for IdentUsageCollector { fn visit_assign_target(&mut self, n: &AssignTarget) { - self.with_mode(Mode::Write, |this| { + self.with_mode(Some(Mode::Write), |this| { n.visit_children_with(this); }) } @@ -178,14 +77,18 @@ impl Visit for CapturedIdCollector { }) } + fn visit_export_named_specifier(&mut self, n: &ExportNamedSpecifier) { + n.orig.visit_with(self); + } + fn visit_export_specifier(&mut self, n: &ExportSpecifier) { - self.with_mode(Mode::Read, |this| { + self.with_mode(Some(Mode::Read), |this| { n.visit_children_with(this); }) } fn visit_expr(&mut self, e: &Expr) { - self.with_mode(Mode::Read, |this| { + self.with_mode(Some(Mode::Read), |this| { e.visit_children_with(this); }) } @@ -197,28 +100,64 @@ impl Visit for CapturedIdCollector { } fn visit_ident(&mut self, n: &Ident) { - if !self.is_nested { + if !self.target.direct && !self.is_nested { + return; + } + + if n.span.ctxt == self.unresolved { + self.vars.found_unresolved = true; return; } // We allow SyntaxContext::empty() because Some built-in files do not go into // resolver() - if !self.only.contains(&n.span.ctxt) && n.span.ctxt != SyntaxContext::empty() { + if n.span.ctxt != self.unresolved + && n.span.ctxt != self.top_level + && n.span.ctxt != SyntaxContext::empty() + { return; } match self.mode { - Mode::Read => { + Some(Mode::Read) => { self.vars.read.insert(n.to_id()); } - Mode::Write => { + Some(Mode::Write) => { + self.vars.write.insert(n.to_id()); + } + None => { + self.vars.read.insert(n.to_id()); self.vars.write.insert(n.to_id()); } } } + fn visit_member_expr(&mut self, e: &MemberExpr) { + self.with_mode(None, |this| { + // Skip visit_expr + e.obj.visit_children_with(this); + }); + + e.prop.visit_with(self); + } + + fn visit_member_prop(&mut self, n: &MemberProp) { + if let MemberProp::Computed(..) = n { + self.with_mode(Some(Mode::Read), |v| { + n.visit_children_with(v); + }) + } + } + fn visit_named_export(&mut self, n: &NamedExport) { + if n.src.is_some() { + return; + } + + n.visit_children_with(self); + } + fn visit_pat(&mut self, p: &Pat) { - self.with_mode(Mode::Write, |this| { + self.with_mode(Some(Mode::Write), |this| { p.visit_children_with(this); }) } @@ -230,8 +169,6 @@ impl Visit for CapturedIdCollector { } noop_visit_type!(); - - visit_obj_and_computed!(); } /// The list of variables which are read or written. @@ -241,19 +178,25 @@ pub(crate) struct Vars { pub read: IndexSet>, /// Variables which are written. pub write: IndexSet>, + + pub found_unresolved: bool, } /// Returns `(read, write)` /// /// Note: This functions accept `SyntaxContext` to filter out variables which /// are not interesting. We only need to analyze top-level variables. -pub(crate) fn ids_captured_by(n: &N, only: [SyntaxContext; 2]) -> Vars +pub(crate) fn ids_captured_by(n: &N, unresolved: SyntaxContext, top_level: SyntaxContext) -> Vars where - N: VisitWith, + N: VisitWith, { - let mut v = CapturedIdCollector { - only, - is_nested: false, + let mut v = IdentUsageCollector { + unresolved, + top_level, + target: Target { + direct: false, + eventual: true, + }, ..Default::default() }; n.visit_with(&mut v); @@ -264,13 +207,17 @@ where /// /// Note: This functions accept `SyntaxContext` to filter out variables which /// are not interesting. We only need to analyze top-level variables. -pub(crate) fn ids_used_by(n: &N, only: [SyntaxContext; 2]) -> Vars +pub(crate) fn ids_used_by(n: &N, unresolved: SyntaxContext, top_level: SyntaxContext) -> Vars where N: VisitWith, { let mut v = IdentUsageCollector { - only, - ignore_nested: false, + unresolved, + top_level, + target: Target { + direct: true, + eventual: true, + }, ..Default::default() }; n.visit_with(&mut v); @@ -281,13 +228,21 @@ where /// /// Note: This functions accept `SyntaxContext` to filter out variables which /// are not interesting. We only need to analyze top-level variables. -pub(crate) fn ids_used_by_ignoring_nested(n: &N, only: [SyntaxContext; 2]) -> Vars +pub(crate) fn ids_used_by_ignoring_nested( + n: &N, + unresolved: SyntaxContext, + top_level: SyntaxContext, +) -> Vars where N: VisitWith, { let mut v = IdentUsageCollector { - only, - ignore_nested: true, + unresolved, + top_level, + target: Target { + direct: true, + eventual: false, + }, ..Default::default() }; n.visit_with(&mut v); diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md index 0b92f964586ee..c1e305852567f 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md @@ -92,7 +92,7 @@ console.log(foobarCopy); ``` - Side effects -- Reads: `console`, `foobarCopy` +- Reads: `foobarCopy` ## Item 10: Stmt 8, `Normal` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md index ef2fc1ea5d109..f533342357a53 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md @@ -106,7 +106,7 @@ console.log(foobarCopy); ``` - Side effects -- Reads: `console`, `foobarCopy` +- Reads: `foobarCopy` ## Item 11: Stmt 9, `Normal` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md index e9ff4664bdaad..274c48e394ca7 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md @@ -100,9 +100,10 @@ const routeModule = new AppRouteRouteModule({ ``` +- Side effects - Declares: `routeModule` -- Reads: `AppRouteRouteModule`, `RouteKind`, `nextConfigOutput`, `userland` -- Write: `routeModule` +- Reads: `AppRouteRouteModule`, `RouteKind`, `userland` +- Write: `routeModule`, `RouteKind` ## Item 10: Stmt 5, `VarDeclarator(0)` @@ -216,6 +217,11 @@ graph TD Item9 --> Item5; Item9 --> Item6; Item9 --> Item8; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 --> Item4; + Item9 -.-> Item7; Item10 --> Item9; ``` # Phase 3 @@ -256,6 +262,11 @@ graph TD Item9 --> Item5; Item9 --> Item6; Item9 --> Item8; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 --> Item4; + Item9 -.-> Item7; Item10 --> Item9; Item12 --> Item7; Item12 --> Item10; @@ -298,6 +309,11 @@ graph TD Item9 --> Item5; Item9 --> Item6; Item9 --> Item8; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 --> Item4; + Item9 -.-> Item7; Item10 --> Item9; Item12 --> Item7; Item12 --> Item10; @@ -305,6 +321,7 @@ graph TD Item13 --> Item2; Item13 --> Item3; Item13 --> Item4; + Item13 --> Item9; Item14 --> Item9; Item15 --> Item10; Item16 --> Item10; @@ -315,21 +332,41 @@ graph TD # Final ```mermaid graph TD - N0["Items: [ItemId(ModuleEvaluation), ItemId(0, ImportOfModule), ItemId(1, ImportOfModule), ItemId(2, ImportOfModule), ItemId(3, ImportOfModule)]"]; + N0["Items: [ItemId(ModuleEvaluation)]"]; N1["Items: [ItemId(Export(("routeModule", #2), "routeModule"))]"]; N2["Items: [ItemId(Export(("requestAsyncStorage", #2), "requestAsyncStorage"))]"]; N3["Items: [ItemId(Export(("staticGenerationAsyncStorage", #2), "staticGenerationAsyncStorage"))]"]; N4["Items: [ItemId(Export(("serverHooks", #2), "serverHooks"))]"]; N5["Items: [ItemId(Export(("originalPathname", #2), "originalPathname")), ItemId(6, VarDeclarator(0))]"]; N6["Items: [ItemId(Export(("patchFetch", #2), "patchFetch")), ItemId(2, ImportBinding(0)), ItemId(7, Normal)]"]; - N7["Items: [ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(3, ImportBinding(0)), ItemId(4, VarDeclarator(0))]"]; - N8["Items: [ItemId(5, VarDeclarator(0))]"]; - N1 --> N7; - N2 --> N8; - N3 --> N8; - N4 --> N8; - N6 --> N8; + N7["Items: [ItemId(0, ImportOfModule)]"]; + N8["Items: [ItemId(1, ImportOfModule)]"]; + N9["Items: [ItemId(2, ImportOfModule)]"]; + N10["Items: [ItemId(3, ImportOfModule)]"]; + N11["Items: [ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(3, ImportBinding(0)), ItemId(4, VarDeclarator(0))]"]; + N12["Items: [ItemId(5, VarDeclarator(0))]"]; + N0 --> N7; + N0 --> N8; + N0 --> N9; + N0 --> N10; + N0 --> N11; + N1 --> N11; + N2 --> N12; + N3 --> N12; + N4 --> N12; + N6 --> N11; + N6 --> N12; N8 --> N7; + N9 --> N7; + N9 --> N8; + N10 --> N7; + N10 --> N8; + N10 --> N9; + N11 --> N7; + N11 --> N8; + N11 --> N9; + N11 --> N10; + N12 --> N11; ``` # Entrypoints @@ -361,17 +398,28 @@ graph TD # Modules (dev) ## Part 0 ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; "module evaluation"; -import '../../server/future/route-modules/app-route/module.compiled'; -import '../../server/future/route-kind'; -import '../../server/lib/patch-fetch'; -import 'VAR_USERLAND'; ``` ## Part 1 ```js import { routeModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 7 + __turbopack_part__: 11 }; export { routeModule as routeModule }; @@ -379,7 +427,7 @@ export { routeModule as routeModule }; ## Part 2 ```js import { requestAsyncStorage } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { requestAsyncStorage as requestAsyncStorage }; @@ -387,7 +435,7 @@ export { requestAsyncStorage as requestAsyncStorage }; ## Part 3 ```js import { staticGenerationAsyncStorage } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { staticGenerationAsyncStorage as staticGenerationAsyncStorage }; @@ -395,7 +443,7 @@ export { staticGenerationAsyncStorage as staticGenerationAsyncStorage }; ## Part 4 ```js import { serverHooks } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { serverHooks as serverHooks }; @@ -411,8 +459,11 @@ export { originalPathname } from "__TURBOPACK_VAR__" assert { ``` ## Part 6 ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; import { staticGenerationAsyncStorage, serverHooks } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { patchFetch as patchFetch }; import { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'; @@ -429,8 +480,59 @@ export { patchFetch } from "__TURBOPACK_VAR__" assert { ``` ## Part 7 ```js +import '../../server/future/route-modules/app-route/module.compiled'; + +``` +## Part 8 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import '../../server/future/route-kind'; + +``` +## Part 9 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import '../../server/lib/patch-fetch'; + +``` +## Part 10 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import 'VAR_USERLAND'; + +``` +## Part 11 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; import { AppRouteRouteModule } from '../../server/future/route-modules/app-route/module.compiled'; import { RouteKind } from '../../server/future/route-kind'; +import { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'; import * as userland from 'VAR_USERLAND'; const routeModule = new AppRouteRouteModule({ definition: { @@ -447,12 +549,15 @@ const routeModule = new AppRouteRouteModule({ export { routeModule } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; +export { RouteKind } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; ``` -## Part 8 +## Part 12 ```js import { routeModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 7 + __turbopack_part__: 11 }; const { requestAsyncStorage, staticGenerationAsyncStorage, serverHooks } = routeModule; export { requestAsyncStorage } from "__TURBOPACK_VAR__" assert { @@ -468,10 +573,21 @@ export { serverHooks } from "__TURBOPACK_VAR__" assert { ``` ## Merged (module eval) ```js -import '../../server/future/route-modules/app-route/module.compiled'; -import '../../server/future/route-kind'; -import '../../server/lib/patch-fetch'; -import 'VAR_USERLAND'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; "module evaluation"; ``` @@ -505,17 +621,28 @@ import 'VAR_USERLAND'; # Modules (prod) ## Part 0 ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; "module evaluation"; -import '../../server/future/route-modules/app-route/module.compiled'; -import '../../server/future/route-kind'; -import '../../server/lib/patch-fetch'; -import 'VAR_USERLAND'; ``` ## Part 1 ```js import { routeModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 7 + __turbopack_part__: 11 }; export { routeModule as routeModule }; @@ -523,7 +650,7 @@ export { routeModule as routeModule }; ## Part 2 ```js import { requestAsyncStorage } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { requestAsyncStorage as requestAsyncStorage }; @@ -531,7 +658,7 @@ export { requestAsyncStorage as requestAsyncStorage }; ## Part 3 ```js import { staticGenerationAsyncStorage } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { staticGenerationAsyncStorage as staticGenerationAsyncStorage }; @@ -539,7 +666,7 @@ export { staticGenerationAsyncStorage as staticGenerationAsyncStorage }; ## Part 4 ```js import { serverHooks } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { serverHooks as serverHooks }; @@ -556,7 +683,7 @@ export { originalPathname } from "__TURBOPACK_VAR__" assert { ## Part 6 ```js import { staticGenerationAsyncStorage, serverHooks } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 8 + __turbopack_part__: 12 }; export { patchFetch as patchFetch }; import { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'; @@ -573,6 +700,56 @@ export { patchFetch } from "__TURBOPACK_VAR__" assert { ``` ## Part 7 ```js +import '../../server/future/route-modules/app-route/module.compiled'; + +``` +## Part 8 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import '../../server/future/route-kind'; + +``` +## Part 9 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import '../../server/lib/patch-fetch'; + +``` +## Part 10 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import 'VAR_USERLAND'; + +``` +## Part 11 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; import { AppRouteRouteModule } from '../../server/future/route-modules/app-route/module.compiled'; import { RouteKind } from '../../server/future/route-kind'; import * as userland from 'VAR_USERLAND'; @@ -591,12 +768,15 @@ const routeModule = new AppRouteRouteModule({ export { routeModule } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; +export { RouteKind } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; ``` -## Part 8 +## Part 12 ```js import { routeModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 7 + __turbopack_part__: 11 }; const { requestAsyncStorage, staticGenerationAsyncStorage, serverHooks } = routeModule; export { requestAsyncStorage } from "__TURBOPACK_VAR__" assert { @@ -612,10 +792,21 @@ export { serverHooks } from "__TURBOPACK_VAR__" assert { ``` ## Merged (module eval) ```js -import '../../server/future/route-modules/app-route/module.compiled'; -import '../../server/future/route-kind'; -import '../../server/lib/patch-fetch'; -import 'VAR_USERLAND'; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 10 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 11 +}; "module evaluation"; ``` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/complex/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/complex/output.md index 80e4cdf3c3c32..24ef3cab8c6be 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/complex/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/complex/output.md @@ -30,7 +30,7 @@ console.log(dog); ``` - Side effects -- Reads: `console`, `dog` +- Reads: `dog` ## Item 4: Stmt 3, `Normal` @@ -64,7 +64,7 @@ console.log(dog); ``` - Side effects -- Reads: `console`, `dog` +- Reads: `dog` ## Item 7: Stmt 6, `Normal` @@ -98,7 +98,7 @@ console.log(dog); ``` - Side effects -- Reads: `console`, `dog` +- Reads: `dog` ## Item 10: Stmt 9, `VarDeclarator(0)` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-1/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-1/output.md index f6fe3c1915364..a3258db90ac52 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-1/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-1/output.md @@ -37,7 +37,6 @@ function getSocketProtocol(assetPrefix) { - Hoisted - Declares: `getSocketProtocol` -- Reads (eventual): `location`, `URL` - Write: `getSocketProtocol` ## Item 4: Stmt 3, `Normal` @@ -53,6 +52,7 @@ export function addMessageListener(cb) { - Declares: `addMessageListener` - Reads (eventual): `eventCallbacks` - Write: `addMessageListener` +- Write (eventual): `eventCallbacks` ## Item 5: Stmt 4, `Normal` @@ -68,6 +68,7 @@ export function sendMessage(data) { - Declares: `sendMessage` - Reads (eventual): `source` - Write: `sendMessage` +- Write (eventual): `source` ## Item 6: Stmt 5, `Normal` @@ -118,9 +119,9 @@ export function connectHMR(options) { - Hoisted - Declares: `connectHMR` -- Reads (eventual): `source`, `console`, `eventCallbacks`, `JSON`, `setTimeout`, `location`, `getSocketProtocol`, `window` +- Reads (eventual): `source`, `eventCallbacks`, `getSocketProtocol` - Write: `connectHMR` -- Write (eventual): `source` +- Write (eventual): `source`, `eventCallbacks` # Phase 1 ```mermaid diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md index 7ab4874e5634d..4c5bf993d6932 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md @@ -91,7 +91,7 @@ const hasPostpone = typeof React.unstable_postpone === 'function'; - Declares: `hasPostpone` - Reads: `React` -- Write: `hasPostpone` +- Write: `hasPostpone`, `React` ## Item 10: Stmt 5, `Normal` @@ -164,7 +164,7 @@ export function trackDynamicDataAccessed(store, expression) { - Hoisted - Declares: `trackDynamicDataAccessed` -- Reads (eventual): `getPathname`, `Error`, `StaticGenBailoutError`, `postponeWithTracking`, `DynamicServerError` +- Reads (eventual): `getPathname`, `StaticGenBailoutError`, `postponeWithTracking`, `DynamicServerError` - Write: `trackDynamicDataAccessed` ## Item 13: Stmt 8, `Normal` @@ -213,8 +213,9 @@ function postponeWithTracking(prerenderState, expression, pathname) { - Hoisted - Declares: `postponeWithTracking` -- Reads (eventual): `assertPostpone`, `Error`, `undefined`, `React` +- Reads (eventual): `assertPostpone`, `React` - Write: `postponeWithTracking` +- Write (eventual): `React` ## Item 16: Stmt 11, `Normal` @@ -269,7 +270,7 @@ function assertPostpone() { - Hoisted - Declares: `assertPostpone` -- Reads (eventual): `hasPostpone`, `Error` +- Reads (eventual): `hasPostpone` - Write: `assertPostpone` ## Item 19: Stmt 14, `Normal` @@ -290,8 +291,9 @@ export function createPostponedAbortSignal(reason) { - Hoisted - Declares: `createPostponedAbortSignal` -- Reads (eventual): `assertPostpone`, `AbortController`, `React` +- Reads (eventual): `assertPostpone`, `React` - Write: `createPostponedAbortSignal` +- Write (eventual): `React` # Phase 1 ```mermaid @@ -446,10 +448,10 @@ graph TD Item13 --> Item15; Item14 --> Item15; Item15 --> Item18; - Item15 --> Item5; + Item15 --> Item9; Item18 --> Item9; Item19 --> Item18; - Item19 --> Item5; + Item19 --> Item9; ``` # Phase 4 ```mermaid @@ -509,10 +511,10 @@ graph TD Item13 --> Item15; Item14 --> Item15; Item15 --> Item18; - Item15 --> Item5; + Item15 --> Item9; Item18 --> Item9; Item19 --> Item18; - Item19 --> Item5; + Item19 --> Item9; Item20 --> Item1; Item20 --> Item2; Item20 --> Item3; @@ -537,9 +539,9 @@ graph TD N5["Items: [ItemId(Export(("trackDynamicFetch", #2), "trackDynamicFetch")), ItemId(9, Normal)]"]; N6["Items: [ItemId(Export(("usedDynamicAPIs", #2), "usedDynamicAPIs")), ItemId(11, Normal)]"]; N7["Items: [ItemId(Export(("formatDynamicAPIAccesses", #2), "formatDynamicAPIAccesses")), ItemId(12, Normal)]"]; - N8["Items: [ItemId(Export(("createPostponedAbortSignal", #2), "createPostponedAbortSignal")), ItemId(0, ImportBinding(0)), ItemId(14, Normal)]"]; + N8["Items: [ItemId(Export(("createPostponedAbortSignal", #2), "createPostponedAbortSignal")), ItemId(14, Normal)]"]; N9["Items: [ItemId(0, ImportBinding(0)), ItemId(4, VarDeclarator(0))]"]; - N10["Items: [ItemId(0, ImportBinding(0)), ItemId(10, Normal)]"]; + N10["Items: [ItemId(10, Normal)]"]; N11["Items: [ItemId(13, Normal)]"]; N2 --> N3; N2 --> N10; @@ -547,9 +549,9 @@ graph TD N4 --> N10; N5 --> N10; N8 --> N11; - N8 --> N10; - N9 --> N10; + N8 --> N9; N10 --> N11; + N10 --> N9; N11 --> N9; ``` # Entrypoints @@ -746,11 +748,10 @@ export { formatDynamicAPIAccesses } from "__TURBOPACK_VAR__" assert { import { assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 10 +import { React } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; export { createPostponedAbortSignal }; -import React from 'react'; function createPostponedAbortSignal(reason) { assertPostpone(); const controller = new AbortController(); @@ -768,14 +769,14 @@ export { createPostponedAbortSignal } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 10 -}; import React from 'react'; const hasPostpone = typeof React.unstable_postpone === 'function'; export { hasPostpone } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; +export { React } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; ``` ## Part 10 @@ -783,7 +784,9 @@ export { hasPostpone } from "__TURBOPACK_VAR__" assert { import { assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; -import React from 'react'; +import { React } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; function postponeWithTracking(prerenderState, expression, pathname) { assertPostpone(); const reason = `Route ${pathname} needs to bail out of prerendering at this point because it used ${expression}. ` + `React throws this special object to indicate where. It should not be caught by ` + `your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`; @@ -1016,11 +1019,10 @@ export { formatDynamicAPIAccesses } from "__TURBOPACK_VAR__" assert { import { assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 10 +import { React } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 }; export { createPostponedAbortSignal }; -import React from 'react'; function createPostponedAbortSignal(reason) { assertPostpone(); const controller = new AbortController(); @@ -1038,14 +1040,14 @@ export { createPostponedAbortSignal } from "__TURBOPACK_VAR__" assert { ``` ## Part 9 ```js -import "__TURBOPACK_PART__" assert { - __turbopack_part__: 10 -}; import React from 'react'; const hasPostpone = typeof React.unstable_postpone === 'function'; export { hasPostpone } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; +export { React } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; ``` ## Part 10 @@ -1053,7 +1055,9 @@ export { hasPostpone } from "__TURBOPACK_VAR__" assert { import { assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: 11 }; -import React from 'react'; +import { React } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; function postponeWithTracking(prerenderState, expression, pathname) { assertPostpone(); const reason = `Route ${pathname} needs to bail out of prerendering at this point because it used ${expression}. ` + `React throws this special object to indicate where. It should not be caught by ` + `your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`; diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md index dd4ee200bda38..824cc244e1042 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md @@ -215,7 +215,7 @@ function createIpc(port) { - Hoisted - Declares: `createIpc` -- Reads (eventual): `createConnection`, `JSON`, `Buffer`, `loop`, `process`, `Promise`, `structuredError`, `console` +- Reads (eventual): `createConnection`, `loop`, `structuredError` - Write: `createIpc` ## Item 9: Stmt 5, `VarDeclarator(0)` @@ -225,8 +225,8 @@ const PORT = process.argv[2]; ``` +- Side effects - Declares: `PORT` -- Reads: `process` - Write: `PORT` ## Item 10: Stmt 6, `VarDeclarator(0)` @@ -236,8 +236,9 @@ export const IPC = createIpc(parseInt(PORT, 10)); ``` +- Side effects - Declares: `IPC` -- Reads: `createIpc`, `parseInt`, `PORT` +- Reads: `createIpc`, `PORT` - Write: `IPC` ## Item 11: Stmt 7, `Normal` @@ -250,8 +251,8 @@ process.on("uncaughtException", (err)=>{ ``` - Side effects -- Reads: `process` - Reads (eventual): `IPC` +- Write (eventual): `IPC` ## Item 12: Stmt 8, `VarDeclarator(0)` @@ -274,7 +275,6 @@ const improveConsole = (name, stream, addStack)=>{ ``` - Declares: `improveConsole` -- Reads (eventual): `console`, `process`, `Error` - Write: `improveConsole` ## Item 13: Stmt 9, `Normal` @@ -518,57 +518,73 @@ graph TD Item2 --> Item1; Item3 --> Item1; Item3 --> Item2; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 -.-> Item6; + Item9 -.-> Item5; + Item9 -.-> Item4; + Item9 -.-> Item7; Item10 --> Item8; Item10 --> Item9; + Item10 --> Item1; + Item10 --> Item2; + Item10 --> Item3; + Item10 -.-> Item6; + Item10 -.-> Item5; + Item10 -.-> Item4; + Item10 -.-> Item7; Item11 --> Item1; Item11 --> Item2; Item11 --> Item3; + Item11 --> Item9; + Item11 --> Item10; Item11 -.-> Item6; Item11 -.-> Item5; Item11 -.-> Item4; - Item11 -.-> Item9; Item11 -.-> Item7; - Item11 -.-> Item10; Item13 --> Item12; Item13 --> Item1; Item13 --> Item2; Item13 --> Item3; + Item13 --> Item9; + Item13 --> Item10; Item13 --> Item11; Item13 -.-> Item6; Item13 -.-> Item5; Item13 -.-> Item4; - Item13 -.-> Item9; Item13 -.-> Item7; - Item13 -.-> Item10; Item14 --> Item12; Item14 --> Item1; Item14 --> Item2; Item14 --> Item3; + Item14 --> Item9; + Item14 --> Item10; Item14 --> Item11; Item14 --> Item13; Item14 -.-> Item6; Item14 -.-> Item5; Item14 -.-> Item4; - Item14 -.-> Item9; Item14 -.-> Item7; - Item14 -.-> Item10; Item15 --> Item12; Item15 --> Item1; Item15 --> Item2; Item15 --> Item3; + Item15 --> Item9; + Item15 --> Item10; Item15 --> Item11; Item15 --> Item13; Item15 --> Item14; Item15 -.-> Item6; Item15 -.-> Item5; Item15 -.-> Item4; - Item15 -.-> Item9; Item15 -.-> Item7; - Item15 -.-> Item10; Item16 --> Item12; Item16 --> Item1; Item16 --> Item2; Item16 --> Item3; + Item16 --> Item9; + Item16 --> Item10; Item16 --> Item11; Item16 --> Item13; Item16 --> Item14; @@ -576,13 +592,13 @@ graph TD Item16 -.-> Item6; Item16 -.-> Item5; Item16 -.-> Item4; - Item16 -.-> Item9; Item16 -.-> Item7; - Item16 -.-> Item10; Item17 --> Item12; Item17 --> Item1; Item17 --> Item2; Item17 --> Item3; + Item17 --> Item9; + Item17 --> Item10; Item17 --> Item11; Item17 --> Item13; Item17 --> Item14; @@ -591,13 +607,13 @@ graph TD Item17 -.-> Item6; Item17 -.-> Item5; Item17 -.-> Item4; - Item17 -.-> Item9; Item17 -.-> Item7; - Item17 -.-> Item10; Item18 --> Item12; Item18 --> Item1; Item18 --> Item2; Item18 --> Item3; + Item18 --> Item9; + Item18 --> Item10; Item18 --> Item11; Item18 --> Item13; Item18 --> Item14; @@ -607,13 +623,13 @@ graph TD Item18 -.-> Item6; Item18 -.-> Item5; Item18 -.-> Item4; - Item18 -.-> Item9; Item18 -.-> Item7; - Item18 -.-> Item10; Item19 --> Item12; Item19 --> Item1; Item19 --> Item2; Item19 --> Item3; + Item19 --> Item9; + Item19 --> Item10; Item19 --> Item11; Item19 --> Item13; Item19 --> Item14; @@ -624,13 +640,13 @@ graph TD Item19 -.-> Item6; Item19 -.-> Item5; Item19 -.-> Item4; - Item19 -.-> Item9; Item19 -.-> Item7; - Item19 -.-> Item10; Item20 --> Item12; Item20 --> Item1; Item20 --> Item2; Item20 --> Item3; + Item20 --> Item9; + Item20 --> Item10; Item20 --> Item11; Item20 --> Item13; Item20 --> Item14; @@ -642,13 +658,13 @@ graph TD Item20 -.-> Item6; Item20 -.-> Item5; Item20 -.-> Item4; - Item20 -.-> Item9; Item20 -.-> Item7; - Item20 -.-> Item10; Item21 --> Item12; Item21 --> Item1; Item21 --> Item2; Item21 --> Item3; + Item21 --> Item9; + Item21 --> Item10; Item21 --> Item11; Item21 --> Item13; Item21 --> Item14; @@ -661,13 +677,13 @@ graph TD Item21 -.-> Item6; Item21 -.-> Item5; Item21 -.-> Item4; - Item21 -.-> Item9; Item21 -.-> Item7; - Item21 -.-> Item10; Item22 --> Item12; Item22 --> Item1; Item22 --> Item2; Item22 --> Item3; + Item22 --> Item9; + Item22 --> Item10; Item22 --> Item11; Item22 --> Item13; Item22 --> Item14; @@ -681,13 +697,13 @@ graph TD Item22 -.-> Item6; Item22 -.-> Item5; Item22 -.-> Item4; - Item22 -.-> Item9; Item22 -.-> Item7; - Item22 -.-> Item10; Item23 --> Item12; Item23 --> Item1; Item23 --> Item2; Item23 --> Item3; + Item23 --> Item9; + Item23 --> Item10; Item23 --> Item11; Item23 --> Item13; Item23 --> Item14; @@ -702,13 +718,13 @@ graph TD Item23 -.-> Item6; Item23 -.-> Item5; Item23 -.-> Item4; - Item23 -.-> Item9; Item23 -.-> Item7; - Item23 -.-> Item10; Item24 --> Item12; Item24 --> Item1; Item24 --> Item2; Item24 --> Item3; + Item24 --> Item9; + Item24 --> Item10; Item24 --> Item11; Item24 --> Item13; Item24 --> Item14; @@ -724,13 +740,13 @@ graph TD Item24 -.-> Item6; Item24 -.-> Item5; Item24 -.-> Item4; - Item24 -.-> Item9; Item24 -.-> Item7; - Item24 -.-> Item10; Item25 --> Item12; Item25 --> Item1; Item25 --> Item2; Item25 --> Item3; + Item25 --> Item9; + Item25 --> Item10; Item25 --> Item11; Item25 --> Item13; Item25 --> Item14; @@ -747,13 +763,13 @@ graph TD Item25 -.-> Item6; Item25 -.-> Item5; Item25 -.-> Item4; - Item25 -.-> Item9; Item25 -.-> Item7; - Item25 -.-> Item10; Item26 --> Item12; Item26 --> Item1; Item26 --> Item2; Item26 --> Item3; + Item26 --> Item9; + Item26 --> Item10; Item26 --> Item11; Item26 --> Item13; Item26 --> Item14; @@ -771,13 +787,13 @@ graph TD Item26 -.-> Item6; Item26 -.-> Item5; Item26 -.-> Item4; - Item26 -.-> Item9; Item26 -.-> Item7; - Item26 -.-> Item10; Item27 --> Item12; Item27 --> Item1; Item27 --> Item2; Item27 --> Item3; + Item27 --> Item9; + Item27 --> Item10; Item27 --> Item11; Item27 --> Item13; Item27 --> Item14; @@ -796,13 +812,13 @@ graph TD Item27 -.-> Item6; Item27 -.-> Item5; Item27 -.-> Item4; - Item27 -.-> Item9; Item27 -.-> Item7; - Item27 -.-> Item10; Item28 --> Item12; Item28 --> Item1; Item28 --> Item2; Item28 --> Item3; + Item28 --> Item9; + Item28 --> Item10; Item28 --> Item11; Item28 --> Item13; Item28 --> Item14; @@ -822,9 +838,7 @@ graph TD Item28 -.-> Item6; Item28 -.-> Item5; Item28 -.-> Item4; - Item28 -.-> Item9; Item28 -.-> Item7; - Item28 -.-> Item10; ``` # Phase 3 ```mermaid @@ -866,57 +880,73 @@ graph TD Item2 --> Item1; Item3 --> Item1; Item3 --> Item2; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 -.-> Item6; + Item9 -.-> Item5; + Item9 -.-> Item4; + Item9 -.-> Item7; Item10 --> Item8; Item10 --> Item9; + Item10 --> Item1; + Item10 --> Item2; + Item10 --> Item3; + Item10 -.-> Item6; + Item10 -.-> Item5; + Item10 -.-> Item4; + Item10 -.-> Item7; Item11 --> Item1; Item11 --> Item2; Item11 --> Item3; + Item11 --> Item9; + Item11 --> Item10; Item11 -.-> Item6; Item11 -.-> Item5; Item11 -.-> Item4; - Item11 -.-> Item9; Item11 -.-> Item7; - Item11 --> Item10; Item13 --> Item12; Item13 --> Item1; Item13 --> Item2; Item13 --> Item3; + Item13 --> Item9; + Item13 --> Item10; Item13 --> Item11; Item13 -.-> Item6; Item13 -.-> Item5; Item13 -.-> Item4; - Item13 -.-> Item9; Item13 -.-> Item7; - Item13 -.-> Item10; Item14 --> Item12; Item14 --> Item1; Item14 --> Item2; Item14 --> Item3; + Item14 --> Item9; + Item14 --> Item10; Item14 --> Item11; Item14 --> Item13; Item14 -.-> Item6; Item14 -.-> Item5; Item14 -.-> Item4; - Item14 -.-> Item9; Item14 -.-> Item7; - Item14 -.-> Item10; Item15 --> Item12; Item15 --> Item1; Item15 --> Item2; Item15 --> Item3; + Item15 --> Item9; + Item15 --> Item10; Item15 --> Item11; Item15 --> Item13; Item15 --> Item14; Item15 -.-> Item6; Item15 -.-> Item5; Item15 -.-> Item4; - Item15 -.-> Item9; Item15 -.-> Item7; - Item15 -.-> Item10; Item16 --> Item12; Item16 --> Item1; Item16 --> Item2; Item16 --> Item3; + Item16 --> Item9; + Item16 --> Item10; Item16 --> Item11; Item16 --> Item13; Item16 --> Item14; @@ -924,13 +954,13 @@ graph TD Item16 -.-> Item6; Item16 -.-> Item5; Item16 -.-> Item4; - Item16 -.-> Item9; Item16 -.-> Item7; - Item16 -.-> Item10; Item17 --> Item12; Item17 --> Item1; Item17 --> Item2; Item17 --> Item3; + Item17 --> Item9; + Item17 --> Item10; Item17 --> Item11; Item17 --> Item13; Item17 --> Item14; @@ -939,13 +969,13 @@ graph TD Item17 -.-> Item6; Item17 -.-> Item5; Item17 -.-> Item4; - Item17 -.-> Item9; Item17 -.-> Item7; - Item17 -.-> Item10; Item18 --> Item12; Item18 --> Item1; Item18 --> Item2; Item18 --> Item3; + Item18 --> Item9; + Item18 --> Item10; Item18 --> Item11; Item18 --> Item13; Item18 --> Item14; @@ -955,13 +985,13 @@ graph TD Item18 -.-> Item6; Item18 -.-> Item5; Item18 -.-> Item4; - Item18 -.-> Item9; Item18 -.-> Item7; - Item18 -.-> Item10; Item19 --> Item12; Item19 --> Item1; Item19 --> Item2; Item19 --> Item3; + Item19 --> Item9; + Item19 --> Item10; Item19 --> Item11; Item19 --> Item13; Item19 --> Item14; @@ -972,13 +1002,13 @@ graph TD Item19 -.-> Item6; Item19 -.-> Item5; Item19 -.-> Item4; - Item19 -.-> Item9; Item19 -.-> Item7; - Item19 -.-> Item10; Item20 --> Item12; Item20 --> Item1; Item20 --> Item2; Item20 --> Item3; + Item20 --> Item9; + Item20 --> Item10; Item20 --> Item11; Item20 --> Item13; Item20 --> Item14; @@ -990,13 +1020,13 @@ graph TD Item20 -.-> Item6; Item20 -.-> Item5; Item20 -.-> Item4; - Item20 -.-> Item9; Item20 -.-> Item7; - Item20 -.-> Item10; Item21 --> Item12; Item21 --> Item1; Item21 --> Item2; Item21 --> Item3; + Item21 --> Item9; + Item21 --> Item10; Item21 --> Item11; Item21 --> Item13; Item21 --> Item14; @@ -1009,13 +1039,13 @@ graph TD Item21 -.-> Item6; Item21 -.-> Item5; Item21 -.-> Item4; - Item21 -.-> Item9; Item21 -.-> Item7; - Item21 -.-> Item10; Item22 --> Item12; Item22 --> Item1; Item22 --> Item2; Item22 --> Item3; + Item22 --> Item9; + Item22 --> Item10; Item22 --> Item11; Item22 --> Item13; Item22 --> Item14; @@ -1029,13 +1059,13 @@ graph TD Item22 -.-> Item6; Item22 -.-> Item5; Item22 -.-> Item4; - Item22 -.-> Item9; Item22 -.-> Item7; - Item22 -.-> Item10; Item23 --> Item12; Item23 --> Item1; Item23 --> Item2; Item23 --> Item3; + Item23 --> Item9; + Item23 --> Item10; Item23 --> Item11; Item23 --> Item13; Item23 --> Item14; @@ -1050,13 +1080,13 @@ graph TD Item23 -.-> Item6; Item23 -.-> Item5; Item23 -.-> Item4; - Item23 -.-> Item9; Item23 -.-> Item7; - Item23 -.-> Item10; Item24 --> Item12; Item24 --> Item1; Item24 --> Item2; Item24 --> Item3; + Item24 --> Item9; + Item24 --> Item10; Item24 --> Item11; Item24 --> Item13; Item24 --> Item14; @@ -1072,13 +1102,13 @@ graph TD Item24 -.-> Item6; Item24 -.-> Item5; Item24 -.-> Item4; - Item24 -.-> Item9; Item24 -.-> Item7; - Item24 -.-> Item10; Item25 --> Item12; Item25 --> Item1; Item25 --> Item2; Item25 --> Item3; + Item25 --> Item9; + Item25 --> Item10; Item25 --> Item11; Item25 --> Item13; Item25 --> Item14; @@ -1095,13 +1125,13 @@ graph TD Item25 -.-> Item6; Item25 -.-> Item5; Item25 -.-> Item4; - Item25 -.-> Item9; Item25 -.-> Item7; - Item25 -.-> Item10; Item26 --> Item12; Item26 --> Item1; Item26 --> Item2; Item26 --> Item3; + Item26 --> Item9; + Item26 --> Item10; Item26 --> Item11; Item26 --> Item13; Item26 --> Item14; @@ -1119,13 +1149,13 @@ graph TD Item26 -.-> Item6; Item26 -.-> Item5; Item26 -.-> Item4; - Item26 -.-> Item9; Item26 -.-> Item7; - Item26 -.-> Item10; Item27 --> Item12; Item27 --> Item1; Item27 --> Item2; Item27 --> Item3; + Item27 --> Item9; + Item27 --> Item10; Item27 --> Item11; Item27 --> Item13; Item27 --> Item14; @@ -1144,13 +1174,13 @@ graph TD Item27 -.-> Item6; Item27 -.-> Item5; Item27 -.-> Item4; - Item27 -.-> Item9; Item27 -.-> Item7; - Item27 -.-> Item10; Item28 --> Item12; Item28 --> Item1; Item28 --> Item2; Item28 --> Item3; + Item28 --> Item9; + Item28 --> Item10; Item28 --> Item11; Item28 --> Item13; Item28 --> Item14; @@ -1170,9 +1200,7 @@ graph TD Item28 -.-> Item6; Item28 -.-> Item5; Item28 -.-> Item4; - Item28 -.-> Item9; Item28 -.-> Item7; - Item28 -.-> Item10; Item7 --> Item6; Item7 --> Item5; Item8 --> Item4; @@ -1218,57 +1246,73 @@ graph TD Item2 --> Item1; Item3 --> Item1; Item3 --> Item2; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 -.-> Item6; + Item9 -.-> Item5; + Item9 -.-> Item4; + Item9 -.-> Item7; Item10 --> Item8; Item10 --> Item9; + Item10 --> Item1; + Item10 --> Item2; + Item10 --> Item3; + Item10 -.-> Item6; + Item10 -.-> Item5; + Item10 -.-> Item4; + Item10 -.-> Item7; Item11 --> Item1; Item11 --> Item2; Item11 --> Item3; + Item11 --> Item9; + Item11 --> Item10; Item11 -.-> Item6; Item11 -.-> Item5; Item11 -.-> Item4; - Item11 -.-> Item9; Item11 -.-> Item7; - Item11 --> Item10; Item13 --> Item12; Item13 --> Item1; Item13 --> Item2; Item13 --> Item3; + Item13 --> Item9; + Item13 --> Item10; Item13 --> Item11; Item13 -.-> Item6; Item13 -.-> Item5; Item13 -.-> Item4; - Item13 -.-> Item9; Item13 -.-> Item7; - Item13 -.-> Item10; Item14 --> Item12; Item14 --> Item1; Item14 --> Item2; Item14 --> Item3; + Item14 --> Item9; + Item14 --> Item10; Item14 --> Item11; Item14 --> Item13; Item14 -.-> Item6; Item14 -.-> Item5; Item14 -.-> Item4; - Item14 -.-> Item9; Item14 -.-> Item7; - Item14 -.-> Item10; Item15 --> Item12; Item15 --> Item1; Item15 --> Item2; Item15 --> Item3; + Item15 --> Item9; + Item15 --> Item10; Item15 --> Item11; Item15 --> Item13; Item15 --> Item14; Item15 -.-> Item6; Item15 -.-> Item5; Item15 -.-> Item4; - Item15 -.-> Item9; Item15 -.-> Item7; - Item15 -.-> Item10; Item16 --> Item12; Item16 --> Item1; Item16 --> Item2; Item16 --> Item3; + Item16 --> Item9; + Item16 --> Item10; Item16 --> Item11; Item16 --> Item13; Item16 --> Item14; @@ -1276,13 +1320,13 @@ graph TD Item16 -.-> Item6; Item16 -.-> Item5; Item16 -.-> Item4; - Item16 -.-> Item9; Item16 -.-> Item7; - Item16 -.-> Item10; Item17 --> Item12; Item17 --> Item1; Item17 --> Item2; Item17 --> Item3; + Item17 --> Item9; + Item17 --> Item10; Item17 --> Item11; Item17 --> Item13; Item17 --> Item14; @@ -1291,13 +1335,13 @@ graph TD Item17 -.-> Item6; Item17 -.-> Item5; Item17 -.-> Item4; - Item17 -.-> Item9; Item17 -.-> Item7; - Item17 -.-> Item10; Item18 --> Item12; Item18 --> Item1; Item18 --> Item2; Item18 --> Item3; + Item18 --> Item9; + Item18 --> Item10; Item18 --> Item11; Item18 --> Item13; Item18 --> Item14; @@ -1307,13 +1351,13 @@ graph TD Item18 -.-> Item6; Item18 -.-> Item5; Item18 -.-> Item4; - Item18 -.-> Item9; Item18 -.-> Item7; - Item18 -.-> Item10; Item19 --> Item12; Item19 --> Item1; Item19 --> Item2; Item19 --> Item3; + Item19 --> Item9; + Item19 --> Item10; Item19 --> Item11; Item19 --> Item13; Item19 --> Item14; @@ -1324,13 +1368,13 @@ graph TD Item19 -.-> Item6; Item19 -.-> Item5; Item19 -.-> Item4; - Item19 -.-> Item9; Item19 -.-> Item7; - Item19 -.-> Item10; Item20 --> Item12; Item20 --> Item1; Item20 --> Item2; Item20 --> Item3; + Item20 --> Item9; + Item20 --> Item10; Item20 --> Item11; Item20 --> Item13; Item20 --> Item14; @@ -1342,13 +1386,13 @@ graph TD Item20 -.-> Item6; Item20 -.-> Item5; Item20 -.-> Item4; - Item20 -.-> Item9; Item20 -.-> Item7; - Item20 -.-> Item10; Item21 --> Item12; Item21 --> Item1; Item21 --> Item2; Item21 --> Item3; + Item21 --> Item9; + Item21 --> Item10; Item21 --> Item11; Item21 --> Item13; Item21 --> Item14; @@ -1361,13 +1405,13 @@ graph TD Item21 -.-> Item6; Item21 -.-> Item5; Item21 -.-> Item4; - Item21 -.-> Item9; Item21 -.-> Item7; - Item21 -.-> Item10; Item22 --> Item12; Item22 --> Item1; Item22 --> Item2; Item22 --> Item3; + Item22 --> Item9; + Item22 --> Item10; Item22 --> Item11; Item22 --> Item13; Item22 --> Item14; @@ -1381,13 +1425,13 @@ graph TD Item22 -.-> Item6; Item22 -.-> Item5; Item22 -.-> Item4; - Item22 -.-> Item9; Item22 -.-> Item7; - Item22 -.-> Item10; Item23 --> Item12; Item23 --> Item1; Item23 --> Item2; Item23 --> Item3; + Item23 --> Item9; + Item23 --> Item10; Item23 --> Item11; Item23 --> Item13; Item23 --> Item14; @@ -1402,13 +1446,13 @@ graph TD Item23 -.-> Item6; Item23 -.-> Item5; Item23 -.-> Item4; - Item23 -.-> Item9; Item23 -.-> Item7; - Item23 -.-> Item10; Item24 --> Item12; Item24 --> Item1; Item24 --> Item2; Item24 --> Item3; + Item24 --> Item9; + Item24 --> Item10; Item24 --> Item11; Item24 --> Item13; Item24 --> Item14; @@ -1424,13 +1468,13 @@ graph TD Item24 -.-> Item6; Item24 -.-> Item5; Item24 -.-> Item4; - Item24 -.-> Item9; Item24 -.-> Item7; - Item24 -.-> Item10; Item25 --> Item12; Item25 --> Item1; Item25 --> Item2; Item25 --> Item3; + Item25 --> Item9; + Item25 --> Item10; Item25 --> Item11; Item25 --> Item13; Item25 --> Item14; @@ -1447,13 +1491,13 @@ graph TD Item25 -.-> Item6; Item25 -.-> Item5; Item25 -.-> Item4; - Item25 -.-> Item9; Item25 -.-> Item7; - Item25 -.-> Item10; Item26 --> Item12; Item26 --> Item1; Item26 --> Item2; Item26 --> Item3; + Item26 --> Item9; + Item26 --> Item10; Item26 --> Item11; Item26 --> Item13; Item26 --> Item14; @@ -1471,13 +1515,13 @@ graph TD Item26 -.-> Item6; Item26 -.-> Item5; Item26 -.-> Item4; - Item26 -.-> Item9; Item26 -.-> Item7; - Item26 -.-> Item10; Item27 --> Item12; Item27 --> Item1; Item27 --> Item2; Item27 --> Item3; + Item27 --> Item9; + Item27 --> Item10; Item27 --> Item11; Item27 --> Item13; Item27 --> Item14; @@ -1496,13 +1540,13 @@ graph TD Item27 -.-> Item6; Item27 -.-> Item5; Item27 -.-> Item4; - Item27 -.-> Item9; Item27 -.-> Item7; - Item27 -.-> Item10; Item28 --> Item12; Item28 --> Item1; Item28 --> Item2; Item28 --> Item3; + Item28 --> Item9; + Item28 --> Item10; Item28 --> Item11; Item28 --> Item13; Item28 --> Item14; @@ -1522,9 +1566,7 @@ graph TD Item28 -.-> Item6; Item28 -.-> Item5; Item28 -.-> Item4; - Item28 -.-> Item9; Item28 -.-> Item7; - Item28 -.-> Item10; Item7 --> Item6; Item7 --> Item5; Item8 --> Item4; @@ -1532,6 +1574,8 @@ graph TD Item29 --> Item1; Item29 --> Item2; Item29 --> Item3; + Item29 --> Item9; + Item29 --> Item10; Item29 --> Item11; Item29 --> Item13; Item29 --> Item14; @@ -1555,22 +1599,41 @@ graph TD # Final ```mermaid graph TD - N0["Items: [ItemId(ModuleEvaluation), ItemId(0, ImportOfModule), ItemId(0, ImportBinding(0)), ItemId(1, ImportOfModule), ItemId(1, ImportBinding(0)), ItemId(2, ImportOfModule), ItemId(2, ImportBinding(0)), ItemId(7, Normal), ItemId(8, VarDeclarator(0)), ItemId(9, Normal), ItemId(10, Normal), ItemId(11, Normal), ItemId(12, Normal), ItemId(13, Normal), ItemId(14, Normal), ItemId(15, Normal), ItemId(16, Normal), ItemId(17, Normal), ItemId(18, Normal), ItemId(19, Normal), ItemId(20, Normal), ItemId(21, Normal), ItemId(22, Normal), ItemId(23, Normal), ItemId(24, Normal)]"]; + N0["Items: [ItemId(ModuleEvaluation), ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(7, Normal), ItemId(8, VarDeclarator(0)), ItemId(9, Normal), ItemId(10, Normal), ItemId(11, Normal), ItemId(12, Normal), ItemId(13, Normal), ItemId(14, Normal), ItemId(15, Normal), ItemId(16, Normal), ItemId(17, Normal), ItemId(18, Normal), ItemId(19, Normal), ItemId(20, Normal), ItemId(21, Normal), ItemId(22, Normal), ItemId(23, Normal), ItemId(24, Normal)]"]; N1["Items: [ItemId(Export(("structuredError", #2), "structuredError"))]"]; N2["Items: [ItemId(Export(("IPC", #2), "IPC"))]"]; - N3["Items: [ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(3, Normal)]"]; - N4["Items: [ItemId(0, ImportBinding(0)), ItemId(4, Normal)]"]; - N5["Items: [ItemId(5, VarDeclarator(0))]"]; - N6["Items: [ItemId(6, VarDeclarator(0))]"]; + N3["Items: [ItemId(0, ImportOfModule)]"]; + N4["Items: [ItemId(1, ImportOfModule)]"]; + N5["Items: [ItemId(2, ImportOfModule)]"]; + N6["Items: [ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(3, Normal)]"]; + N7["Items: [ItemId(0, ImportBinding(0)), ItemId(4, Normal)]"]; + N8["Items: [ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(5, VarDeclarator(0))]"]; + N9["Items: [ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(6, VarDeclarator(0))]"]; N0 --> N3; N0 --> N4; N0 --> N5; + N0 --> N8; + N0 --> N9; N0 --> N6; - N1 --> N3; - N2 --> N6; + N1 --> N6; + N2 --> N9; N4 --> N3; - N6 --> N4; - N6 --> N5; + N5 --> N3; + N5 --> N4; + N6 --> N9; + N7 --> N9; + N7 --> N6; + N8 --> N3; + N8 --> N4; + N8 --> N5; + N8 --> N9; + N8 --> N6; + N9 --> N7; + N9 --> N8; + N9 --> N3; + N9 --> N4; + N9 --> N5; + N9 --> N6; ``` # Entrypoints @@ -1599,15 +1662,18 @@ import "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 5 }; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { __turbopack_part__: 6 }; "module evaluation"; -import "node:net"; import { createConnection } from "node:net"; -import "../compiled/stacktrace-parser"; import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; -import "./error"; import { getProperError } from "./error"; process.on("uncaughtException", (err)=>{ IPC.sendError(err); @@ -1650,7 +1716,7 @@ export { improveConsole } from "__TURBOPACK_VAR__" assert { ## Part 1 ```js import { structuredError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 3 + __turbopack_part__: 6 }; export { structuredError }; @@ -1658,13 +1724,40 @@ export { structuredError }; ## Part 2 ```js import { IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 6 + __turbopack_part__: 9 }; export { IPC }; ``` ## Part 3 ```js +import "node:net"; + +``` +## Part 4 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "../compiled/stacktrace-parser"; + +``` +## Part 5 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "./error"; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; import { getProperError } from "./error"; function structuredError(e) { @@ -1680,10 +1773,13 @@ export { structuredError } from "__TURBOPACK_VAR__" assert { }; ``` -## Part 4 +## Part 7 ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; import { structuredError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 3 + __turbopack_part__: 6 }; import { createConnection } from "node:net"; function createIpc(port) { @@ -1817,22 +1913,55 @@ export { createIpc } from "__TURBOPACK_VAR__" assert { }; ``` -## Part 5 +## Part 8 ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { createConnection } from "node:net"; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; const PORT = process.argv[2]; export { PORT } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; ``` -## Part 6 +## Part 9 ```js import { createIpc } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 4 + __turbopack_part__: 7 }; import { PORT } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { __turbopack_part__: 5 }; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { createConnection } from "node:net"; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; const IPC = createIpc(parseInt(PORT, 10)); export { IPC } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true @@ -1850,14 +1979,17 @@ import "__TURBOPACK_PART__" assert { import "__TURBOPACK_PART__" assert { __turbopack_part__: 5 }; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { __turbopack_part__: 6 }; -import "node:net"; import { createConnection } from "node:net"; -import "../compiled/stacktrace-parser"; import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; -import "./error"; import { getProperError } from "./error"; "module evaluation"; process.on("uncaughtException", (err)=>{ @@ -1916,13 +2048,22 @@ export { improveConsole } from "__TURBOPACK_VAR__" assert { # Modules (prod) ## Part 0 ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; import { IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 6 + __turbopack_part__: 9 }; "module evaluation"; -import "node:net"; -import "../compiled/stacktrace-parser"; -import "./error"; process.on("uncaughtException", (err)=>{ IPC.sendError(err); }); @@ -1964,7 +2105,7 @@ export { improveConsole } from "__TURBOPACK_VAR__" assert { ## Part 1 ```js import { structuredError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 3 + __turbopack_part__: 6 }; export { structuredError }; @@ -1972,13 +2113,37 @@ export { structuredError }; ## Part 2 ```js import { IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 6 + __turbopack_part__: 9 }; export { IPC }; ``` ## Part 3 ```js +import "node:net"; + +``` +## Part 4 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "../compiled/stacktrace-parser"; + +``` +## Part 5 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "./error"; + +``` +## Part 6 +```js import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; import { getProperError } from "./error"; function structuredError(e) { @@ -1994,10 +2159,10 @@ export { structuredError } from "__TURBOPACK_VAR__" assert { }; ``` -## Part 4 +## Part 7 ```js import { structuredError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 3 + __turbopack_part__: 6 }; import { createConnection } from "node:net"; function createIpc(port) { @@ -2131,20 +2296,38 @@ export { createIpc } from "__TURBOPACK_VAR__" assert { }; ``` -## Part 5 +## Part 8 ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; const PORT = process.argv[2]; export { PORT } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; ``` -## Part 6 +## Part 9 ```js import { createIpc } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 4 + __turbopack_part__: 7 }; import { PORT } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { __turbopack_part__: 5 }; const IPC = createIpc(parseInt(PORT, 10)); @@ -2155,12 +2338,21 @@ export { IPC } from "__TURBOPACK_VAR__" assert { ``` ## Merged (module eval) ```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; import { IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: 6 + __turbopack_part__: 9 }; -import "node:net"; -import "../compiled/stacktrace-parser"; -import "./error"; "module evaluation"; process.on("uncaughtException", (err)=>{ IPC.sendError(err); diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md index 02e87dfd14ace..59c53ec2487d4 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md @@ -141,8 +141,9 @@ export const run = async (moduleFactory)=>{ ``` - Declares: `run` -- Reads (eventual): `Map`, `ipc`, `Promise`, `queue`, `undefined`, `JSON`, `Error`, `console`, `process` +- Reads (eventual): `ipc`, `queue` - Write: `run` +- Write (eventual): `ipc`, `queue` # Phase 1 ```mermaid diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/input.js b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/input.js new file mode 100644 index 0000000000000..441b34ae57bca --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/input.js @@ -0,0 +1,172 @@ +import { createConnection } from "node:net"; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; +export function structuredError(e) { + e = getProperError(e); + return { + name: e.name, + message: e.message, + stack: typeof e.stack === "string" ? parseStackTrace(e.stack) : [] + }; +} +function createIpc(port) { + const socket = createConnection(port, "127.0.0.1"); + const packetQueue = []; + const recvPromiseResolveQueue = []; + function pushPacket(packet) { + const recvPromiseResolve = recvPromiseResolveQueue.shift(); + if (recvPromiseResolve != null) { + recvPromiseResolve(JSON.parse(packet.toString("utf8"))); + } else { + packetQueue.push(packet); + } + } + let state = { + type: "waiting" + }; + let buffer = Buffer.alloc(0); + socket.once("connect", ()=>{ + socket.on("data", (chunk)=>{ + buffer = Buffer.concat([ + buffer, + chunk + ]); + loop: while(true){ + switch(state.type){ + case "waiting": + { + if (buffer.length >= 4) { + const length = buffer.readUInt32BE(0); + buffer = buffer.subarray(4); + state = { + type: "packet", + length + }; + } else { + break loop; + } + break; + } + case "packet": + { + if (buffer.length >= state.length) { + const packet = buffer.subarray(0, state.length); + buffer = buffer.subarray(state.length); + state = { + type: "waiting" + }; + pushPacket(packet); + } else { + break loop; + } + break; + } + } + } + }); + }); + socket.once("close", ()=>{ + process.exit(0); + }); + function send(message) { + const packet = Buffer.from(JSON.stringify(message), "utf8"); + const length = Buffer.alloc(4); + length.writeUInt32BE(packet.length); + socket.write(length); + return new Promise((resolve, reject)=>{ + socket.write(packet, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + function sendReady() { + const length = Buffer.from([ + 0, + 0, + 0, + 0 + ]); + return new Promise((resolve, reject)=>{ + socket.write(length, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + return { + async recv () { + const packet = packetQueue.shift(); + if (packet != null) { + return JSON.parse(packet.toString("utf8")); + } + const result = await new Promise((resolve)=>{ + recvPromiseResolveQueue.push((result)=>{ + resolve(result); + }); + }); + return result; + }, + send (message) { + return send(message); + }, + sendReady, + async sendError (error) { + try { + await send({ + type: "error", + ...structuredError(error) + }); + } catch (err) { + console.error("failed to send error back to rust:", err); + process.exit(1); + } + process.exit(0); + } + }; +} +const PORT = process.argv[2]; +export const IPC = createIpc(parseInt(PORT, 10)); +process.on("uncaughtException", (err)=>{ + IPC.sendError(err); +}); +const improveConsole = (name, stream, addStack)=>{ + const original = console[name]; + const stdio = process[stream]; + console[name] = (...args)=>{ + stdio.write(`TURBOPACK_OUTPUT_B\n`); + original(...args); + if (addStack) { + const stack = new Error().stack?.replace(/^.+\n.+\n/, "") + "\n"; + stdio.write("TURBOPACK_OUTPUT_S\n"); + stdio.write(stack); + } + stdio.write("TURBOPACK_OUTPUT_E\n"); + }; +}; +improveConsole("error", "stderr", true); +improveConsole("warn", "stderr", true); +improveConsole("count", "stdout", true); +improveConsole("trace", "stderr", false); +improveConsole("log", "stdout", true); +improveConsole("group", "stdout", true); +improveConsole("groupCollapsed", "stdout", true); +improveConsole("table", "stdout", true); +improveConsole("debug", "stdout", true); +improveConsole("info", "stdout", true); +improveConsole("dir", "stdout", true); +improveConsole("dirxml", "stdout", true); +improveConsole("timeEnd", "stdout", true); +improveConsole("timeLog", "stdout", true); +improveConsole("timeStamp", "stdout", true); +improveConsole("assert", "stderr", true); diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md new file mode 100644 index 0000000000000..824cc244e1042 --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md @@ -0,0 +1,2394 @@ +# Items + +Count: 31 + +## Item 1: Stmt 0, `ImportOfModule` + +```js +import { createConnection } from "node:net"; + +``` + +- Hoisted +- Side effects + +## Item 2: Stmt 0, `ImportBinding(0)` + +```js +import { createConnection } from "node:net"; + +``` + +- Hoisted +- Declares: `createConnection` + +## Item 3: Stmt 1, `ImportOfModule` + +```js +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; + +``` + +- Hoisted +- Side effects + +## Item 4: Stmt 1, `ImportBinding(0)` + +```js +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; + +``` + +- Hoisted +- Declares: `parseStackTrace` + +## Item 5: Stmt 2, `ImportOfModule` + +```js +import { getProperError } from "./error"; + +``` + +- Hoisted +- Side effects + +## Item 6: Stmt 2, `ImportBinding(0)` + +```js +import { getProperError } from "./error"; + +``` + +- Hoisted +- Declares: `getProperError` + +## Item 7: Stmt 3, `Normal` + +```js +export function structuredError(e) { + e = getProperError(e); + return { + name: e.name, + message: e.message, + stack: typeof e.stack === "string" ? parseStackTrace(e.stack) : [] + }; +} + +``` + +- Hoisted +- Declares: `structuredError` +- Reads (eventual): `getProperError`, `parseStackTrace` +- Write: `structuredError` + +## Item 8: Stmt 4, `Normal` + +```js +function createIpc(port) { + const socket = createConnection(port, "127.0.0.1"); + const packetQueue = []; + const recvPromiseResolveQueue = []; + function pushPacket(packet) { + const recvPromiseResolve = recvPromiseResolveQueue.shift(); + if (recvPromiseResolve != null) { + recvPromiseResolve(JSON.parse(packet.toString("utf8"))); + } else { + packetQueue.push(packet); + } + } + let state = { + type: "waiting" + }; + let buffer = Buffer.alloc(0); + socket.once("connect", ()=>{ + socket.on("data", (chunk)=>{ + buffer = Buffer.concat([ + buffer, + chunk + ]); + loop: while(true){ + switch(state.type){ + case "waiting": + { + if (buffer.length >= 4) { + const length = buffer.readUInt32BE(0); + buffer = buffer.subarray(4); + state = { + type: "packet", + length + }; + } else { + break loop; + } + break; + } + case "packet": + { + if (buffer.length >= state.length) { + const packet = buffer.subarray(0, state.length); + buffer = buffer.subarray(state.length); + state = { + type: "waiting" + }; + pushPacket(packet); + } else { + break loop; + } + break; + } + } + } + }); + }); + socket.once("close", ()=>{ + process.exit(0); + }); + function send(message) { + const packet = Buffer.from(JSON.stringify(message), "utf8"); + const length = Buffer.alloc(4); + length.writeUInt32BE(packet.length); + socket.write(length); + return new Promise((resolve, reject)=>{ + socket.write(packet, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + function sendReady() { + const length = Buffer.from([ + 0, + 0, + 0, + 0 + ]); + return new Promise((resolve, reject)=>{ + socket.write(length, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + return { + async recv () { + const packet = packetQueue.shift(); + if (packet != null) { + return JSON.parse(packet.toString("utf8")); + } + const result = await new Promise((resolve)=>{ + recvPromiseResolveQueue.push((result)=>{ + resolve(result); + }); + }); + return result; + }, + send (message) { + return send(message); + }, + sendReady, + async sendError (error) { + try { + await send({ + type: "error", + ...structuredError(error) + }); + } catch (err) { + console.error("failed to send error back to rust:", err); + process.exit(1); + } + process.exit(0); + } + }; +} + +``` + +- Hoisted +- Declares: `createIpc` +- Reads (eventual): `createConnection`, `loop`, `structuredError` +- Write: `createIpc` + +## Item 9: Stmt 5, `VarDeclarator(0)` + +```js +const PORT = process.argv[2]; + +``` + +- Side effects +- Declares: `PORT` +- Write: `PORT` + +## Item 10: Stmt 6, `VarDeclarator(0)` + +```js +export const IPC = createIpc(parseInt(PORT, 10)); + +``` + +- Side effects +- Declares: `IPC` +- Reads: `createIpc`, `PORT` +- Write: `IPC` + +## Item 11: Stmt 7, `Normal` + +```js +process.on("uncaughtException", (err)=>{ + IPC.sendError(err); +}); + +``` + +- Side effects +- Reads (eventual): `IPC` +- Write (eventual): `IPC` + +## Item 12: Stmt 8, `VarDeclarator(0)` + +```js +const improveConsole = (name, stream, addStack)=>{ + const original = console[name]; + const stdio = process[stream]; + console[name] = (...args)=>{ + stdio.write(`TURBOPACK_OUTPUT_B\n`); + original(...args); + if (addStack) { + const stack = new Error().stack?.replace(/^.+\n.+\n/, "") + "\n"; + stdio.write("TURBOPACK_OUTPUT_S\n"); + stdio.write(stack); + } + stdio.write("TURBOPACK_OUTPUT_E\n"); + }; +}; + +``` + +- Declares: `improveConsole` +- Write: `improveConsole` + +## Item 13: Stmt 9, `Normal` + +```js +improveConsole("error", "stderr", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 14: Stmt 10, `Normal` + +```js +improveConsole("warn", "stderr", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 15: Stmt 11, `Normal` + +```js +improveConsole("count", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 16: Stmt 12, `Normal` + +```js +improveConsole("trace", "stderr", false); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 17: Stmt 13, `Normal` + +```js +improveConsole("log", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 18: Stmt 14, `Normal` + +```js +improveConsole("group", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 19: Stmt 15, `Normal` + +```js +improveConsole("groupCollapsed", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 20: Stmt 16, `Normal` + +```js +improveConsole("table", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 21: Stmt 17, `Normal` + +```js +improveConsole("debug", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 22: Stmt 18, `Normal` + +```js +improveConsole("info", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 23: Stmt 19, `Normal` + +```js +improveConsole("dir", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 24: Stmt 20, `Normal` + +```js +improveConsole("dirxml", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 25: Stmt 21, `Normal` + +```js +improveConsole("timeEnd", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 26: Stmt 22, `Normal` + +```js +improveConsole("timeLog", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 27: Stmt 23, `Normal` + +```js +improveConsole("timeStamp", "stdout", true); + +``` + +- Side effects +- Reads: `improveConsole` + +## Item 28: Stmt 24, `Normal` + +```js +improveConsole("assert", "stderr", true); + +``` + +- Side effects +- Reads: `improveConsole` + +# Phase 1 +```mermaid +graph TD + Item1; + Item4; + Item2; + Item5; + Item3; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item16; + Item17; + Item18; + Item19; + Item20; + Item21; + Item22; + Item23; + Item24; + Item25; + Item26; + Item27; + Item28; + Item29; + Item29["ModuleEvaluation"]; + Item30; + Item30["export structuredError"]; + Item31; + Item31["export IPC"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; +``` +# Phase 2 +```mermaid +graph TD + Item1; + Item4; + Item2; + Item5; + Item3; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item16; + Item17; + Item18; + Item19; + Item20; + Item21; + Item22; + Item23; + Item24; + Item25; + Item26; + Item27; + Item28; + Item29; + Item29["ModuleEvaluation"]; + Item30; + Item30["export structuredError"]; + Item31; + Item31["export IPC"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 -.-> Item6; + Item9 -.-> Item5; + Item9 -.-> Item4; + Item9 -.-> Item7; + Item10 --> Item8; + Item10 --> Item9; + Item10 --> Item1; + Item10 --> Item2; + Item10 --> Item3; + Item10 -.-> Item6; + Item10 -.-> Item5; + Item10 -.-> Item4; + Item10 -.-> Item7; + Item11 --> Item1; + Item11 --> Item2; + Item11 --> Item3; + Item11 --> Item9; + Item11 --> Item10; + Item11 -.-> Item6; + Item11 -.-> Item5; + Item11 -.-> Item4; + Item11 -.-> Item7; + Item13 --> Item12; + Item13 --> Item1; + Item13 --> Item2; + Item13 --> Item3; + Item13 --> Item9; + Item13 --> Item10; + Item13 --> Item11; + Item13 -.-> Item6; + Item13 -.-> Item5; + Item13 -.-> Item4; + Item13 -.-> Item7; + Item14 --> Item12; + Item14 --> Item1; + Item14 --> Item2; + Item14 --> Item3; + Item14 --> Item9; + Item14 --> Item10; + Item14 --> Item11; + Item14 --> Item13; + Item14 -.-> Item6; + Item14 -.-> Item5; + Item14 -.-> Item4; + Item14 -.-> Item7; + Item15 --> Item12; + Item15 --> Item1; + Item15 --> Item2; + Item15 --> Item3; + Item15 --> Item9; + Item15 --> Item10; + Item15 --> Item11; + Item15 --> Item13; + Item15 --> Item14; + Item15 -.-> Item6; + Item15 -.-> Item5; + Item15 -.-> Item4; + Item15 -.-> Item7; + Item16 --> Item12; + Item16 --> Item1; + Item16 --> Item2; + Item16 --> Item3; + Item16 --> Item9; + Item16 --> Item10; + Item16 --> Item11; + Item16 --> Item13; + Item16 --> Item14; + Item16 --> Item15; + Item16 -.-> Item6; + Item16 -.-> Item5; + Item16 -.-> Item4; + Item16 -.-> Item7; + Item17 --> Item12; + Item17 --> Item1; + Item17 --> Item2; + Item17 --> Item3; + Item17 --> Item9; + Item17 --> Item10; + Item17 --> Item11; + Item17 --> Item13; + Item17 --> Item14; + Item17 --> Item15; + Item17 --> Item16; + Item17 -.-> Item6; + Item17 -.-> Item5; + Item17 -.-> Item4; + Item17 -.-> Item7; + Item18 --> Item12; + Item18 --> Item1; + Item18 --> Item2; + Item18 --> Item3; + Item18 --> Item9; + Item18 --> Item10; + Item18 --> Item11; + Item18 --> Item13; + Item18 --> Item14; + Item18 --> Item15; + Item18 --> Item16; + Item18 --> Item17; + Item18 -.-> Item6; + Item18 -.-> Item5; + Item18 -.-> Item4; + Item18 -.-> Item7; + Item19 --> Item12; + Item19 --> Item1; + Item19 --> Item2; + Item19 --> Item3; + Item19 --> Item9; + Item19 --> Item10; + Item19 --> Item11; + Item19 --> Item13; + Item19 --> Item14; + Item19 --> Item15; + Item19 --> Item16; + Item19 --> Item17; + Item19 --> Item18; + Item19 -.-> Item6; + Item19 -.-> Item5; + Item19 -.-> Item4; + Item19 -.-> Item7; + Item20 --> Item12; + Item20 --> Item1; + Item20 --> Item2; + Item20 --> Item3; + Item20 --> Item9; + Item20 --> Item10; + Item20 --> Item11; + Item20 --> Item13; + Item20 --> Item14; + Item20 --> Item15; + Item20 --> Item16; + Item20 --> Item17; + Item20 --> Item18; + Item20 --> Item19; + Item20 -.-> Item6; + Item20 -.-> Item5; + Item20 -.-> Item4; + Item20 -.-> Item7; + Item21 --> Item12; + Item21 --> Item1; + Item21 --> Item2; + Item21 --> Item3; + Item21 --> Item9; + Item21 --> Item10; + Item21 --> Item11; + Item21 --> Item13; + Item21 --> Item14; + Item21 --> Item15; + Item21 --> Item16; + Item21 --> Item17; + Item21 --> Item18; + Item21 --> Item19; + Item21 --> Item20; + Item21 -.-> Item6; + Item21 -.-> Item5; + Item21 -.-> Item4; + Item21 -.-> Item7; + Item22 --> Item12; + Item22 --> Item1; + Item22 --> Item2; + Item22 --> Item3; + Item22 --> Item9; + Item22 --> Item10; + Item22 --> Item11; + Item22 --> Item13; + Item22 --> Item14; + Item22 --> Item15; + Item22 --> Item16; + Item22 --> Item17; + Item22 --> Item18; + Item22 --> Item19; + Item22 --> Item20; + Item22 --> Item21; + Item22 -.-> Item6; + Item22 -.-> Item5; + Item22 -.-> Item4; + Item22 -.-> Item7; + Item23 --> Item12; + Item23 --> Item1; + Item23 --> Item2; + Item23 --> Item3; + Item23 --> Item9; + Item23 --> Item10; + Item23 --> Item11; + Item23 --> Item13; + Item23 --> Item14; + Item23 --> Item15; + Item23 --> Item16; + Item23 --> Item17; + Item23 --> Item18; + Item23 --> Item19; + Item23 --> Item20; + Item23 --> Item21; + Item23 --> Item22; + Item23 -.-> Item6; + Item23 -.-> Item5; + Item23 -.-> Item4; + Item23 -.-> Item7; + Item24 --> Item12; + Item24 --> Item1; + Item24 --> Item2; + Item24 --> Item3; + Item24 --> Item9; + Item24 --> Item10; + Item24 --> Item11; + Item24 --> Item13; + Item24 --> Item14; + Item24 --> Item15; + Item24 --> Item16; + Item24 --> Item17; + Item24 --> Item18; + Item24 --> Item19; + Item24 --> Item20; + Item24 --> Item21; + Item24 --> Item22; + Item24 --> Item23; + Item24 -.-> Item6; + Item24 -.-> Item5; + Item24 -.-> Item4; + Item24 -.-> Item7; + Item25 --> Item12; + Item25 --> Item1; + Item25 --> Item2; + Item25 --> Item3; + Item25 --> Item9; + Item25 --> Item10; + Item25 --> Item11; + Item25 --> Item13; + Item25 --> Item14; + Item25 --> Item15; + Item25 --> Item16; + Item25 --> Item17; + Item25 --> Item18; + Item25 --> Item19; + Item25 --> Item20; + Item25 --> Item21; + Item25 --> Item22; + Item25 --> Item23; + Item25 --> Item24; + Item25 -.-> Item6; + Item25 -.-> Item5; + Item25 -.-> Item4; + Item25 -.-> Item7; + Item26 --> Item12; + Item26 --> Item1; + Item26 --> Item2; + Item26 --> Item3; + Item26 --> Item9; + Item26 --> Item10; + Item26 --> Item11; + Item26 --> Item13; + Item26 --> Item14; + Item26 --> Item15; + Item26 --> Item16; + Item26 --> Item17; + Item26 --> Item18; + Item26 --> Item19; + Item26 --> Item20; + Item26 --> Item21; + Item26 --> Item22; + Item26 --> Item23; + Item26 --> Item24; + Item26 --> Item25; + Item26 -.-> Item6; + Item26 -.-> Item5; + Item26 -.-> Item4; + Item26 -.-> Item7; + Item27 --> Item12; + Item27 --> Item1; + Item27 --> Item2; + Item27 --> Item3; + Item27 --> Item9; + Item27 --> Item10; + Item27 --> Item11; + Item27 --> Item13; + Item27 --> Item14; + Item27 --> Item15; + Item27 --> Item16; + Item27 --> Item17; + Item27 --> Item18; + Item27 --> Item19; + Item27 --> Item20; + Item27 --> Item21; + Item27 --> Item22; + Item27 --> Item23; + Item27 --> Item24; + Item27 --> Item25; + Item27 --> Item26; + Item27 -.-> Item6; + Item27 -.-> Item5; + Item27 -.-> Item4; + Item27 -.-> Item7; + Item28 --> Item12; + Item28 --> Item1; + Item28 --> Item2; + Item28 --> Item3; + Item28 --> Item9; + Item28 --> Item10; + Item28 --> Item11; + Item28 --> Item13; + Item28 --> Item14; + Item28 --> Item15; + Item28 --> Item16; + Item28 --> Item17; + Item28 --> Item18; + Item28 --> Item19; + Item28 --> Item20; + Item28 --> Item21; + Item28 --> Item22; + Item28 --> Item23; + Item28 --> Item24; + Item28 --> Item25; + Item28 --> Item26; + Item28 --> Item27; + Item28 -.-> Item6; + Item28 -.-> Item5; + Item28 -.-> Item4; + Item28 -.-> Item7; +``` +# Phase 3 +```mermaid +graph TD + Item1; + Item4; + Item2; + Item5; + Item3; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item16; + Item17; + Item18; + Item19; + Item20; + Item21; + Item22; + Item23; + Item24; + Item25; + Item26; + Item27; + Item28; + Item29; + Item29["ModuleEvaluation"]; + Item30; + Item30["export structuredError"]; + Item31; + Item31["export IPC"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 -.-> Item6; + Item9 -.-> Item5; + Item9 -.-> Item4; + Item9 -.-> Item7; + Item10 --> Item8; + Item10 --> Item9; + Item10 --> Item1; + Item10 --> Item2; + Item10 --> Item3; + Item10 -.-> Item6; + Item10 -.-> Item5; + Item10 -.-> Item4; + Item10 -.-> Item7; + Item11 --> Item1; + Item11 --> Item2; + Item11 --> Item3; + Item11 --> Item9; + Item11 --> Item10; + Item11 -.-> Item6; + Item11 -.-> Item5; + Item11 -.-> Item4; + Item11 -.-> Item7; + Item13 --> Item12; + Item13 --> Item1; + Item13 --> Item2; + Item13 --> Item3; + Item13 --> Item9; + Item13 --> Item10; + Item13 --> Item11; + Item13 -.-> Item6; + Item13 -.-> Item5; + Item13 -.-> Item4; + Item13 -.-> Item7; + Item14 --> Item12; + Item14 --> Item1; + Item14 --> Item2; + Item14 --> Item3; + Item14 --> Item9; + Item14 --> Item10; + Item14 --> Item11; + Item14 --> Item13; + Item14 -.-> Item6; + Item14 -.-> Item5; + Item14 -.-> Item4; + Item14 -.-> Item7; + Item15 --> Item12; + Item15 --> Item1; + Item15 --> Item2; + Item15 --> Item3; + Item15 --> Item9; + Item15 --> Item10; + Item15 --> Item11; + Item15 --> Item13; + Item15 --> Item14; + Item15 -.-> Item6; + Item15 -.-> Item5; + Item15 -.-> Item4; + Item15 -.-> Item7; + Item16 --> Item12; + Item16 --> Item1; + Item16 --> Item2; + Item16 --> Item3; + Item16 --> Item9; + Item16 --> Item10; + Item16 --> Item11; + Item16 --> Item13; + Item16 --> Item14; + Item16 --> Item15; + Item16 -.-> Item6; + Item16 -.-> Item5; + Item16 -.-> Item4; + Item16 -.-> Item7; + Item17 --> Item12; + Item17 --> Item1; + Item17 --> Item2; + Item17 --> Item3; + Item17 --> Item9; + Item17 --> Item10; + Item17 --> Item11; + Item17 --> Item13; + Item17 --> Item14; + Item17 --> Item15; + Item17 --> Item16; + Item17 -.-> Item6; + Item17 -.-> Item5; + Item17 -.-> Item4; + Item17 -.-> Item7; + Item18 --> Item12; + Item18 --> Item1; + Item18 --> Item2; + Item18 --> Item3; + Item18 --> Item9; + Item18 --> Item10; + Item18 --> Item11; + Item18 --> Item13; + Item18 --> Item14; + Item18 --> Item15; + Item18 --> Item16; + Item18 --> Item17; + Item18 -.-> Item6; + Item18 -.-> Item5; + Item18 -.-> Item4; + Item18 -.-> Item7; + Item19 --> Item12; + Item19 --> Item1; + Item19 --> Item2; + Item19 --> Item3; + Item19 --> Item9; + Item19 --> Item10; + Item19 --> Item11; + Item19 --> Item13; + Item19 --> Item14; + Item19 --> Item15; + Item19 --> Item16; + Item19 --> Item17; + Item19 --> Item18; + Item19 -.-> Item6; + Item19 -.-> Item5; + Item19 -.-> Item4; + Item19 -.-> Item7; + Item20 --> Item12; + Item20 --> Item1; + Item20 --> Item2; + Item20 --> Item3; + Item20 --> Item9; + Item20 --> Item10; + Item20 --> Item11; + Item20 --> Item13; + Item20 --> Item14; + Item20 --> Item15; + Item20 --> Item16; + Item20 --> Item17; + Item20 --> Item18; + Item20 --> Item19; + Item20 -.-> Item6; + Item20 -.-> Item5; + Item20 -.-> Item4; + Item20 -.-> Item7; + Item21 --> Item12; + Item21 --> Item1; + Item21 --> Item2; + Item21 --> Item3; + Item21 --> Item9; + Item21 --> Item10; + Item21 --> Item11; + Item21 --> Item13; + Item21 --> Item14; + Item21 --> Item15; + Item21 --> Item16; + Item21 --> Item17; + Item21 --> Item18; + Item21 --> Item19; + Item21 --> Item20; + Item21 -.-> Item6; + Item21 -.-> Item5; + Item21 -.-> Item4; + Item21 -.-> Item7; + Item22 --> Item12; + Item22 --> Item1; + Item22 --> Item2; + Item22 --> Item3; + Item22 --> Item9; + Item22 --> Item10; + Item22 --> Item11; + Item22 --> Item13; + Item22 --> Item14; + Item22 --> Item15; + Item22 --> Item16; + Item22 --> Item17; + Item22 --> Item18; + Item22 --> Item19; + Item22 --> Item20; + Item22 --> Item21; + Item22 -.-> Item6; + Item22 -.-> Item5; + Item22 -.-> Item4; + Item22 -.-> Item7; + Item23 --> Item12; + Item23 --> Item1; + Item23 --> Item2; + Item23 --> Item3; + Item23 --> Item9; + Item23 --> Item10; + Item23 --> Item11; + Item23 --> Item13; + Item23 --> Item14; + Item23 --> Item15; + Item23 --> Item16; + Item23 --> Item17; + Item23 --> Item18; + Item23 --> Item19; + Item23 --> Item20; + Item23 --> Item21; + Item23 --> Item22; + Item23 -.-> Item6; + Item23 -.-> Item5; + Item23 -.-> Item4; + Item23 -.-> Item7; + Item24 --> Item12; + Item24 --> Item1; + Item24 --> Item2; + Item24 --> Item3; + Item24 --> Item9; + Item24 --> Item10; + Item24 --> Item11; + Item24 --> Item13; + Item24 --> Item14; + Item24 --> Item15; + Item24 --> Item16; + Item24 --> Item17; + Item24 --> Item18; + Item24 --> Item19; + Item24 --> Item20; + Item24 --> Item21; + Item24 --> Item22; + Item24 --> Item23; + Item24 -.-> Item6; + Item24 -.-> Item5; + Item24 -.-> Item4; + Item24 -.-> Item7; + Item25 --> Item12; + Item25 --> Item1; + Item25 --> Item2; + Item25 --> Item3; + Item25 --> Item9; + Item25 --> Item10; + Item25 --> Item11; + Item25 --> Item13; + Item25 --> Item14; + Item25 --> Item15; + Item25 --> Item16; + Item25 --> Item17; + Item25 --> Item18; + Item25 --> Item19; + Item25 --> Item20; + Item25 --> Item21; + Item25 --> Item22; + Item25 --> Item23; + Item25 --> Item24; + Item25 -.-> Item6; + Item25 -.-> Item5; + Item25 -.-> Item4; + Item25 -.-> Item7; + Item26 --> Item12; + Item26 --> Item1; + Item26 --> Item2; + Item26 --> Item3; + Item26 --> Item9; + Item26 --> Item10; + Item26 --> Item11; + Item26 --> Item13; + Item26 --> Item14; + Item26 --> Item15; + Item26 --> Item16; + Item26 --> Item17; + Item26 --> Item18; + Item26 --> Item19; + Item26 --> Item20; + Item26 --> Item21; + Item26 --> Item22; + Item26 --> Item23; + Item26 --> Item24; + Item26 --> Item25; + Item26 -.-> Item6; + Item26 -.-> Item5; + Item26 -.-> Item4; + Item26 -.-> Item7; + Item27 --> Item12; + Item27 --> Item1; + Item27 --> Item2; + Item27 --> Item3; + Item27 --> Item9; + Item27 --> Item10; + Item27 --> Item11; + Item27 --> Item13; + Item27 --> Item14; + Item27 --> Item15; + Item27 --> Item16; + Item27 --> Item17; + Item27 --> Item18; + Item27 --> Item19; + Item27 --> Item20; + Item27 --> Item21; + Item27 --> Item22; + Item27 --> Item23; + Item27 --> Item24; + Item27 --> Item25; + Item27 --> Item26; + Item27 -.-> Item6; + Item27 -.-> Item5; + Item27 -.-> Item4; + Item27 -.-> Item7; + Item28 --> Item12; + Item28 --> Item1; + Item28 --> Item2; + Item28 --> Item3; + Item28 --> Item9; + Item28 --> Item10; + Item28 --> Item11; + Item28 --> Item13; + Item28 --> Item14; + Item28 --> Item15; + Item28 --> Item16; + Item28 --> Item17; + Item28 --> Item18; + Item28 --> Item19; + Item28 --> Item20; + Item28 --> Item21; + Item28 --> Item22; + Item28 --> Item23; + Item28 --> Item24; + Item28 --> Item25; + Item28 --> Item26; + Item28 --> Item27; + Item28 -.-> Item6; + Item28 -.-> Item5; + Item28 -.-> Item4; + Item28 -.-> Item7; + Item7 --> Item6; + Item7 --> Item5; + Item8 --> Item4; + Item8 --> Item7; +``` +# Phase 4 +```mermaid +graph TD + Item1; + Item4; + Item2; + Item5; + Item3; + Item6; + Item7; + Item8; + Item9; + Item10; + Item11; + Item12; + Item13; + Item14; + Item15; + Item16; + Item17; + Item18; + Item19; + Item20; + Item21; + Item22; + Item23; + Item24; + Item25; + Item26; + Item27; + Item28; + Item29; + Item29["ModuleEvaluation"]; + Item30; + Item30["export structuredError"]; + Item31; + Item31["export IPC"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item9 --> Item1; + Item9 --> Item2; + Item9 --> Item3; + Item9 -.-> Item6; + Item9 -.-> Item5; + Item9 -.-> Item4; + Item9 -.-> Item7; + Item10 --> Item8; + Item10 --> Item9; + Item10 --> Item1; + Item10 --> Item2; + Item10 --> Item3; + Item10 -.-> Item6; + Item10 -.-> Item5; + Item10 -.-> Item4; + Item10 -.-> Item7; + Item11 --> Item1; + Item11 --> Item2; + Item11 --> Item3; + Item11 --> Item9; + Item11 --> Item10; + Item11 -.-> Item6; + Item11 -.-> Item5; + Item11 -.-> Item4; + Item11 -.-> Item7; + Item13 --> Item12; + Item13 --> Item1; + Item13 --> Item2; + Item13 --> Item3; + Item13 --> Item9; + Item13 --> Item10; + Item13 --> Item11; + Item13 -.-> Item6; + Item13 -.-> Item5; + Item13 -.-> Item4; + Item13 -.-> Item7; + Item14 --> Item12; + Item14 --> Item1; + Item14 --> Item2; + Item14 --> Item3; + Item14 --> Item9; + Item14 --> Item10; + Item14 --> Item11; + Item14 --> Item13; + Item14 -.-> Item6; + Item14 -.-> Item5; + Item14 -.-> Item4; + Item14 -.-> Item7; + Item15 --> Item12; + Item15 --> Item1; + Item15 --> Item2; + Item15 --> Item3; + Item15 --> Item9; + Item15 --> Item10; + Item15 --> Item11; + Item15 --> Item13; + Item15 --> Item14; + Item15 -.-> Item6; + Item15 -.-> Item5; + Item15 -.-> Item4; + Item15 -.-> Item7; + Item16 --> Item12; + Item16 --> Item1; + Item16 --> Item2; + Item16 --> Item3; + Item16 --> Item9; + Item16 --> Item10; + Item16 --> Item11; + Item16 --> Item13; + Item16 --> Item14; + Item16 --> Item15; + Item16 -.-> Item6; + Item16 -.-> Item5; + Item16 -.-> Item4; + Item16 -.-> Item7; + Item17 --> Item12; + Item17 --> Item1; + Item17 --> Item2; + Item17 --> Item3; + Item17 --> Item9; + Item17 --> Item10; + Item17 --> Item11; + Item17 --> Item13; + Item17 --> Item14; + Item17 --> Item15; + Item17 --> Item16; + Item17 -.-> Item6; + Item17 -.-> Item5; + Item17 -.-> Item4; + Item17 -.-> Item7; + Item18 --> Item12; + Item18 --> Item1; + Item18 --> Item2; + Item18 --> Item3; + Item18 --> Item9; + Item18 --> Item10; + Item18 --> Item11; + Item18 --> Item13; + Item18 --> Item14; + Item18 --> Item15; + Item18 --> Item16; + Item18 --> Item17; + Item18 -.-> Item6; + Item18 -.-> Item5; + Item18 -.-> Item4; + Item18 -.-> Item7; + Item19 --> Item12; + Item19 --> Item1; + Item19 --> Item2; + Item19 --> Item3; + Item19 --> Item9; + Item19 --> Item10; + Item19 --> Item11; + Item19 --> Item13; + Item19 --> Item14; + Item19 --> Item15; + Item19 --> Item16; + Item19 --> Item17; + Item19 --> Item18; + Item19 -.-> Item6; + Item19 -.-> Item5; + Item19 -.-> Item4; + Item19 -.-> Item7; + Item20 --> Item12; + Item20 --> Item1; + Item20 --> Item2; + Item20 --> Item3; + Item20 --> Item9; + Item20 --> Item10; + Item20 --> Item11; + Item20 --> Item13; + Item20 --> Item14; + Item20 --> Item15; + Item20 --> Item16; + Item20 --> Item17; + Item20 --> Item18; + Item20 --> Item19; + Item20 -.-> Item6; + Item20 -.-> Item5; + Item20 -.-> Item4; + Item20 -.-> Item7; + Item21 --> Item12; + Item21 --> Item1; + Item21 --> Item2; + Item21 --> Item3; + Item21 --> Item9; + Item21 --> Item10; + Item21 --> Item11; + Item21 --> Item13; + Item21 --> Item14; + Item21 --> Item15; + Item21 --> Item16; + Item21 --> Item17; + Item21 --> Item18; + Item21 --> Item19; + Item21 --> Item20; + Item21 -.-> Item6; + Item21 -.-> Item5; + Item21 -.-> Item4; + Item21 -.-> Item7; + Item22 --> Item12; + Item22 --> Item1; + Item22 --> Item2; + Item22 --> Item3; + Item22 --> Item9; + Item22 --> Item10; + Item22 --> Item11; + Item22 --> Item13; + Item22 --> Item14; + Item22 --> Item15; + Item22 --> Item16; + Item22 --> Item17; + Item22 --> Item18; + Item22 --> Item19; + Item22 --> Item20; + Item22 --> Item21; + Item22 -.-> Item6; + Item22 -.-> Item5; + Item22 -.-> Item4; + Item22 -.-> Item7; + Item23 --> Item12; + Item23 --> Item1; + Item23 --> Item2; + Item23 --> Item3; + Item23 --> Item9; + Item23 --> Item10; + Item23 --> Item11; + Item23 --> Item13; + Item23 --> Item14; + Item23 --> Item15; + Item23 --> Item16; + Item23 --> Item17; + Item23 --> Item18; + Item23 --> Item19; + Item23 --> Item20; + Item23 --> Item21; + Item23 --> Item22; + Item23 -.-> Item6; + Item23 -.-> Item5; + Item23 -.-> Item4; + Item23 -.-> Item7; + Item24 --> Item12; + Item24 --> Item1; + Item24 --> Item2; + Item24 --> Item3; + Item24 --> Item9; + Item24 --> Item10; + Item24 --> Item11; + Item24 --> Item13; + Item24 --> Item14; + Item24 --> Item15; + Item24 --> Item16; + Item24 --> Item17; + Item24 --> Item18; + Item24 --> Item19; + Item24 --> Item20; + Item24 --> Item21; + Item24 --> Item22; + Item24 --> Item23; + Item24 -.-> Item6; + Item24 -.-> Item5; + Item24 -.-> Item4; + Item24 -.-> Item7; + Item25 --> Item12; + Item25 --> Item1; + Item25 --> Item2; + Item25 --> Item3; + Item25 --> Item9; + Item25 --> Item10; + Item25 --> Item11; + Item25 --> Item13; + Item25 --> Item14; + Item25 --> Item15; + Item25 --> Item16; + Item25 --> Item17; + Item25 --> Item18; + Item25 --> Item19; + Item25 --> Item20; + Item25 --> Item21; + Item25 --> Item22; + Item25 --> Item23; + Item25 --> Item24; + Item25 -.-> Item6; + Item25 -.-> Item5; + Item25 -.-> Item4; + Item25 -.-> Item7; + Item26 --> Item12; + Item26 --> Item1; + Item26 --> Item2; + Item26 --> Item3; + Item26 --> Item9; + Item26 --> Item10; + Item26 --> Item11; + Item26 --> Item13; + Item26 --> Item14; + Item26 --> Item15; + Item26 --> Item16; + Item26 --> Item17; + Item26 --> Item18; + Item26 --> Item19; + Item26 --> Item20; + Item26 --> Item21; + Item26 --> Item22; + Item26 --> Item23; + Item26 --> Item24; + Item26 --> Item25; + Item26 -.-> Item6; + Item26 -.-> Item5; + Item26 -.-> Item4; + Item26 -.-> Item7; + Item27 --> Item12; + Item27 --> Item1; + Item27 --> Item2; + Item27 --> Item3; + Item27 --> Item9; + Item27 --> Item10; + Item27 --> Item11; + Item27 --> Item13; + Item27 --> Item14; + Item27 --> Item15; + Item27 --> Item16; + Item27 --> Item17; + Item27 --> Item18; + Item27 --> Item19; + Item27 --> Item20; + Item27 --> Item21; + Item27 --> Item22; + Item27 --> Item23; + Item27 --> Item24; + Item27 --> Item25; + Item27 --> Item26; + Item27 -.-> Item6; + Item27 -.-> Item5; + Item27 -.-> Item4; + Item27 -.-> Item7; + Item28 --> Item12; + Item28 --> Item1; + Item28 --> Item2; + Item28 --> Item3; + Item28 --> Item9; + Item28 --> Item10; + Item28 --> Item11; + Item28 --> Item13; + Item28 --> Item14; + Item28 --> Item15; + Item28 --> Item16; + Item28 --> Item17; + Item28 --> Item18; + Item28 --> Item19; + Item28 --> Item20; + Item28 --> Item21; + Item28 --> Item22; + Item28 --> Item23; + Item28 --> Item24; + Item28 --> Item25; + Item28 --> Item26; + Item28 --> Item27; + Item28 -.-> Item6; + Item28 -.-> Item5; + Item28 -.-> Item4; + Item28 -.-> Item7; + Item7 --> Item6; + Item7 --> Item5; + Item8 --> Item4; + Item8 --> Item7; + Item29 --> Item1; + Item29 --> Item2; + Item29 --> Item3; + Item29 --> Item9; + Item29 --> Item10; + Item29 --> Item11; + Item29 --> Item13; + Item29 --> Item14; + Item29 --> Item15; + Item29 --> Item16; + Item29 --> Item17; + Item29 --> Item18; + Item29 --> Item19; + Item29 --> Item20; + Item29 --> Item21; + Item29 --> Item22; + Item29 --> Item23; + Item29 --> Item24; + Item29 --> Item25; + Item29 --> Item26; + Item29 --> Item27; + Item29 --> Item28; + Item30 --> Item7; + Item31 --> Item10; +``` +# Final +```mermaid +graph TD + N0["Items: [ItemId(ModuleEvaluation), ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(7, Normal), ItemId(8, VarDeclarator(0)), ItemId(9, Normal), ItemId(10, Normal), ItemId(11, Normal), ItemId(12, Normal), ItemId(13, Normal), ItemId(14, Normal), ItemId(15, Normal), ItemId(16, Normal), ItemId(17, Normal), ItemId(18, Normal), ItemId(19, Normal), ItemId(20, Normal), ItemId(21, Normal), ItemId(22, Normal), ItemId(23, Normal), ItemId(24, Normal)]"]; + N1["Items: [ItemId(Export(("structuredError", #2), "structuredError"))]"]; + N2["Items: [ItemId(Export(("IPC", #2), "IPC"))]"]; + N3["Items: [ItemId(0, ImportOfModule)]"]; + N4["Items: [ItemId(1, ImportOfModule)]"]; + N5["Items: [ItemId(2, ImportOfModule)]"]; + N6["Items: [ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(3, Normal)]"]; + N7["Items: [ItemId(0, ImportBinding(0)), ItemId(4, Normal)]"]; + N8["Items: [ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(5, VarDeclarator(0))]"]; + N9["Items: [ItemId(0, ImportBinding(0)), ItemId(1, ImportBinding(0)), ItemId(2, ImportBinding(0)), ItemId(6, VarDeclarator(0))]"]; + N0 --> N3; + N0 --> N4; + N0 --> N5; + N0 --> N8; + N0 --> N9; + N0 --> N6; + N1 --> N6; + N2 --> N9; + N4 --> N3; + N5 --> N3; + N5 --> N4; + N6 --> N9; + N7 --> N9; + N7 --> N6; + N8 --> N3; + N8 --> N4; + N8 --> N5; + N8 --> N9; + N8 --> N6; + N9 --> N7; + N9 --> N8; + N9 --> N3; + N9 --> N4; + N9 --> N5; + N9 --> N6; +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "structuredError", + ): 1, + Export( + "IPC", + ): 2, +} +``` + + +# Modules (dev) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +"module evaluation"; +import { createConnection } from "node:net"; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; +process.on("uncaughtException", (err)=>{ + IPC.sendError(err); +}); +const improveConsole = (name, stream, addStack)=>{ + const original = console[name]; + const stdio = process[stream]; + console[name] = (...args)=>{ + stdio.write(`TURBOPACK_OUTPUT_B\n`); + original(...args); + if (addStack) { + const stack = new Error().stack?.replace(/^.+\n.+\n/, "") + "\n"; + stdio.write("TURBOPACK_OUTPUT_S\n"); + stdio.write(stack); + } + stdio.write("TURBOPACK_OUTPUT_E\n"); + }; +}; +improveConsole("error", "stderr", true); +improveConsole("warn", "stderr", true); +improveConsole("count", "stdout", true); +improveConsole("trace", "stderr", false); +improveConsole("log", "stdout", true); +improveConsole("group", "stdout", true); +improveConsole("groupCollapsed", "stdout", true); +improveConsole("table", "stdout", true); +improveConsole("debug", "stdout", true); +improveConsole("info", "stdout", true); +improveConsole("dir", "stdout", true); +improveConsole("dirxml", "stdout", true); +improveConsole("timeEnd", "stdout", true); +improveConsole("timeLog", "stdout", true); +improveConsole("timeStamp", "stdout", true); +improveConsole("assert", "stderr", true); +export { improveConsole } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 1 +```js +import { structuredError } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +export { structuredError }; + +``` +## Part 2 +```js +import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +export { IPC }; + +``` +## Part 3 +```js +import "node:net"; + +``` +## Part 4 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "../compiled/stacktrace-parser"; + +``` +## Part 5 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "./error"; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; +function structuredError(e) { + e = getProperError(e); + return { + name: e.name, + message: e.message, + stack: typeof e.stack === "string" ? parseStackTrace(e.stack) : [] + }; +} +export { structuredError } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import { structuredError } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { createConnection } from "node:net"; +function createIpc(port) { + const socket = createConnection(port, "127.0.0.1"); + const packetQueue = []; + const recvPromiseResolveQueue = []; + function pushPacket(packet) { + const recvPromiseResolve = recvPromiseResolveQueue.shift(); + if (recvPromiseResolve != null) { + recvPromiseResolve(JSON.parse(packet.toString("utf8"))); + } else { + packetQueue.push(packet); + } + } + let state = { + type: "waiting" + }; + let buffer = Buffer.alloc(0); + socket.once("connect", ()=>{ + socket.on("data", (chunk)=>{ + buffer = Buffer.concat([ + buffer, + chunk + ]); + loop: while(true){ + switch(state.type){ + case "waiting": + { + if (buffer.length >= 4) { + const length = buffer.readUInt32BE(0); + buffer = buffer.subarray(4); + state = { + type: "packet", + length + }; + } else { + break loop; + } + break; + } + case "packet": + { + if (buffer.length >= state.length) { + const packet = buffer.subarray(0, state.length); + buffer = buffer.subarray(state.length); + state = { + type: "waiting" + }; + pushPacket(packet); + } else { + break loop; + } + break; + } + } + } + }); + }); + socket.once("close", ()=>{ + process.exit(0); + }); + function send(message) { + const packet = Buffer.from(JSON.stringify(message), "utf8"); + const length = Buffer.alloc(4); + length.writeUInt32BE(packet.length); + socket.write(length); + return new Promise((resolve, reject)=>{ + socket.write(packet, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + function sendReady() { + const length = Buffer.from([ + 0, + 0, + 0, + 0 + ]); + return new Promise((resolve, reject)=>{ + socket.write(length, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + return { + async recv () { + const packet = packetQueue.shift(); + if (packet != null) { + return JSON.parse(packet.toString("utf8")); + } + const result = await new Promise((resolve)=>{ + recvPromiseResolveQueue.push((result)=>{ + resolve(result); + }); + }); + return result; + }, + send (message) { + return send(message); + }, + sendReady, + async sendError (error) { + try { + await send({ + type: "error", + ...structuredError(error) + }); + } catch (err) { + console.error("failed to send error back to rust:", err); + process.exit(1); + } + process.exit(0); + } + }; +} +export { createIpc } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { createConnection } from "node:net"; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; +const PORT = process.argv[2]; +export { PORT } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 9 +```js +import { createIpc } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import { PORT } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { createConnection } from "node:net"; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; +const IPC = createIpc(parseInt(PORT, 10)); +export { IPC } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { createConnection } from "node:net"; +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; +"module evaluation"; +process.on("uncaughtException", (err)=>{ + IPC.sendError(err); +}); +const improveConsole = (name, stream, addStack)=>{ + const original = console[name]; + const stdio = process[stream]; + console[name] = (...args)=>{ + stdio.write(`TURBOPACK_OUTPUT_B\n`); + original(...args); + if (addStack) { + const stack = new Error().stack?.replace(/^.+\n.+\n/, "") + "\n"; + stdio.write("TURBOPACK_OUTPUT_S\n"); + stdio.write(stack); + } + stdio.write("TURBOPACK_OUTPUT_E\n"); + }; +}; +improveConsole("error", "stderr", true); +improveConsole("warn", "stderr", true); +improveConsole("count", "stdout", true); +improveConsole("trace", "stderr", false); +improveConsole("log", "stdout", true); +improveConsole("group", "stdout", true); +improveConsole("groupCollapsed", "stdout", true); +improveConsole("table", "stdout", true); +improveConsole("debug", "stdout", true); +improveConsole("info", "stdout", true); +improveConsole("dir", "stdout", true); +improveConsole("dirxml", "stdout", true); +improveConsole("timeEnd", "stdout", true); +improveConsole("timeLog", "stdout", true); +improveConsole("timeStamp", "stdout", true); +improveConsole("assert", "stderr", true); +export { improveConsole } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "structuredError", + ): 1, + Export( + "IPC", + ): 2, +} +``` + + +# Modules (prod) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +"module evaluation"; +process.on("uncaughtException", (err)=>{ + IPC.sendError(err); +}); +const improveConsole = (name, stream, addStack)=>{ + const original = console[name]; + const stdio = process[stream]; + console[name] = (...args)=>{ + stdio.write(`TURBOPACK_OUTPUT_B\n`); + original(...args); + if (addStack) { + const stack = new Error().stack?.replace(/^.+\n.+\n/, "") + "\n"; + stdio.write("TURBOPACK_OUTPUT_S\n"); + stdio.write(stack); + } + stdio.write("TURBOPACK_OUTPUT_E\n"); + }; +}; +improveConsole("error", "stderr", true); +improveConsole("warn", "stderr", true); +improveConsole("count", "stdout", true); +improveConsole("trace", "stderr", false); +improveConsole("log", "stdout", true); +improveConsole("group", "stdout", true); +improveConsole("groupCollapsed", "stdout", true); +improveConsole("table", "stdout", true); +improveConsole("debug", "stdout", true); +improveConsole("info", "stdout", true); +improveConsole("dir", "stdout", true); +improveConsole("dirxml", "stdout", true); +improveConsole("timeEnd", "stdout", true); +improveConsole("timeLog", "stdout", true); +improveConsole("timeStamp", "stdout", true); +improveConsole("assert", "stderr", true); +export { improveConsole } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 1 +```js +import { structuredError } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +export { structuredError }; + +``` +## Part 2 +```js +import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +export { IPC }; + +``` +## Part 3 +```js +import "node:net"; + +``` +## Part 4 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "../compiled/stacktrace-parser"; + +``` +## Part 5 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "./error"; + +``` +## Part 6 +```js +import { parse as parseStackTrace } from "../compiled/stacktrace-parser"; +import { getProperError } from "./error"; +function structuredError(e) { + e = getProperError(e); + return { + name: e.name, + message: e.message, + stack: typeof e.stack === "string" ? parseStackTrace(e.stack) : [] + }; +} +export { structuredError } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import { structuredError } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { createConnection } from "node:net"; +function createIpc(port) { + const socket = createConnection(port, "127.0.0.1"); + const packetQueue = []; + const recvPromiseResolveQueue = []; + function pushPacket(packet) { + const recvPromiseResolve = recvPromiseResolveQueue.shift(); + if (recvPromiseResolve != null) { + recvPromiseResolve(JSON.parse(packet.toString("utf8"))); + } else { + packetQueue.push(packet); + } + } + let state = { + type: "waiting" + }; + let buffer = Buffer.alloc(0); + socket.once("connect", ()=>{ + socket.on("data", (chunk)=>{ + buffer = Buffer.concat([ + buffer, + chunk + ]); + loop: while(true){ + switch(state.type){ + case "waiting": + { + if (buffer.length >= 4) { + const length = buffer.readUInt32BE(0); + buffer = buffer.subarray(4); + state = { + type: "packet", + length + }; + } else { + break loop; + } + break; + } + case "packet": + { + if (buffer.length >= state.length) { + const packet = buffer.subarray(0, state.length); + buffer = buffer.subarray(state.length); + state = { + type: "waiting" + }; + pushPacket(packet); + } else { + break loop; + } + break; + } + } + } + }); + }); + socket.once("close", ()=>{ + process.exit(0); + }); + function send(message) { + const packet = Buffer.from(JSON.stringify(message), "utf8"); + const length = Buffer.alloc(4); + length.writeUInt32BE(packet.length); + socket.write(length); + return new Promise((resolve, reject)=>{ + socket.write(packet, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + function sendReady() { + const length = Buffer.from([ + 0, + 0, + 0, + 0 + ]); + return new Promise((resolve, reject)=>{ + socket.write(length, (err)=>{ + process.stderr.write(`TURBOPACK_OUTPUT_D\n`); + process.stdout.write(`TURBOPACK_OUTPUT_D\n`); + if (err != null) { + reject(err); + } else { + resolve(); + } + }); + }); + } + return { + async recv () { + const packet = packetQueue.shift(); + if (packet != null) { + return JSON.parse(packet.toString("utf8")); + } + const result = await new Promise((resolve)=>{ + recvPromiseResolveQueue.push((result)=>{ + resolve(result); + }); + }); + return result; + }, + send (message) { + return send(message); + }, + sendReady, + async sendError (error) { + try { + await send({ + type: "error", + ...structuredError(error) + }); + } catch (err) { + console.error("failed to send error back to rust:", err); + process.exit(1); + } + process.exit(0); + } + }; +} +export { createIpc } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const PORT = process.argv[2]; +export { PORT } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 9 +```js +import { createIpc } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import { PORT } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const IPC = createIpc(parseInt(PORT, 10)); +export { IPC } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import { IPC } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +"module evaluation"; +process.on("uncaughtException", (err)=>{ + IPC.sendError(err); +}); +const improveConsole = (name, stream, addStack)=>{ + const original = console[name]; + const stdio = process[stream]; + console[name] = (...args)=>{ + stdio.write(`TURBOPACK_OUTPUT_B\n`); + original(...args); + if (addStack) { + const stack = new Error().stack?.replace(/^.+\n.+\n/, "") + "\n"; + stdio.write("TURBOPACK_OUTPUT_S\n"); + stdio.write(stack); + } + stdio.write("TURBOPACK_OUTPUT_E\n"); + }; +}; +improveConsole("error", "stderr", true); +improveConsole("warn", "stderr", true); +improveConsole("count", "stdout", true); +improveConsole("trace", "stderr", false); +improveConsole("log", "stdout", true); +improveConsole("group", "stdout", true); +improveConsole("groupCollapsed", "stdout", true); +improveConsole("table", "stdout", true); +improveConsole("debug", "stdout", true); +improveConsole("info", "stdout", true); +improveConsole("dir", "stdout", true); +improveConsole("dirxml", "stdout", true); +improveConsole("timeEnd", "stdout", true); +improveConsole("timeLog", "stdout", true); +improveConsole("timeStamp", "stdout", true); +improveConsole("assert", "stderr", true); +export { improveConsole } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-globals/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-globals/output.md index ab622fe1df812..77cd4a23f2131 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-globals/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-globals/output.md @@ -10,7 +10,6 @@ process.turbopack = {}; ``` - Side effects -- Reads: `process` # Phase 1 ```mermaid diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/input.js b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/input.js new file mode 100644 index 0000000000000..74a6147c0837a --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/input.js @@ -0,0 +1,9 @@ +export const order = []; + +order.push("a"); +const random = Math.random(); +const shared = { random, effect: order.push("b") }; +order.push("c"); + +export const a = { shared, a: "aaaaaaaaaaa" }; +export const b = { shared, b: "bbbbbbbbbbb" }; diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/output.md new file mode 100644 index 0000000000000..7ba712da2e884 --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-2/output.md @@ -0,0 +1,528 @@ +# Items + +Count: 11 + +## Item 1: Stmt 0, `VarDeclarator(0)` + +```js +export const order = []; + +``` + +- Declares: `order` +- Write: `order` + +## Item 2: Stmt 1, `Normal` + +```js +order.push("a"); + +``` + +- Side effects +- Reads: `order` +- Write: `order` + +## Item 3: Stmt 2, `VarDeclarator(0)` + +```js +const random = Math.random(); + +``` + +- Side effects +- Declares: `random` +- Write: `random` + +## Item 4: Stmt 3, `VarDeclarator(0)` + +```js +const shared = { + random, + effect: order.push("b") +}; + +``` + +- Declares: `shared` +- Reads: `random`, `order` +- Write: `shared`, `order` + +## Item 5: Stmt 4, `Normal` + +```js +order.push("c"); + +``` + +- Side effects +- Reads: `order` +- Write: `order` + +## Item 6: Stmt 5, `VarDeclarator(0)` + +```js +export const a = { + shared, + a: "aaaaaaaaaaa" +}; + +``` + +- Declares: `a` +- Reads: `shared` +- Write: `a` + +## Item 7: Stmt 6, `VarDeclarator(0)` + +```js +export const b = { + shared, + b: "bbbbbbbbbbb" +}; + +``` + +- Declares: `b` +- Reads: `shared` +- Write: `b` + +# Phase 1 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export a"]; + Item11; + Item11["export b"]; +``` +# Phase 2 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export a"]; + Item11; + Item11["export b"]; + Item2 --> Item1; + Item3 --> Item2; + Item4 --> Item3; + Item4 --> Item2; + Item5 --> Item4; + Item5 --> Item2; + Item5 --> Item3; + Item6 --> Item4; + Item7 --> Item4; +``` +# Phase 3 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export a"]; + Item11; + Item11["export b"]; + Item2 --> Item1; + Item3 --> Item2; + Item4 --> Item3; + Item4 --> Item2; + Item5 --> Item4; + Item5 --> Item2; + Item5 --> Item3; + Item6 --> Item4; + Item7 --> Item4; +``` +# Phase 4 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export a"]; + Item11; + Item11["export b"]; + Item2 --> Item1; + Item3 --> Item2; + Item4 --> Item3; + Item4 --> Item2; + Item5 --> Item4; + Item5 --> Item2; + Item5 --> Item3; + Item6 --> Item4; + Item7 --> Item4; + Item8 --> Item2; + Item8 --> Item3; + Item8 --> Item5; + Item9 --> Item5; + Item10 --> Item6; + Item11 --> Item7; +``` +# Final +```mermaid +graph TD + N0["Items: [ItemId(ModuleEvaluation)]"]; + N1["Items: [ItemId(Export(("order", #2), "order"))]"]; + N2["Items: [ItemId(Export(("a", #2), "a")), ItemId(5, VarDeclarator(0))]"]; + N3["Items: [ItemId(Export(("b", #2), "b")), ItemId(6, VarDeclarator(0))]"]; + N4["Items: [ItemId(0, VarDeclarator(0))]"]; + N5["Items: [ItemId(1, Normal)]"]; + N6["Items: [ItemId(2, VarDeclarator(0))]"]; + N7["Items: [ItemId(3, VarDeclarator(0))]"]; + N8["Items: [ItemId(4, Normal)]"]; + N0 --> N5; + N0 --> N6; + N0 --> N8; + N1 --> N8; + N2 --> N7; + N3 --> N7; + N5 --> N4; + N6 --> N5; + N7 --> N6; + N7 --> N5; + N8 --> N7; + N8 --> N5; + N8 --> N6; +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "order", + ): 1, + Export( + "b", + ): 3, + Export( + "a", + ): 2, +} +``` + + +# Modules (dev) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; + +``` +## Part 1 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { order }; + +``` +## Part 2 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +export { a }; +const a = { + shared, + a: "aaaaaaaaaaa" +}; +export { a } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 3 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +export { b }; +const b = { + shared, + b: "bbbbbbbbbbb" +}; +export { b } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 4 +```js +const order = []; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 5 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +order.push("a"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const random = Math.random(); +export { random } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import { random } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const shared = { + random, + effect: order.push("b") +}; +export { shared } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +order.push("c"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; + +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "order", + ): 1, + Export( + "b", + ): 3, + Export( + "a", + ): 2, +} +``` + + +# Modules (prod) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; + +``` +## Part 1 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { order }; + +``` +## Part 2 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +export { a }; +const a = { + shared, + a: "aaaaaaaaaaa" +}; +export { a } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 3 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +export { b }; +const b = { + shared, + b: "bbbbbbbbbbb" +}; +export { b } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 4 +```js +const order = []; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 5 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +order.push("a"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const random = Math.random(); +export { random } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import { random } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const shared = { + random, + effect: order.push("b") +}; +export { shared } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +order.push("c"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; + +``` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/input.js b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/input.js new file mode 100644 index 0000000000000..077dd8009d6cf --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/input.js @@ -0,0 +1,11 @@ +console.log("Hello"); +const value = externalFunction(); +const value2 = externalObject.propertyWithGetter; +externalObject.propertyWithSetter = 42; +const value3 = /*#__PURE__*/ externalFunction(); + +const shared = { value, value2, value3 }; +console.log(shared); + +export const a = { shared, a: "aaaaaaaaaaa" }; +export const b = { shared, b: "bbbbbbbbbbb" }; diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md new file mode 100644 index 0000000000000..029fb89bcb0cf --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/shared-and-side-effects/output.md @@ -0,0 +1,647 @@ +# Items + +Count: 12 + +## Item 1: Stmt 0, `Normal` + +```js +console.log("Hello"); + +``` + +- Side effects + +## Item 2: Stmt 1, `VarDeclarator(0)` + +```js +const value = externalFunction(); + +``` + +- Side effects +- Declares: `value` +- Write: `value` + +## Item 3: Stmt 2, `VarDeclarator(0)` + +```js +const value2 = externalObject.propertyWithGetter; + +``` + +- Side effects +- Declares: `value2` +- Write: `value2` + +## Item 4: Stmt 3, `Normal` + +```js +externalObject.propertyWithSetter = 42; + +``` + +- Side effects + +## Item 5: Stmt 4, `VarDeclarator(0)` + +```js +const value3 = externalFunction(); + +``` + +- Side effects +- Declares: `value3` +- Write: `value3` + +## Item 6: Stmt 5, `VarDeclarator(0)` + +```js +const shared = { + value, + value2, + value3 +}; + +``` + +- Declares: `shared` +- Reads: `value`, `value2`, `value3` +- Write: `shared` + +## Item 7: Stmt 6, `Normal` + +```js +console.log(shared); + +``` + +- Side effects +- Reads: `shared` + +## Item 8: Stmt 7, `VarDeclarator(0)` + +```js +export const a = { + shared, + a: "aaaaaaaaaaa" +}; + +``` + +- Declares: `a` +- Reads: `shared` +- Write: `a` + +## Item 9: Stmt 8, `VarDeclarator(0)` + +```js +export const b = { + shared, + b: "bbbbbbbbbbb" +}; + +``` + +- Declares: `b` +- Reads: `shared` +- Write: `b` + +# Phase 1 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item10["ModuleEvaluation"]; + Item11; + Item11["export a"]; + Item12; + Item12["export b"]; +``` +# Phase 2 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item10["ModuleEvaluation"]; + Item11; + Item11["export a"]; + Item12; + Item12["export b"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item4 --> Item1; + Item4 --> Item2; + Item4 --> Item3; + Item5 --> Item1; + Item5 --> Item2; + Item5 --> Item3; + Item5 --> Item4; + Item6 --> Item2; + Item6 --> Item3; + Item6 --> Item5; + Item7 --> Item6; + Item7 --> Item1; + Item7 --> Item2; + Item7 --> Item3; + Item7 --> Item4; + Item7 --> Item5; + Item8 --> Item6; + Item9 --> Item6; +``` +# Phase 3 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item10["ModuleEvaluation"]; + Item11; + Item11["export a"]; + Item12; + Item12["export b"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item4 --> Item1; + Item4 --> Item2; + Item4 --> Item3; + Item5 --> Item1; + Item5 --> Item2; + Item5 --> Item3; + Item5 --> Item4; + Item6 --> Item2; + Item6 --> Item3; + Item6 --> Item5; + Item7 --> Item6; + Item7 --> Item1; + Item7 --> Item2; + Item7 --> Item3; + Item7 --> Item4; + Item7 --> Item5; + Item8 --> Item6; + Item9 --> Item6; +``` +# Phase 4 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item9; + Item10; + Item10["ModuleEvaluation"]; + Item11; + Item11["export a"]; + Item12; + Item12["export b"]; + Item2 --> Item1; + Item3 --> Item1; + Item3 --> Item2; + Item4 --> Item1; + Item4 --> Item2; + Item4 --> Item3; + Item5 --> Item1; + Item5 --> Item2; + Item5 --> Item3; + Item5 --> Item4; + Item6 --> Item2; + Item6 --> Item3; + Item6 --> Item5; + Item7 --> Item6; + Item7 --> Item1; + Item7 --> Item2; + Item7 --> Item3; + Item7 --> Item4; + Item7 --> Item5; + Item8 --> Item6; + Item9 --> Item6; + Item10 --> Item1; + Item10 --> Item2; + Item10 --> Item3; + Item10 --> Item4; + Item10 --> Item5; + Item10 --> Item7; + Item11 --> Item8; + Item12 --> Item9; +``` +# Final +```mermaid +graph TD + N0["Items: [ItemId(ModuleEvaluation), ItemId(6, Normal)]"]; + N1["Items: [ItemId(Export(("a", #2), "a")), ItemId(7, VarDeclarator(0))]"]; + N2["Items: [ItemId(Export(("b", #2), "b")), ItemId(8, VarDeclarator(0))]"]; + N3["Items: [ItemId(0, Normal)]"]; + N4["Items: [ItemId(1, VarDeclarator(0))]"]; + N5["Items: [ItemId(2, VarDeclarator(0))]"]; + N6["Items: [ItemId(3, Normal)]"]; + N7["Items: [ItemId(4, VarDeclarator(0))]"]; + N8["Items: [ItemId(5, VarDeclarator(0))]"]; + N0 --> N3; + N0 --> N4; + N0 --> N5; + N0 --> N6; + N0 --> N7; + N0 --> N8; + N1 --> N8; + N2 --> N8; + N4 --> N3; + N5 --> N3; + N5 --> N4; + N6 --> N3; + N6 --> N4; + N6 --> N5; + N7 --> N3; + N7 --> N4; + N7 --> N5; + N7 --> N6; + N8 --> N4; + N8 --> N5; + N8 --> N7; +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "b", + ): 2, + Export( + "a", + ): 1, +} +``` + + +# Modules (dev) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; +console.log(shared); + +``` +## Part 1 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { a }; +const a = { + shared, + a: "aaaaaaaaaaa" +}; +export { a } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 2 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { b }; +const b = { + shared, + b: "bbbbbbbbbbb" +}; +export { b } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 3 +```js +console.log("Hello"); + +``` +## Part 4 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +const value = externalFunction(); +export { value } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 5 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +const value2 = externalObject.propertyWithGetter; +export { value2 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +externalObject.propertyWithSetter = 42; + +``` +## Part 7 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +const value3 = externalFunction(); +export { value3 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { value } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import { value2 } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import { value3 } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +const shared = { + value, + value2, + value3 +}; +export { shared } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; +console.log(shared); + +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "b", + ): 2, + Export( + "a", + ): 1, +} +``` + + +# Modules (prod) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; +console.log(shared); + +``` +## Part 1 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { a }; +const a = { + shared, + a: "aaaaaaaaaaa" +}; +export { a } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 2 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { b }; +const b = { + shared, + b: "bbbbbbbbbbb" +}; +export { b } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 3 +```js +console.log("Hello"); + +``` +## Part 4 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +const value = externalFunction(); +export { value } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 5 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +const value2 = externalObject.propertyWithGetter; +export { value2 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +externalObject.propertyWithSetter = 42; + +``` +## Part 7 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +const value3 = externalFunction(); +export { value3 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { value } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import { value2 } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import { value3 } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +const shared = { + value, + value2, + value3 +}; +export { shared } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 3 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +"module evaluation"; +console.log(shared); + +``` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md index dccd4d458a3a4..14e41fb23f247 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md @@ -266,7 +266,7 @@ export const routeModule = new PagesRouteModule({ - Declares: `routeModule` - Reads: `PagesRouteModule`, `RouteKind`, `App`, `Document`, `userland` -- Write: `routeModule` +- Write: `routeModule`, `RouteKind` # Phase 1 ```mermaid @@ -974,6 +974,9 @@ const routeModule = new PagesRouteModule({ export { routeModule } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; +export { RouteKind } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; ``` ## Part 13 @@ -1353,6 +1356,9 @@ const routeModule = new PagesRouteModule({ export { routeModule } from "__TURBOPACK_VAR__" assert { __turbopack_var__: true }; +export { RouteKind } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; ``` ## Part 13 diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md index a20d68147f5cf..1530453c6b408 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md @@ -92,7 +92,7 @@ console.log(foobarCopy); ``` - Side effects -- Reads: `console`, `foobarCopy` +- Reads: `foobarCopy` ## Item 10: Stmt 8, `Normal` diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/tla-1/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/tla-1/output.md index 1f296f1665993..1303a9b07f86a 100644 --- a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/tla-1/output.md +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/tla-1/output.md @@ -10,7 +10,6 @@ await Promise.resolve(); ``` - Side effects -- Reads: `Promise` ## Item 2: Stmt 1, `VarDeclarator(0)` @@ -35,6 +34,7 @@ export function effect(name) { - Declares: `effect` - Reads (eventual): `effects` - Write: `effect` +- Write (eventual): `effects` # Phase 1 ```mermaid diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/input.js b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/input.js new file mode 100644 index 0000000000000..afc7c9f573e75 --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/input.js @@ -0,0 +1,11 @@ +export const order = []; + +export function func() { + order.push("d"); +} + +order.push("a"); +const x1 = externalFunction(); +const x2 = externalFunction(); +export const shared = { effect: order.push("b") }; +order.push("c"); diff --git a/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/output.md b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/output.md new file mode 100644 index 0000000000000..7505a3d1408c0 --- /dev/null +++ b/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/write-order/output.md @@ -0,0 +1,554 @@ +# Items + +Count: 11 + +## Item 1: Stmt 0, `VarDeclarator(0)` + +```js +export const order = []; + +``` + +- Declares: `order` +- Write: `order` + +## Item 2: Stmt 1, `Normal` + +```js +export function func() { + order.push("d"); +} + +``` + +- Hoisted +- Declares: `func` +- Reads (eventual): `order` +- Write: `func` +- Write (eventual): `order` + +## Item 3: Stmt 2, `Normal` + +```js +order.push("a"); + +``` + +- Side effects +- Reads: `order` +- Write: `order` + +## Item 4: Stmt 3, `VarDeclarator(0)` + +```js +const x1 = externalFunction(); + +``` + +- Side effects +- Declares: `x1` +- Write: `x1` + +## Item 5: Stmt 4, `VarDeclarator(0)` + +```js +const x2 = externalFunction(); + +``` + +- Side effects +- Declares: `x2` +- Write: `x2` + +## Item 6: Stmt 5, `VarDeclarator(0)` + +```js +export const shared = { + effect: order.push("b") +}; + +``` + +- Declares: `shared` +- Reads: `order` +- Write: `shared`, `order` + +## Item 7: Stmt 6, `Normal` + +```js +order.push("c"); + +``` + +- Side effects +- Reads: `order` +- Write: `order` + +# Phase 1 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export func"]; + Item11; + Item11["export shared"]; +``` +# Phase 2 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export func"]; + Item11; + Item11["export shared"]; + Item3 --> Item1; + Item4 --> Item3; + Item5 --> Item3; + Item5 --> Item4; + Item6 --> Item3; + Item7 --> Item6; + Item7 --> Item3; + Item7 --> Item4; + Item7 --> Item5; +``` +# Phase 3 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export func"]; + Item11; + Item11["export shared"]; + Item3 --> Item1; + Item4 --> Item3; + Item5 --> Item3; + Item5 --> Item4; + Item6 --> Item3; + Item7 --> Item6; + Item7 --> Item3; + Item7 --> Item4; + Item7 --> Item5; + Item2 --> Item7; +``` +# Phase 4 +```mermaid +graph TD + Item1; + Item2; + Item3; + Item4; + Item5; + Item6; + Item7; + Item8; + Item8["ModuleEvaluation"]; + Item9; + Item9["export order"]; + Item10; + Item10["export func"]; + Item11; + Item11["export shared"]; + Item3 --> Item1; + Item4 --> Item3; + Item5 --> Item3; + Item5 --> Item4; + Item6 --> Item3; + Item7 --> Item6; + Item7 --> Item3; + Item7 --> Item4; + Item7 --> Item5; + Item2 --> Item7; + Item8 --> Item3; + Item8 --> Item4; + Item8 --> Item5; + Item8 --> Item7; + Item9 --> Item7; + Item10 --> Item2; + Item11 --> Item6; +``` +# Final +```mermaid +graph TD + N0["Items: [ItemId(ModuleEvaluation)]"]; + N1["Items: [ItemId(Export(("order", #2), "order"))]"]; + N2["Items: [ItemId(Export(("func", #2), "func")), ItemId(1, Normal)]"]; + N3["Items: [ItemId(Export(("shared", #2), "shared"))]"]; + N4["Items: [ItemId(0, VarDeclarator(0))]"]; + N5["Items: [ItemId(2, Normal)]"]; + N6["Items: [ItemId(3, VarDeclarator(0))]"]; + N7["Items: [ItemId(4, VarDeclarator(0))]"]; + N8["Items: [ItemId(5, VarDeclarator(0))]"]; + N9["Items: [ItemId(6, Normal)]"]; + N0 --> N5; + N0 --> N6; + N0 --> N7; + N0 --> N9; + N1 --> N9; + N2 --> N9; + N3 --> N8; + N5 --> N4; + N6 --> N5; + N7 --> N5; + N7 --> N6; + N8 --> N5; + N9 --> N8; + N9 --> N5; + N9 --> N6; + N9 --> N7; +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "order", + ): 1, + Export( + "func", + ): 2, + Export( + "shared", + ): 3, +} +``` + + +# Modules (dev) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +"module evaluation"; + +``` +## Part 1 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +export { order }; + +``` +## Part 2 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +export { func }; +function func() { + order.push("d"); +} +export { func } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 3 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { shared }; + +``` +## Part 4 +```js +const order = []; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 5 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +order.push("a"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const x1 = externalFunction(); +export { x1 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +const x2 = externalFunction(); +export { x2 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const shared = { + effect: order.push("b") +}; +export { shared } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 9 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +order.push("c"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +"module evaluation"; + +``` +# Entrypoints + +``` +{ + ModuleEvaluation: 0, + Export( + "order", + ): 1, + Export( + "func", + ): 2, + Export( + "shared", + ): 3, +} +``` + + +# Modules (prod) +## Part 0 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +"module evaluation"; + +``` +## Part 1 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +export { order }; + +``` +## Part 2 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +export { func }; +function func() { + order.push("d"); +} +export { func } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 3 +```js +import { shared } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +export { shared }; + +``` +## Part 4 +```js +const order = []; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 5 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 4 +}; +order.push("a"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 6 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const x1 = externalFunction(); +export { x1 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 7 +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +const x2 = externalFunction(); +export { x2 } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 8 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +const shared = { + effect: order.push("b") +}; +export { shared } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Part 9 +```js +import { order } from "__TURBOPACK_PART__" assert { + __turbopack_part__: 8 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +order.push("c"); +export { order } from "__TURBOPACK_VAR__" assert { + __turbopack_var__: true +}; + +``` +## Merged (module eval) +```js +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 5 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 6 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 7 +}; +import "__TURBOPACK_PART__" assert { + __turbopack_part__: 9 +}; +"module evaluation"; + +``` diff --git a/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/a.js b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/a.js new file mode 100644 index 0000000000000..fd18d3bf7d373 --- /dev/null +++ b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/a.js @@ -0,0 +1,3 @@ +import { a } from "./module"; + +export default a; diff --git a/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/b.js b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/b.js new file mode 100644 index 0000000000000..bd9f02cc977cd --- /dev/null +++ b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/b.js @@ -0,0 +1,3 @@ +import { b } from "./module"; + +export default b; diff --git a/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/index.js b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/index.js new file mode 100644 index 0000000000000..9760696a5c287 --- /dev/null +++ b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/index.js @@ -0,0 +1,14 @@ +it("should load chunk a and b with shared state", async () => { + let a = await import("./a"); + expect(a.default).toHaveProperty("a", "aaaaaaaaaaa"); + let b = await import("./b"); + expect(b.default).toHaveProperty("b", "bbbbbbbbbbb"); + let aShared = a.shared; + let bShared = b.shared; + expect(aShared).toBe(bShared); +}); + +it("should execute side effects in the correct order", async () => { + let module = await import("./module"); + expect(module.order).toEqual(["a", "b", "c"]); +}); diff --git a/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/module.js b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/module.js new file mode 100644 index 0000000000000..74a6147c0837a --- /dev/null +++ b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/module.js @@ -0,0 +1,9 @@ +export const order = []; + +order.push("a"); +const random = Math.random(); +const shared = { random, effect: order.push("b") }; +order.push("c"); + +export const a = { shared, a: "aaaaaaaaaaa" }; +export const b = { shared, b: "bbbbbbbbbbb" }; diff --git a/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/order.js b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/order.js new file mode 100644 index 0000000000000..0ec382c3decc1 --- /dev/null +++ b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/input/order.js @@ -0,0 +1,3 @@ +import { order } from "./module"; + +export default order; diff --git a/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/options.json b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/options.json new file mode 100644 index 0000000000000..000d78a6b3cbb --- /dev/null +++ b/crates/turbopack-tests/tests/execution/turbopack/tree-shaking/split-chunks-shared-state/options.json @@ -0,0 +1,3 @@ +{ + "treeShakingMode": "module-fragments" +} diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js index 9127fa1befccc..c15a56152aa43 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js @@ -239,7 +239,12 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests "[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/index.js [test] (ecmascript) ": (({ r: __turbopack_require__, f: __turbopack_module_context__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, n: __turbopack_export_namespace__, c: __turbopack_cache__, M: __turbopack_modules__, l: __turbopack_load__, j: __turbopack_dynamic__, P: __turbopack_resolve_absolute_path__, U: __turbopack_relative_url__, R: __turbopack_resolve_module_id_path__, g: global, __dirname }) => (() => { "use strict"; -__turbopack_esm__({}); +__turbopack_esm__({ + "lib": [ + ()=>__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__lib$3e$__["lib"], + (v)=>$expr = v + ] +}); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/module.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__lib$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/module.js [test] (ecmascript) "); "__TURBOPACK__ecmascript__hoisting__location__"; @@ -247,6 +252,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests ; ; console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$module$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$export__lib$3e$__["lib"].cat); +; })()), "[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/index.js [test] (ecmascript) ": (({ r: __turbopack_require__, f: __turbopack_module_context__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, n: __turbopack_export_namespace__, c: __turbopack_cache__, M: __turbopack_modules__, l: __turbopack_load__, j: __turbopack_dynamic__, P: __turbopack_resolve_absolute_path__, U: __turbopack_relative_url__, R: __turbopack_resolve_module_id_path__, g: global, __dirname }) => (() => { diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js.map b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js.map index 2acbe6be5743a..b07be5d60c241 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js.map +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_b8c6d3._.js.map @@ -30,8 +30,8 @@ {"offset": {"line": 223, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, {"offset": {"line": 228, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, {"offset": {"line": 236, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, - {"offset": {"line": 241, "column": 0}, "map": {"version":3,"sources":["turbopack://[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/index.js"],"sourcesContent":["import {lib} from './module'\n\nconsole.log(lib.cat)\n"],"names":[],"mappings":";;;;;;;AAEA,QAAQ,GAAG,CAAC,oOAAA,CAAA,MAAG,CAAC,GAAG"}}, - {"offset": {"line": 249, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, - {"offset": {"line": 254, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, - {"offset": {"line": 259, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}] + {"offset": {"line": 241, "column": 0}, "map": {"version":3,"sources":["turbopack://[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/index.js"],"sourcesContent":["import {lib} from './module'\n\nconsole.log(lib.cat)\n"],"names":[],"mappings":";;;;;;;;;;;;AAEA,QAAQ,GAAG,CAAC,oOAAA,CAAA,MAAG,CAAC,GAAG"}}, + {"offset": {"line": 255, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, + {"offset": {"line": 260, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, + {"offset": {"line": 265, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}] } \ No newline at end of file diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js index 586a085aaf639..14444d876882d 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js @@ -217,7 +217,9 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests "[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/index.js [test] (ecmascript) ": (({ r: __turbopack_require__, f: __turbopack_module_context__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, n: __turbopack_export_namespace__, c: __turbopack_cache__, M: __turbopack_modules__, l: __turbopack_load__, j: __turbopack_dynamic__, P: __turbopack_resolve_absolute_path__, U: __turbopack_relative_url__, R: __turbopack_resolve_module_id_path__, g: global, __dirname }) => (() => { "use strict"; -__turbopack_esm__({}); +__turbopack_esm__({ + "lib": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$facade$3e$__ +}); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$facade$3e$__ = __turbopack_import__("[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); "__TURBOPACK__ecmascript__hoisting__location__"; @@ -225,6 +227,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests ; ; console.log(__TURBOPACK__imported__module__$5b$project$5d2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$facade$3e$__.cat); +; })()), "[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/index.js [test] (ecmascript) ": (({ r: __turbopack_require__, f: __turbopack_module_context__, i: __turbopack_import__, s: __turbopack_esm__, v: __turbopack_export_value__, n: __turbopack_export_namespace__, c: __turbopack_cache__, M: __turbopack_modules__, l: __turbopack_load__, j: __turbopack_dynamic__, P: __turbopack_resolve_absolute_path__, U: __turbopack_relative_url__, R: __turbopack_resolve_module_id_path__, g: global, __dirname }) => (() => { diff --git a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js.map b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js.map index 457f75f4443cd..9654e0f6e3f4d 100644 --- a/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js.map +++ b/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/79fb1_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_66459d._.js.map @@ -26,8 +26,8 @@ {"offset": {"line": 198, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, {"offset": {"line": 203, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, {"offset": {"line": 214, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, - {"offset": {"line": 219, "column": 0}, "map": {"version":3,"sources":["turbopack://[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/index.js"],"sourcesContent":["import * as lib from './lib'\n\nconsole.log(lib.cat)\n"],"names":[],"mappings":";;;;;;;AAEA,QAAQ,GAAG,CAAC,6NAAI,GAAG"}}, - {"offset": {"line": 227, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, - {"offset": {"line": 232, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, - {"offset": {"line": 237, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}] + {"offset": {"line": 219, "column": 0}, "map": {"version":3,"sources":["turbopack://[project]/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/index.js"],"sourcesContent":["import * as lib from './lib'\n\nconsole.log(lib.cat)\n"],"names":[],"mappings":";;;;;;;;;AAEA,QAAQ,GAAG,CAAC,6NAAI,GAAG"}}, + {"offset": {"line": 230, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}, + {"offset": {"line": 235, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":""}}, + {"offset": {"line": 240, "column": 0}, "map": {"version":3,"sources":[],"names":[],"mappings":"A"}}] } \ No newline at end of file