diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs index 6a88390655acb..b68a48ddea217 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs @@ -14,7 +14,7 @@ use swc_core::{ ExportNamedSpecifier, ExportSpecifier, Expr, ExprStmt, FnDecl, Id, Ident, IdentName, ImportDecl, ImportNamedSpecifier, ImportSpecifier, ImportStarAsSpecifier, KeyValueProp, Lit, Module, ModuleDecl, ModuleExportName, ModuleItem, NamedExport, ObjectLit, Prop, - PropName, PropOrSpread, Stmt, VarDecl, VarDeclKind, VarDeclarator, + PropName, PropOrSpread, Stmt, Str, VarDecl, VarDeclKind, VarDeclarator, }, atoms::JsWord, utils::{find_pat_ids, private_ident, quote_ident, ExprCtx, ExprExt}, @@ -105,6 +105,12 @@ pub(crate) struct ItemData { pub content: ModuleItem, pub export: Option, + + /// This value denotes the module specifier of the [ImportDecl] that declares this + /// [ItemId]. + /// + /// Used to specify the original import source of an `ImportBinding`. + pub binding_source: Option, } impl fmt::Debug for ItemData { @@ -136,6 +142,7 @@ impl Default for ItemData { content: ModuleItem::dummy(), pure: Default::default(), export: Default::default(), + binding_source: Default::default(), } } } @@ -486,6 +493,23 @@ impl DepGraph { continue; } + part_deps_done.insert(dep); + + let dep_item_ids = groups.graph_ix.get_index(dep as usize).unwrap(); + + // Optimization & workaround for `ImportBinding` fragments. + // Instead of importing the import binding fragment, we import the original module. + // In this way, we can preserve the import statement so that the other code analysis + // can work. + let original_import_source = if dep_item_ids.len() == 1 { + let dep_item_id = &dep_item_ids[0]; + let dep_item_data = data.get(dep_item_id).unwrap(); + + dep_item_data.binding_source.clone() + } else { + None + }; + let specifiers = vec![ImportSpecifier::Named(ImportNamedSpecifier { span: DUMMY_SP, local: var.clone().into(), @@ -496,8 +520,6 @@ impl DepGraph { is_type_only: false, })]; - part_deps_done.insert(dep); - part_deps .entry(ix as u32) .or_default() @@ -510,9 +532,10 @@ impl DepGraph { specifiers, src: Box::new(TURBOPACK_PART_IMPORT_SOURCE.into()), type_only: false, - with: Some(Box::new(create_turbopack_part_id_assert(PartId::Internal( - dep, false, - )))), + with: Some(Box::new(add_original_import_source( + create_turbopack_part_id_assert(PartId::Internal(dep, false)), + original_import_source, + ))), phase: Default::default(), }))); } @@ -1037,6 +1060,7 @@ impl DepGraph { specifiers: vec![s.clone()], ..item.clone() })), + binding_source: Some(*item.src.clone()), ..Default::default() }, ); @@ -1360,6 +1384,7 @@ impl DepGraph { } const ASSERT_CHUNK_KEY: &str = "__turbopack_part__"; +const ASSERT_ORIGINAL_IMPORT_SOURCE_KEY: &str = "__turbopack_original__"; #[derive(Debug, Clone)] pub(crate) enum PartId { @@ -1370,6 +1395,21 @@ pub(crate) enum PartId { Internal(u32, bool), } +pub(crate) fn add_original_import_source(mut item: ObjectLit, source: Option) -> ObjectLit { + if let Some(source) = source { + item.props + .push(PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { + key: PropName::Ident(IdentName::new( + ASSERT_ORIGINAL_IMPORT_SOURCE_KEY.into(), + DUMMY_SP, + )), + value: Box::new(Expr::Lit(Lit::Str(source))), + })))); + } + + item +} + pub(crate) fn create_turbopack_part_id_assert(dep: PartId) -> ObjectLit { // We can't use quote! as `with` is not standard yet ObjectLit { diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md index 18aced4bec3f3..13e42b2ea75a5 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/1/output.md @@ -594,7 +594,8 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "module" }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 @@ -842,7 +843,8 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "module" }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md index f47e610e2dfa0..df3232e50a5f5 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/2/output.md @@ -633,7 +633,8 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -8 }; import { f as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: "module" }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 @@ -889,7 +890,8 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -8 }; import { f as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: "module" }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md index c5c871786b443..8b4b8d2eec88b 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/amphtml-document/output.md @@ -438,28 +438,36 @@ export { NextScript as i } from "__TURBOPACK_VAR__" assert { ## Part 12 ```js import { e as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: 'next/document' }; import { c as _jsxs } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "react/jsx-runtime" }; import { d as _Fragment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: "react/jsx-runtime" }; import { b as _jsx } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: "react/jsx-runtime" }; import { f as Html } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: 'next/document' }; import { g as Head } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9 + __turbopack_part__: -9, + __turbopack_original__: 'next/document' }; import { h as Main } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: 'next/document' }; import { i as NextScript } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -11 + __turbopack_part__: -11, + __turbopack_original__: 'next/document' }; class MyDocument extends Document { static async getInitialProps(ctx) { @@ -660,28 +668,36 @@ export { NextScript as i } from "__TURBOPACK_VAR__" assert { ## Part 12 ```js import { e as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: 'next/document' }; import { c as _jsxs } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "react/jsx-runtime" }; import { d as _Fragment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: "react/jsx-runtime" }; import { b as _jsx } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: "react/jsx-runtime" }; import { f as Html } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: 'next/document' }; import { g as Head } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9 + __turbopack_part__: -9, + __turbopack_original__: 'next/document' }; import { h as Main } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: 'next/document' }; import { i as NextScript } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -11 + __turbopack_part__: -11, + __turbopack_original__: 'next/document' }; class MyDocument extends Document { static async getInitialProps(ctx) { diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md index 2491d78aa5e30..b31662410bcf7 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/app-route/output.md @@ -525,13 +525,16 @@ export { userland as j } from "__TURBOPACK_VAR__" assert { ## Part 15 ```js import { g as AppRouteRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: '../../server/future/route-modules/app-route/module.compiled' }; import { h as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: '../../server/future/route-kind' }; import { j as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 @@ -587,7 +590,8 @@ import { f as workAsyncStorage } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; import { i as _patchFetch } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: '../../server/lib/patch-fetch' }; import { e as serverHooks } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 @@ -800,13 +804,16 @@ export { userland as j } from "__TURBOPACK_VAR__" assert { ## Part 15 ```js import { g as AppRouteRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: '../../server/future/route-modules/app-route/module.compiled' }; import { h as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: '../../server/future/route-kind' }; import { j as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 13 @@ -859,7 +866,8 @@ import { f as workAsyncStorage } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; import { i as _patchFetch } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: '../../server/lib/patch-fetch' }; import { e as serverHooks } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md index e4c24d6a5f287..e0163f514ef15 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/dce/output.md @@ -126,7 +126,8 @@ export { baz as a } from "__TURBOPACK_VAR__" assert { ## Part 3 ```js import { a as baz } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -2 + __turbopack_part__: -2, + __turbopack_original__: './module' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 1 @@ -186,7 +187,8 @@ export { baz as a } from "__TURBOPACK_VAR__" assert { ## Part 3 ```js import { a as baz } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -2 + __turbopack_part__: -2, + __turbopack_original__: './module' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 1 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md index 6623b35a1ef21..1314293d20303 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-2/output.md @@ -795,7 +795,8 @@ export { getPathname as l } from "__TURBOPACK_VAR__" assert { ## Part 17 ```js import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: 'react' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 15 @@ -851,13 +852,16 @@ export { createPrerenderState as c } from "__TURBOPACK_VAR__" assert { ## Part 19 ```js import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: '../../client/components/hooks-server-context' }; import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16 + __turbopack_part__: -16, + __turbopack_original__: '../../lib/url' }; import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: '../../client/components/static-generation-bailout' }; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -17 @@ -888,13 +892,16 @@ export { markCurrentScopeAsDynamic as e } from "__TURBOPACK_VAR__" assert { ## Part 20 ```js import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: '../../client/components/hooks-server-context' }; import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16 + __turbopack_part__: -16, + __turbopack_original__: '../../lib/url' }; import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: '../../client/components/static-generation-bailout' }; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -17 @@ -986,7 +993,8 @@ export { formatDynamicAPIAccesses as d } from "__TURBOPACK_VAR__" assert { ## Part 25 ```js import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: 'react' }; import { o as assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: -17 @@ -1225,7 +1233,8 @@ export { getPathname as l } from "__TURBOPACK_VAR__" assert { ## Part 17 ```js import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: 'react' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 15 @@ -1252,13 +1261,16 @@ export { createPrerenderState as c } from "__TURBOPACK_VAR__" assert { ## Part 19 ```js import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: '../../client/components/hooks-server-context' }; import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16 + __turbopack_part__: -16, + __turbopack_original__: '../../lib/url' }; import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: '../../client/components/static-generation-bailout' }; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -23 @@ -1289,13 +1301,16 @@ export { markCurrentScopeAsDynamic as e } from "__TURBOPACK_VAR__" assert { ## Part 20 ```js import { j as DynamicServerError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: '../../client/components/hooks-server-context' }; import { l as getPathname } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16 + __turbopack_part__: -16, + __turbopack_original__: '../../lib/url' }; import { k as StaticGenBailoutError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: '../../client/components/static-generation-bailout' }; import { n as postponeWithTracking } from "__TURBOPACK_PART__" assert { __turbopack_part__: -23 @@ -1353,7 +1368,8 @@ export { trackDynamicFetch as g } from "__TURBOPACK_VAR__" assert { ## Part 23 ```js import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: 'react' }; import { o as assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: -26 @@ -1427,7 +1443,8 @@ export { assertPostpone as o } from "__TURBOPACK_VAR__" assert { ## Part 27 ```js import { i as React } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: 'react' }; import { o as assertPostpone } from "__TURBOPACK_PART__" assert { __turbopack_part__: -26 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md index c5e9821f520bb..33aac24f37d4f 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/failed-3/output.md @@ -1226,10 +1226,12 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ## Part 9 ```js import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "../compiled/stacktrace-parser" }; import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: "./error" }; function structuredError(e) { e = getProperError(e); @@ -1250,7 +1252,8 @@ import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "node:net" }; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); @@ -1974,10 +1977,12 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ## Part 9 ```js import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "../compiled/stacktrace-parser" }; import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: "./error" }; function structuredError(e) { e = getProperError(e); @@ -1998,7 +2003,8 @@ import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "node:net" }; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md index 108dab1062686..7393de21722be 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-evaluate/output.md @@ -279,7 +279,8 @@ export { IPC as b } from "__TURBOPACK_VAR__" assert { ## Part 4 ```js import { b as IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: "./index" }; const ipc = IPC; export { ipc as c } from "__TURBOPACK_VAR__" assert { @@ -466,7 +467,8 @@ export { IPC as b } from "__TURBOPACK_VAR__" assert { ## Part 4 ```js import { b as IPC } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: "./index" }; const ipc = IPC; export { ipc as c } from "__TURBOPACK_VAR__" assert { diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md index c5e9821f520bb..33aac24f37d4f 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/ipc-index/output.md @@ -1226,10 +1226,12 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ## Part 9 ```js import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "../compiled/stacktrace-parser" }; import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: "./error" }; function structuredError(e) { e = getProperError(e); @@ -1250,7 +1252,8 @@ import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "node:net" }; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); @@ -1974,10 +1977,12 @@ export { getProperError as e } from "__TURBOPACK_VAR__" assert { ## Part 9 ```js import { d as parseStackTrace } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "../compiled/stacktrace-parser" }; import { e as getProperError } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: "./error" }; function structuredError(e) { e = getProperError(e); @@ -1998,7 +2003,8 @@ import { b as structuredError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -9 }; import { c as createConnection } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "node:net" }; function createIpc(port) { const socket = createConnection(port, "127.0.0.1"); diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md index 0ee642e878bc2..9cec84aee04df 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/mui-sys/output.md @@ -1300,13 +1300,16 @@ export { responsivePropType as s } from "__TURBOPACK_VAR__" assert { ## Part 25 ```js import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19 + __turbopack_part__: -19, + __turbopack_original__: './spacing' }; import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: './spacing' }; import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: './breakpoints' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 @@ -1332,7 +1335,8 @@ import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 }; import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: './responsivePropType' }; gap.propTypes = process.env.NODE_ENV !== 'production' ? { gap: responsivePropType @@ -1355,13 +1359,16 @@ gap.filterProps = [ ## Part 28 ```js import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19 + __turbopack_part__: -19, + __turbopack_original__: './spacing' }; import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: './spacing' }; import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: './breakpoints' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 @@ -1387,7 +1394,8 @@ import { b as columnGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -28 }; import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: './responsivePropType' }; columnGap.propTypes = process.env.NODE_ENV !== 'production' ? { columnGap: responsivePropType @@ -1410,13 +1418,16 @@ columnGap.filterProps = [ ## Part 31 ```js import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19 + __turbopack_part__: -19, + __turbopack_original__: './spacing' }; import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: './spacing' }; import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: './breakpoints' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 @@ -1442,7 +1453,8 @@ import { m as rowGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -31 }; import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: './responsivePropType' }; rowGap.propTypes = process.env.NODE_ENV !== 'production' ? { rowGap: responsivePropType @@ -1465,7 +1477,8 @@ rowGap.filterProps = [ ## Part 34 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 @@ -1481,7 +1494,8 @@ export { gridColumn as h } from "__TURBOPACK_VAR__" assert { ## Part 35 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 @@ -1497,7 +1511,8 @@ export { gridRow as i } from "__TURBOPACK_VAR__" assert { ## Part 36 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 @@ -1513,7 +1528,8 @@ export { gridAutoFlow as f } from "__TURBOPACK_VAR__" assert { ## Part 37 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 36 @@ -1529,7 +1545,8 @@ export { gridAutoColumns as e } from "__TURBOPACK_VAR__" assert { ## Part 38 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 37 @@ -1545,7 +1562,8 @@ export { gridAutoRows as g } from "__TURBOPACK_VAR__" assert { ## Part 39 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 38 @@ -1561,7 +1579,8 @@ export { gridTemplateColumns as k } from "__TURBOPACK_VAR__" assert { ## Part 40 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 39 @@ -1577,7 +1596,8 @@ export { gridTemplateRows as l } from "__TURBOPACK_VAR__" assert { ## Part 41 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 40 @@ -1593,7 +1613,8 @@ export { gridTemplateAreas as j } from "__TURBOPACK_VAR__" assert { ## Part 42 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 41 @@ -1609,7 +1630,8 @@ export { gridArea as d } from "__TURBOPACK_VAR__" assert { ## Part 43 ```js import { o as compose } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -17 + __turbopack_part__: -17, + __turbopack_original__: './compose' }; import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 @@ -2001,13 +2023,16 @@ export { responsivePropType as s } from "__TURBOPACK_VAR__" assert { ## Part 25 ```js import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19 + __turbopack_part__: -19, + __turbopack_original__: './spacing' }; import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: './spacing' }; import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: './breakpoints' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 @@ -2033,7 +2058,8 @@ import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 }; import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: './responsivePropType' }; gap.propTypes = process.env.NODE_ENV !== 'production' ? { gap: responsivePropType @@ -2056,13 +2082,16 @@ gap.filterProps = [ ## Part 28 ```js import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19 + __turbopack_part__: -19, + __turbopack_original__: './spacing' }; import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: './spacing' }; import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: './breakpoints' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 @@ -2088,7 +2117,8 @@ import { b as columnGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -28 }; import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: './responsivePropType' }; columnGap.propTypes = process.env.NODE_ENV !== 'production' ? { columnGap: responsivePropType @@ -2111,13 +2141,16 @@ columnGap.filterProps = [ ## Part 31 ```js import { p as createUnaryUnit } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -19 + __turbopack_part__: -19, + __turbopack_original__: './spacing' }; import { q as getValue } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: './spacing' }; import { r as handleBreakpoints } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: './breakpoints' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 @@ -2143,7 +2176,8 @@ import { m as rowGap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -31 }; import { s as responsivePropType } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: './responsivePropType' }; rowGap.propTypes = process.env.NODE_ENV !== 'production' ? { rowGap: responsivePropType @@ -2166,7 +2200,8 @@ rowGap.filterProps = [ ## Part 34 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 @@ -2182,7 +2217,8 @@ export { gridColumn as h } from "__TURBOPACK_VAR__" assert { ## Part 35 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 @@ -2198,7 +2234,8 @@ export { gridRow as i } from "__TURBOPACK_VAR__" assert { ## Part 36 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 @@ -2214,7 +2251,8 @@ export { gridAutoFlow as f } from "__TURBOPACK_VAR__" assert { ## Part 37 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 36 @@ -2230,7 +2268,8 @@ export { gridAutoColumns as e } from "__TURBOPACK_VAR__" assert { ## Part 38 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 37 @@ -2246,7 +2285,8 @@ export { gridAutoRows as g } from "__TURBOPACK_VAR__" assert { ## Part 39 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 38 @@ -2262,7 +2302,8 @@ export { gridTemplateColumns as k } from "__TURBOPACK_VAR__" assert { ## Part 40 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 39 @@ -2278,7 +2319,8 @@ export { gridTemplateRows as l } from "__TURBOPACK_VAR__" assert { ## Part 41 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 40 @@ -2294,7 +2336,8 @@ export { gridTemplateAreas as j } from "__TURBOPACK_VAR__" assert { ## Part 42 ```js import { n as style } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -15 + __turbopack_part__: -15, + __turbopack_original__: './style' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 41 @@ -2310,7 +2353,8 @@ export { gridArea as d } from "__TURBOPACK_VAR__" assert { ## Part 43 ```js import { o as compose } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -17 + __turbopack_part__: -17, + __turbopack_original__: './compose' }; import { c as gap } from "__TURBOPACK_PART__" assert { __turbopack_part__: -25 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md index 80b3fe1ae2207..54c4ac7fd0ecd 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nanoid/output.md @@ -460,7 +460,8 @@ export { random }; ## Part 5 ```js import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9 + __turbopack_part__: -9, + __turbopack_original__: './url-alphabet/index.js' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 17 @@ -536,7 +537,8 @@ import { g as POOL_SIZE_MULTIPLIER } from "__TURBOPACK_PART__" assert { __turbopack_part__: -10 }; import { f as crypto } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: 'crypto' }; import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 @@ -628,7 +630,8 @@ import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 }; import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9 + __turbopack_part__: -9, + __turbopack_original__: './url-alphabet/index.js' }; import { h as pool } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 @@ -745,7 +748,8 @@ export { random }; ## Part 5 ```js import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9 + __turbopack_part__: -9, + __turbopack_original__: './url-alphabet/index.js' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 17 @@ -821,7 +825,8 @@ import { g as POOL_SIZE_MULTIPLIER } from "__TURBOPACK_PART__" assert { __turbopack_part__: -10 }; import { f as crypto } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: 'crypto' }; import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 @@ -913,7 +918,8 @@ import { i as poolOffset } from "__TURBOPACK_PART__" assert { __turbopack_part__: -12 }; import { e as urlAlphabet } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -9 + __turbopack_part__: -9, + __turbopack_original__: './url-alphabet/index.js' }; import { h as pool } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md index 876cef858e876..fe6bbe013a70c 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/next-response/output.md @@ -630,28 +630,34 @@ export { handleMiddlewareField as j } from "__TURBOPACK_VAR__" assert { ## Part 16 ```js import { g as ResponseCookies } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: './cookies' }; import { b as stringifyCookie } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: '../../web/spec-extension/cookies' }; import { j as handleMiddlewareField } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 }; import { f as ReflectAdapter } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: './adapters/reflect' }; import { h as INTERNALS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -13 }; import { c as NextURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../next-url' }; import { d as toNodeOutgoingHttpHeaders } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: '../utils' }; import { e as validateURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: '../utils' }; import { i as REDIRECTS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -14 @@ -949,28 +955,34 @@ export { handleMiddlewareField as j } from "__TURBOPACK_VAR__" assert { ## Part 16 ```js import { g as ResponseCookies } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -12 + __turbopack_part__: -12, + __turbopack_original__: './cookies' }; import { b as stringifyCookie } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: '../../web/spec-extension/cookies' }; import { j as handleMiddlewareField } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 }; import { f as ReflectAdapter } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -10 + __turbopack_part__: -10, + __turbopack_original__: './adapters/reflect' }; import { h as INTERNALS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -13 }; import { c as NextURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../next-url' }; import { d as toNodeOutgoingHttpHeaders } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: '../utils' }; import { e as validateURL } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: '../utils' }; import { i as REDIRECTS } from "__TURBOPACK_PART__" assert { __turbopack_part__: -14 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md index 5cf91a4d3b3e5..a9f0276da60d3 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/nextjs-tracer/output.md @@ -965,7 +965,8 @@ import { s as clientTraceDataSetter } from "__TURBOPACK_PART__" assert { __turbopack_part__: -20 }; import { g as NextVanillaSpanAllowlist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: './constants' }; import { l as ROOT_CONTEXT } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 @@ -980,7 +981,8 @@ import { o as rootSpanAttributesStore } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; import { f as LogSpanAllowList } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: './constants' }; import { n as closeSpanWithError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 @@ -1480,7 +1482,8 @@ import { s as clientTraceDataSetter } from "__TURBOPACK_PART__" assert { __turbopack_part__: -20 }; import { g as NextVanillaSpanAllowlist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -8 + __turbopack_part__: -8, + __turbopack_original__: './constants' }; import { l as ROOT_CONTEXT } from "__TURBOPACK_PART__" assert { __turbopack_part__: -11 @@ -1495,7 +1498,8 @@ import { o as rootSpanAttributesStore } from "__TURBOPACK_PART__" assert { __turbopack_part__: -16 }; import { f as LogSpanAllowList } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: './constants' }; import { n as closeSpanWithError } from "__TURBOPACK_PART__" assert { __turbopack_part__: -15 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md index b296616f1cf58..f8545f62488f9 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/node-fetch/output.md @@ -191,7 +191,8 @@ export { Stream as b } from "__TURBOPACK_VAR__" assert { ## Part 4 ```js import { b as Stream } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: 'node:stream' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 2 @@ -288,7 +289,8 @@ export { Stream as b } from "__TURBOPACK_VAR__" assert { ## Part 4 ```js import { b as Stream } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: 'node:stream' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 2 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md index f05fc4d2fdd13..e8c30d34915d3 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/otel-core/output.md @@ -283,13 +283,16 @@ export { _globalThis as e } from "__TURBOPACK_VAR__" assert { ## Part 8 ```js import { c as DEFAULT_ENVIRONMENT } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: '../../utils/environment' }; import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../../utils/environment' }; import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: './globalThis' }; function getEnv() { var globalEnv = parseEnvironment(_globalThis); @@ -303,10 +306,12 @@ export { getEnv as a } from "__TURBOPACK_VAR__" assert { ## Part 9 ```js import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: './globalThis' }; import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../../utils/environment' }; function getEnvWithoutDefaults() { return parseEnvironment(_globalThis); @@ -424,13 +429,16 @@ export { _globalThis as e } from "__TURBOPACK_VAR__" assert { ## Part 8 ```js import { c as DEFAULT_ENVIRONMENT } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: '../../utils/environment' }; import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../../utils/environment' }; import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: './globalThis' }; function getEnv() { var globalEnv = parseEnvironment(_globalThis); @@ -444,10 +452,12 @@ export { getEnv as a } from "__TURBOPACK_VAR__" assert { ## Part 9 ```js import { e as _globalThis } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: './globalThis' }; import { d as parseEnvironment } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../../utils/environment' }; function getEnvWithoutDefaults() { return parseEnvironment(_globalThis); diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md index 8f4e782cb653e..7f6b54a7f6403 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/route-handler/output.md @@ -188,7 +188,8 @@ export { NextResponse as c } from "__TURBOPACK_VAR__" assert { ## Part 5 ```js import { c as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "next/server" }; const GET = (req)=>{ return NextResponse.json({ @@ -286,7 +287,8 @@ export { NextResponse as c } from "__TURBOPACK_VAR__" assert { ## Part 5 ```js import { c as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -4 + __turbopack_part__: -4, + __turbopack_original__: "next/server" }; const GET = (req)=>{ return NextResponse.json({ diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md index 0d340e9ad2aff..b424299d9ea9d 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/template-pages/output.md @@ -1032,10 +1032,12 @@ export { userland as r } from "__TURBOPACK_VAR__" assert { ## Part 25 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 @@ -1049,10 +1051,12 @@ export { __TURBOPACK__default__export__ as a } from "__TURBOPACK_VAR__" assert { ## Part 26 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 25 @@ -1066,10 +1070,12 @@ export { getStaticProps as e } from "__TURBOPACK_VAR__" assert { ## Part 27 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 @@ -1083,10 +1089,12 @@ export { getStaticPaths as d } from "__TURBOPACK_VAR__" assert { ## Part 28 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 27 @@ -1100,10 +1108,12 @@ export { getServerSideProps as c } from "__TURBOPACK_VAR__" assert { ## Part 29 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 28 @@ -1117,10 +1127,12 @@ export { config as b } from "__TURBOPACK_VAR__" assert { ## Part 30 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 @@ -1134,10 +1146,12 @@ export { reportWebVitals as f } from "__TURBOPACK_VAR__" assert { ## Part 31 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 30 @@ -1151,10 +1165,12 @@ export { unstable_getStaticProps as l } from "__TURBOPACK_VAR__" assert { ## Part 32 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 31 @@ -1168,10 +1184,12 @@ export { unstable_getStaticPaths as k } from "__TURBOPACK_VAR__" assert { ## Part 33 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 @@ -1185,10 +1203,12 @@ export { unstable_getStaticParams as j } from "__TURBOPACK_VAR__" assert { ## Part 34 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 33 @@ -1202,10 +1222,12 @@ export { unstable_getServerProps as h } from "__TURBOPACK_VAR__" assert { ## Part 35 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 @@ -1219,19 +1241,24 @@ export { unstable_getServerSideProps as i } from "__TURBOPACK_VAR__" assert { ## Part 36 ```js import { m as PagesRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: '../../server/future/route-modules/pages/module.compiled' }; import { n as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16 + __turbopack_part__: -16, + __turbopack_original__: '../../server/future/route-kind' }; import { q as App } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: 'VAR_MODULE_APP' }; import { p as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: 'VAR_MODULE_DOCUMENT' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 @@ -1568,10 +1595,12 @@ export { userland as r } from "__TURBOPACK_VAR__" assert { ## Part 25 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 23 @@ -1585,10 +1614,12 @@ export { __TURBOPACK__default__export__ as a } from "__TURBOPACK_VAR__" assert { ## Part 26 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 25 @@ -1602,10 +1633,12 @@ export { getStaticProps as e } from "__TURBOPACK_VAR__" assert { ## Part 27 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 26 @@ -1619,10 +1652,12 @@ export { getStaticPaths as d } from "__TURBOPACK_VAR__" assert { ## Part 28 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 27 @@ -1636,10 +1671,12 @@ export { getServerSideProps as c } from "__TURBOPACK_VAR__" assert { ## Part 29 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 28 @@ -1653,10 +1690,12 @@ export { config as b } from "__TURBOPACK_VAR__" assert { ## Part 30 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 29 @@ -1670,10 +1709,12 @@ export { reportWebVitals as f } from "__TURBOPACK_VAR__" assert { ## Part 31 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 30 @@ -1687,10 +1728,12 @@ export { unstable_getStaticProps as l } from "__TURBOPACK_VAR__" assert { ## Part 32 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 31 @@ -1704,10 +1747,12 @@ export { unstable_getStaticPaths as k } from "__TURBOPACK_VAR__" assert { ## Part 33 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 32 @@ -1721,10 +1766,12 @@ export { unstable_getStaticParams as j } from "__TURBOPACK_VAR__" assert { ## Part 34 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 33 @@ -1738,10 +1785,12 @@ export { unstable_getServerProps as h } from "__TURBOPACK_VAR__" assert { ## Part 35 ```js import { o as hoist } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -18 + __turbopack_part__: -18, + __turbopack_original__: './helpers' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 34 @@ -1755,19 +1804,24 @@ export { unstable_getServerSideProps as i } from "__TURBOPACK_VAR__" assert { ## Part 36 ```js import { m as PagesRouteModule } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -14 + __turbopack_part__: -14, + __turbopack_original__: '../../server/future/route-modules/pages/module.compiled' }; import { n as RouteKind } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -16 + __turbopack_part__: -16, + __turbopack_original__: '../../server/future/route-kind' }; import { q as App } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -22 + __turbopack_part__: -22, + __turbopack_original__: 'VAR_MODULE_APP' }; import { p as Document } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -20 + __turbopack_part__: -20, + __turbopack_original__: 'VAR_MODULE_DOCUMENT' }; import { r as userland } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -24 + __turbopack_part__: -24, + __turbopack_original__: 'VAR_USERLAND' }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 35 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md index 589d413ecf8a4..ab72d78730a73 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/test-config-1/output.md @@ -594,7 +594,8 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "module" }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 @@ -842,7 +843,8 @@ import { d as foobar } from "__TURBOPACK_PART__" assert { __turbopack_part__: -7 }; import { e as upper } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -6 + __turbopack_part__: -6, + __turbopack_original__: "module" }; import "__TURBOPACK_PART__" assert { __turbopack_part__: 12 diff --git a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md index 2c53b9ad40ed9..8136c78b28982 100644 --- a/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md +++ b/turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/typeof-1/output.md @@ -265,13 +265,16 @@ export { MyModuleClientComponent as d } from "__TURBOPACK_VAR__" assert { ## Part 8 ```js import { d as MyModuleClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: 'my-module/MyModuleClientComponent' }; import { b as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: 'next/server' }; import { c as ClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../../ClientComponent' }; function GET() { return NextResponse.json({ @@ -386,13 +389,16 @@ export { MyModuleClientComponent as d } from "__TURBOPACK_VAR__" assert { ## Part 8 ```js import { d as MyModuleClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -7 + __turbopack_part__: -7, + __turbopack_original__: 'my-module/MyModuleClientComponent' }; import { b as NextResponse } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -3 + __turbopack_part__: -3, + __turbopack_original__: 'next/server' }; import { c as ClientComponent } from "__TURBOPACK_PART__" assert { - __turbopack_part__: -5 + __turbopack_part__: -5, + __turbopack_original__: '../../ClientComponent' }; function GET() { return NextResponse.json({