Unverified Commit bbeaeeaa authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

Revert "[turbopack] Set `liveness` of exports based on assignment ana… (#84207)

We believe this is causing an issue that was caught during internal
dogfooding.

This reverts commit ba227046.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
parent f9ee7a1a
...@@ -664,7 +664,7 @@ describe('Cache Components Errors', () => { ...@@ -664,7 +664,7 @@ describe('Cache Components Errors', () => {
} else { } else {
expect(output).toMatchInlineSnapshot(` expect(output).toMatchInlineSnapshot(`
"Error: Route "/dynamic-root": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense "Error: Route "/dynamic-root": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense
at <unknown> (bundler:///app/dynamic-root/indirection.tsx:7:34) at a (bundler:///app/dynamic-root/indirection.tsx:7:34)
at main (<anonymous>) at main (<anonymous>)
at body (<anonymous>) at body (<anonymous>)
at html (<anonymous>) at html (<anonymous>)
...@@ -2080,7 +2080,7 @@ describe('Cache Components Errors', () => { ...@@ -2080,7 +2080,7 @@ describe('Cache Components Errors', () => {
} else { } else {
expect(output).toMatchInlineSnapshot(` expect(output).toMatchInlineSnapshot(`
"Error: Route "/sync-attribution/guarded-async-unguarded-clientsync" used \`new Date()\` inside a Client Component without a Suspense boundary above it. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time-client "Error: Route "/sync-attribution/guarded-async-unguarded-clientsync" used \`new Date()\` inside a Client Component without a Suspense boundary above it. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time-client
at <unknown> (bundler:///app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx:5:16) at a (bundler:///app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx:5:16)
3 | export function SyncIO() { 3 | export function SyncIO() {
4 | // This is a sync IO access that should not cause an error 4 | // This is a sync IO access that should not cause an error
> 5 | const data = new Date().toISOString() > 5 | const data = new Date().toISOString()
...@@ -2210,9 +2210,12 @@ describe('Cache Components Errors', () => { ...@@ -2210,9 +2210,12 @@ describe('Cache Components Errors', () => {
"Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense "Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense
at a (<anonymous>) at a (<anonymous>)
at main (<anonymous>) at main (<anonymous>)
at b (<anonymous>)
at main (<anonymous>) at main (<anonymous>)
at body (<anonymous>) at body (<anonymous>)
at html (<anonymous>) at html (<anonymous>)
at c (<anonymous>)
at d (<anonymous>)
To get a more detailed stack trace and pinpoint the issue, try one of the following: To get a more detailed stack trace and pinpoint the issue, try one of the following:
- Start the app in development mode by running \`next dev\`, then open "/sync-attribution/unguarded-async-guarded-clientsync" in your browser to investigate the error. - Start the app in development mode by running \`next dev\`, then open "/sync-attribution/unguarded-async-guarded-clientsync" in your browser to investigate the error.
- Rerun the production build with \`next build --debug-prerender\` to generate better stack traces. - Rerun the production build with \`next build --debug-prerender\` to generate better stack traces.
...@@ -2386,7 +2389,7 @@ describe('Cache Components Errors', () => { ...@@ -2386,7 +2389,7 @@ describe('Cache Components Errors', () => {
} else { } else {
expect(output).toMatchInlineSnapshot(` expect(output).toMatchInlineSnapshot(`
"Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync" used \`new Date()\` inside a Client Component without a Suspense boundary above it. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time-client "Error: Route "/sync-attribution/unguarded-async-unguarded-clientsync" used \`new Date()\` inside a Client Component without a Suspense boundary above it. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time-client
at <unknown> (bundler:///app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx:5:16) at a (bundler:///app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx:5:16)
3 | export function SyncIO() { 3 | export function SyncIO() {
4 | // This is a sync IO access that should not cause an error 4 | // This is a sync IO access that should not cause an error
> 5 | const data = new Date().toISOString() > 5 | const data = new Date().toISOString()
......
...@@ -105,7 +105,7 @@ describe('build-output-prerender', () => { ...@@ -105,7 +105,7 @@ describe('build-output-prerender', () => {
// TODO(veil): Why is the location incomplete unless we enable --no-mangling? // TODO(veil): Why is the location incomplete unless we enable --no-mangling?
expect(getPrerenderOutput(next.cliOutput)).toMatchInlineSnapshot(` expect(getPrerenderOutput(next.cliOutput)).toMatchInlineSnapshot(`
"Error: Route "/client" used \`new Date()\` inside a Client Component without a Suspense boundary above it. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time-client "Error: Route "/client" used \`new Date()\` inside a Client Component without a Suspense boundary above it. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time-client
at <unknown> (bundler:///app/client/page.tsx:4:28) at c (bundler:///app/client/page.tsx:4:28)
2 | 2 |
3 | export default function Page() { 3 | export default function Page() {
> 4 | return <p>Current time: {new Date().toISOString()}</p> > 4 | return <p>Current time: {new Date().toISOString()}</p>
......
...@@ -402,7 +402,7 @@ pub async fn expand_star_exports( ...@@ -402,7 +402,7 @@ pub async fn expand_star_exports(
if key == "default" { if key == "default" {
continue; continue;
} }
esm_exports.entry(key.clone()).or_insert(asset); esm_exports.entry(key.clone()).or_insert_with(|| asset);
} }
for esm_ref in exports.star_exports.iter() { for esm_ref in exports.star_exports.iter() {
if let ReferencedAsset::Some(asset) = if let ReferencedAsset::Some(asset) =
......
...@@ -757,7 +757,6 @@ pub async fn analyze_ecmascript_module_internal( ...@@ -757,7 +757,6 @@ pub async fn analyze_ecmascript_module_internal(
&import_references, &import_references,
&mut analysis, &mut analysis,
analyze_mode, analyze_mode,
&var_graph,
); );
// ModuleReferencesVisitor has already called analysis.add_esm_reexport_reference // ModuleReferencesVisitor has already called analysis.add_esm_reexport_reference
// for any references in esm_exports // for any references in esm_exports
...@@ -3261,7 +3260,6 @@ struct ModuleReferencesVisitor<'a> { ...@@ -3261,7 +3260,6 @@ struct ModuleReferencesVisitor<'a> {
webpack_runtime: Option<(RcStr, Span)>, webpack_runtime: Option<(RcStr, Span)>,
webpack_entry: bool, webpack_entry: bool,
webpack_chunks: Vec<Lit>, webpack_chunks: Vec<Lit>,
var_graph: &'a VarGraph,
} }
impl<'a> ModuleReferencesVisitor<'a> { impl<'a> ModuleReferencesVisitor<'a> {
...@@ -3270,7 +3268,6 @@ impl<'a> ModuleReferencesVisitor<'a> { ...@@ -3270,7 +3268,6 @@ impl<'a> ModuleReferencesVisitor<'a> {
import_references: &'a [ResolvedVc<EsmAssetReference>], import_references: &'a [ResolvedVc<EsmAssetReference>],
analysis: &'a mut AnalyzeEcmascriptModuleResultBuilder, analysis: &'a mut AnalyzeEcmascriptModuleResultBuilder,
analyze_mode: AnalyzeMode, analyze_mode: AnalyzeMode,
var_graph: &'a VarGraph,
) -> Self { ) -> Self {
Self { Self {
analyze_mode, analyze_mode,
...@@ -3282,28 +3279,6 @@ impl<'a> ModuleReferencesVisitor<'a> { ...@@ -3282,28 +3279,6 @@ impl<'a> ModuleReferencesVisitor<'a> {
webpack_runtime: None, webpack_runtime: None,
webpack_entry: false, webpack_entry: false,
webpack_chunks: Vec::new(), webpack_chunks: Vec::new(),
var_graph,
}
}
}
impl<'a> ModuleReferencesVisitor<'a> {
/// Returns true if the given export identifier is considered "live". This means it might
/// change values after module evaluation.
fn is_export_ident_live(&self, id: &Ident) -> bool {
if let Some(crate::analyzer::graph::VarMeta {
value: _,
assignment_scopes: assignment_kinds,
}) = self.var_graph.values.get(&id.to_id())
{
// If all assignments are in module scope, the export is not live.
*assignment_kinds != crate::analyzer::graph::AssignmentScopes::AllInModuleEvalScope
} else {
// If we haven't computed a value for it, that means it might be
// A free variable
// an imported variable
// In those cases, we just assume that the value is live since we don't know anything
true
} }
} }
} }
...@@ -3312,10 +3287,10 @@ fn as_parent_path(ast_path: &AstNodePath<AstParentNodeRef<'_>>) -> Vec<AstParent ...@@ -3312,10 +3287,10 @@ fn as_parent_path(ast_path: &AstNodePath<AstParentNodeRef<'_>>) -> Vec<AstParent
ast_path.iter().map(|n| n.kind()).collect() ast_path.iter().map(|n| n.kind()).collect()
} }
fn for_each_ident_in_pat(pat: &Pat, f: &mut impl FnMut(&Ident)) { fn for_each_ident_in_pat(pat: &Pat, f: &mut impl FnMut(RcStr)) {
match pat { match pat {
Pat::Ident(BindingIdent { id, .. }) => { Pat::Ident(BindingIdent { id, .. }) => {
f(id); f(id.sym.as_str().into());
} }
Pat::Array(ArrayPat { elems, .. }) => elems.iter().for_each(|e| { Pat::Array(ArrayPat { elems, .. }) => elems.iter().for_each(|e| {
if let Some(e) = e { if let Some(e) = e {
...@@ -3331,7 +3306,7 @@ fn for_each_ident_in_pat(pat: &Pat, f: &mut impl FnMut(&Ident)) { ...@@ -3331,7 +3306,7 @@ fn for_each_ident_in_pat(pat: &Pat, f: &mut impl FnMut(&Ident)) {
for_each_ident_in_pat(value, f); for_each_ident_in_pat(value, f);
} }
ObjectPatProp::Assign(AssignPatProp { key, .. }) => { ObjectPatProp::Assign(AssignPatProp { key, .. }) => {
f(key); f(key.sym.as_str().into());
} }
ObjectPatProp::Rest(RestPat { arg, .. }) => { ObjectPatProp::Rest(RestPat { arg, .. }) => {
for_each_ident_in_pat(arg, f); for_each_ident_in_pat(arg, f);
...@@ -3372,7 +3347,6 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> { ...@@ -3372,7 +3347,6 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
.map(find_turbopack_part_id_in_asserts) .map(find_turbopack_part_id_in_asserts)
.is_some(); .is_some();
// This is for a statement like `export {a, b as c}` with no `from` clause.
if export.src.is_none() { if export.src.is_none() {
for spec in export.specifiers.iter() { for spec in export.specifiers.iter() {
fn to_rcstr(name: &ModuleExportName) -> RcStr { fn to_rcstr(name: &ModuleExportName) -> RcStr {
...@@ -3413,24 +3387,14 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> { ...@@ -3413,24 +3387,14 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
EsmExport::ImportedNamespace(ResolvedVc::upcast(esm_ref)) EsmExport::ImportedNamespace(ResolvedVc::upcast(esm_ref))
} }
} else { } else {
let liveness = match orig {
ModuleExportName::Ident(ident) => {
if self.is_export_ident_live(ident) {
Liveness::Live
} else {
Liveness::Constant
}
}
ModuleExportName::Str(_) => Liveness::Constant,
};
EsmExport::LocalBinding( EsmExport::LocalBinding(
binding_name, binding_name,
if is_fake_esm { if is_fake_esm {
// it is likely that these are not always actually mutable.
Liveness::Mutable Liveness::Mutable
} else { } else {
liveness // If this is `export {foo} from 'mod'` and `foo` is a const
// in mod then we could export as Const here.
Liveness::Live
}, },
) )
} }
...@@ -3455,27 +3419,30 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> { ...@@ -3455,27 +3419,30 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
) { ) {
{ {
let decl: &Decl = &export.decl; let decl: &Decl = &export.decl;
let insert_export_binding = &mut |id: &Ident| { let insert_export_binding = &mut |name: RcStr, liveness: Liveness| {
let liveness = if self.is_export_ident_live(id) {
Liveness::Live
} else {
Liveness::Constant
};
let name: RcStr = id.sym.as_str().into();
self.esm_exports self.esm_exports
.insert(name.clone(), EsmExport::LocalBinding(name, liveness)); .insert(name.clone(), EsmExport::LocalBinding(name, liveness));
}; };
match decl { match decl {
Decl::Class(ClassDecl { ident, .. }) | Decl::Fn(FnDecl { ident, .. }) => { Decl::Class(ClassDecl { ident, .. }) | Decl::Fn(FnDecl { ident, .. }) => {
insert_export_binding(ident); // TODO: examine whether the value is ever mutated rather than just checking
// 'const'
insert_export_binding(ident.sym.as_str().into(), Liveness::Live);
} }
Decl::Var(var_decl) => { Decl::Var(var_decl) => {
var_decl // TODO: examine whether the value is ever mutated rather than just checking
.decls // 'const'
.iter() let liveness = match var_decl.kind {
.for_each(|VarDeclarator { name, .. }| { VarDeclKind::Var => Liveness::Live,
for_each_ident_in_pat(name, insert_export_binding); VarDeclKind::Let => Liveness::Live,
}); VarDeclKind::Const => Liveness::Constant,
};
let decls = &*var_decl.decls;
decls.iter().for_each(|VarDeclarator { name, .. }| {
for_each_ident_in_pat(name, &mut |name| {
insert_export_binding(name, liveness)
})
});
} }
Decl::Using(_) => { Decl::Using(_) => {
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export#:~:text=You%20cannot%20use%20export%20on%20a%20using%20or%20await%20using%20declaration // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export#:~:text=You%20cannot%20use%20export%20on%20a%20using%20or%20await%20using%20declaration
...@@ -3523,22 +3490,21 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> { ...@@ -3523,22 +3490,21 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
) { ) {
match &export.decl { match &export.decl {
DefaultDecl::Class(ClassExpr { ident, .. }) | DefaultDecl::Fn(FnExpr { ident, .. }) => { DefaultDecl::Class(ClassExpr { ident, .. }) | DefaultDecl::Fn(FnExpr { ident, .. }) => {
let export = match ident { self.esm_exports.insert(
Some(ident) => EsmExport::LocalBinding( rcstr!("default"),
ident.sym.as_str().into(), EsmExport::LocalBinding(
if self.is_export_ident_live(ident) { ident
.as_ref()
.map(|i| i.sym.as_str().into())
.unwrap_or_else(|| magic_identifier::mangle("default export").into()),
// Default export declarations can only be mutated if they have a name.
if ident.is_some() {
Liveness::Live Liveness::Live
} else { } else {
Liveness::Constant Liveness::Constant
}, },
), ),
// If there is no name, like `export default function(){}` then it is not live. );
None => EsmExport::LocalBinding(
magic_identifier::mangle("default export").into(),
Liveness::Constant,
),
};
self.esm_exports.insert(rcstr!("default"), export);
} }
DefaultDecl::TsInterfaceDecl(..) => { DefaultDecl::TsInterfaceDecl(..) => {
// ignore // ignore
......
...@@ -144,10 +144,10 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleLocalsModule { ...@@ -144,10 +144,10 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleLocalsModule {
EsmExport::ImportedBinding(..) | EsmExport::ImportedNamespace(..) => { EsmExport::ImportedBinding(..) | EsmExport::ImportedNamespace(..) => {
// not included in locals module // not included in locals module
} }
EsmExport::LocalBinding(local_name, liveness) => { EsmExport::LocalBinding(local_name, mutable) => {
exports.insert( exports.insert(
name.clone(), name.clone(),
EsmExport::LocalBinding(local_name.clone(), *liveness), EsmExport::LocalBinding(local_name.clone(), *mutable),
); );
} }
EsmExport::Error => { EsmExport::Error => {
......
import * as liveDefaultClass from './live_default_class.js'
import * as liveExports from './live_exports.js' import * as liveExports from './live_exports.js'
import {
default as liveDefaultClass,
setDefaultClass,
} from './live_default_class.js'
import * as constDefaultExportFunction from './const_default_export_function.js' import * as constDefaultExportFunction from './const_default_export_function.js'
it('hoisted declarations are live', () => { it('hoisted declarations are live', () => {
...@@ -9,15 +12,15 @@ it('hoisted declarations are live', () => { ...@@ -9,15 +12,15 @@ it('hoisted declarations are live', () => {
}) })
it('default class export declarations are live', () => { it('default class export declarations are live', () => {
expect(liveDefaultClass.default.default()).toBe('defaultClass') expect(liveDefaultClass.default()).toBe('defaultClass')
liveDefaultClass.setDefaultClass( setDefaultClass(
class { class {
static default() { static default() {
return 'patched' return 'patched'
} }
} }
) )
expect(liveDefaultClass.default.default()).toBe('patched') expect(liveDefaultClass.default()).toBe('patched')
}) })
it('default function export declarations are live', () => { it('default function export declarations are live', () => {
...@@ -33,28 +36,10 @@ it('exported lets are live', () => { ...@@ -33,28 +36,10 @@ it('exported lets are live', () => {
}) })
it('exported bindings that are not mutated are not live', () => { it('exported bindings that are not mutated are not live', () => {
expect( // These should be bound to values, but we don't have the analysis yet
Object.getOwnPropertyDescriptor(liveExports, 'obviouslyneverMutated') expectGetter(liveExports, 'obviouslyneverMutated')
).toEqual({ expectGetter(liveExports, 'neverMutated')
configurable: false, expectGetter(constDefaultExportFunction, 'default')
enumerable: true,
value: 'obviouslyneverMutated',
writable: false,
})
expect(Object.getOwnPropertyDescriptor(liveExports, 'neverMutated')).toEqual({
configurable: false,
enumerable: true,
value: 'neverMutated',
writable: false,
})
expect(
Object.getOwnPropertyDescriptor(constDefaultExportFunction, 'default')
).toEqual({
configurable: false,
enumerable: true,
value: constDefaultExportFunction.default,
writable: false,
})
}) })
it('exported bindings that are free vars are live', () => { it('exported bindings that are free vars are live', () => {
......
import { local, namedFunction, default as defaultFunction } from 'lib' import { local } from 'lib'
local() local()
namedFunction()
defaultFunction()
...@@ -9,7 +9,3 @@ function localUnused() { ...@@ -9,7 +9,3 @@ function localUnused() {
} }
export { local, localUnused } export { local, localUnused }
export function namedFunction() {}
export default function defaultFunction() {}
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$reexport$2d$with$2d$locals$2f$input$2f$node_modules$2f$lib$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/index.js [test] (ecmascript) <locals>"); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$reexport$2d$with$2d$locals$2f$input$2f$node_modules$2f$lib$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/index.js [test] (ecmascript) <locals>");
; ;
(0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$reexport$2d$with$2d$locals$2f$input$2f$node_modules$2f$lib$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$locals$3e$__["local"])(); (0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$reexport$2d$with$2d$locals$2f$input$2f$node_modules$2f$lib$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$locals$3e$__["local"])();
(0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$reexport$2d$with$2d$locals$2f$input$2f$node_modules$2f$lib$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$locals$3e$__["namedFunction"])();
(0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$reexport$2d$with$2d$locals$2f$input$2f$node_modules$2f$lib$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$locals$3e$__["default"])();
__turbopack_context__.s([]); __turbopack_context__.s([]);
}), }),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/unused.js [test] (ecmascript)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/unused.js [test] (ecmascript)", ((__turbopack_context__) => {
...@@ -35,18 +33,9 @@ function localUnused() { ...@@ -35,18 +33,9 @@ function localUnused() {
console.log('This is a local unused function'); console.log('This is a local unused function');
} }
; ;
function namedFunction() {}
function defaultFunction() {}
__turbopack_context__.s([ __turbopack_context__.s([
"default",
0,
defaultFunction,
"local", "local",
0, ()=>local
local,
"namedFunction",
0,
namedFunction
]); ]);
}), }),
]); ]);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
"version": 3, "version": 3,
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/index.js"],"sourcesContent":["import { local, namedFunction, default as defaultFunction } from 'lib'\n\nlocal()\nnamedFunction()\n\ndefaultFunction()\n"],"names":[],"mappings":"AAAA;;AAEA,IAAA,yRAAK;AACL,IAAA,iSAAa;AAEb,IAAA,2RAAe"}}, {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/index.js"],"sourcesContent":["import { local } from 'lib'\n\nlocal()\n"],"names":[],"mappings":"AAAA;;AAEA,IAAA,yRAAK"}},
{"offset": {"line": 14, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/unused.js"],"sourcesContent":["export function unusedStar() {}\n"],"names":[],"mappings":"AAAO,SAAS,cAAc","ignoreList":[0]}}, {"offset": {"line": 12, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/unused.js"],"sourcesContent":["export function unusedStar() {}\n"],"names":[],"mappings":"AAAO,SAAS,cAAc","ignoreList":[0]}},
{"offset": {"line": 20, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/unused-star.js"],"sourcesContent":["export function unused() {}\n"],"names":[],"mappings":"AAAO,SAAS,UAAU","ignoreList":[0]}}, {"offset": {"line": 18, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/unused-star.js"],"sourcesContent":["export function unused() {}\n"],"names":[],"mappings":"AAAO,SAAS,UAAU","ignoreList":[0]}},
{"offset": {"line": 26, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/index.js"],"sourcesContent":["export { unused } from './unused.js'\nexport * from './unused-star.js'\n\nfunction local() {\n console.log('This is a local function')\n}\nfunction localUnused() {\n console.log('This is a local unused function')\n}\n\nexport { local, localUnused }\n\nexport function namedFunction() {}\n\nexport default function defaultFunction() {}\n"],"names":[],"mappings":"AAAA;AACA;;;AAEA,SAAS;IACP,QAAQ,GAAG,CAAC;AACd;AACA,SAAS;IACP,QAAQ,GAAG,CAAC;AACd;;AAIO,SAAS,iBAAiB;AAElB,SAAS,mBAAmB","ignoreList":[0]}}] {"offset": {"line": 24, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/index.js"],"sourcesContent":["export { unused } from './unused.js'\nexport * from './unused-star.js'\n\nfunction local() {\n console.log('This is a local function')\n}\nfunction localUnused() {\n console.log('This is a local unused function')\n}\n\nexport { local, localUnused }\n"],"names":[],"mappings":"AAAA;AACA;;;AAEA,SAAS;IACP,QAAQ,GAAG,CAAC;AACd;AACA,SAAS;IACP,QAAQ,GAAG,CAAC;AACd","ignoreList":[0]}}]
} }
\ No newline at end of file
...@@ -23,8 +23,7 @@ function getDog() { ...@@ -23,8 +23,7 @@ function getDog() {
} }
__turbopack_context__.s([ __turbopack_context__.s([
"getCat", "getCat",
0, ()=>getCat
getCat
]); ]);
}), }),
]); ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment