Unverified Commit a62b7d06 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

Revert "Revert "[turbopack] Set `liveness` of exports based on assignment…

Revert "Revert "[turbopack] Set `liveness` of exports based on assignment analysis (#82802)"" (#87214)

This reverts commit 7c8f84712020d388fb64ae5845a67cc370798115 which reverted ba227046.  It was reverted because it triggered a bug in the payloadcms system which relied on distinguishing between server components and client references based on whether or not the `Function.prototype.name` property was the empty string.  This was fixed in https://github.com/payloadcms/payload/pull/13931 which has now been released for a while.  The triggering issue was that this PR gives SWC more opportunities to delete function names and thus functions become anonymous.  The effect can also be seen in some of the snapshot updates.

The original PR description was:

Use the analysis added in #82763 to annotate exports as 'live' or 'const'

This triggers previously implemented support to then bind the resulting values as 'readonly values' instead of getter functions. This helps with both code size and execution time since parsing/allocating even these tiny getter functions is not free.
parent c95eb899
......@@ -610,7 +610,7 @@ describe('Cache Components Errors', () => {
} else {
expect(output).toMatchInlineSnapshot(`
"Error: Route "/dynamic-root": Uncached data was accessed outside of <Suspense>. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route
at a (app/dynamic-root/indirection.tsx:7:34)
at <unknown> (app/dynamic-root/indirection.tsx:7:34)
at main (<anonymous>)
at body (<anonymous>)
at html (<anonymous>)
......@@ -1841,7 +1841,7 @@ describe('Cache Components Errors', () => {
if (isTurbopack) {
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
at a (app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx:5:16)
at <unknown> (app/sync-attribution/guarded-async-unguarded-clientsync/client.tsx:5:16)
3 | export function SyncIO() {
4 | // This is a sync IO access that should not cause an error
> 5 | const data = new Date().toISOString()
......@@ -1947,12 +1947,9 @@ describe('Cache Components Errors', () => {
"Error: Route "/sync-attribution/unguarded-async-guarded-clientsync": Uncached data was accessed outside of <Suspense>. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route
at a (<anonymous>)
at main (<anonymous>)
at b (<anonymous>)
at main (<anonymous>)
at body (<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:
- 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.
......@@ -2104,7 +2101,7 @@ describe('Cache Components Errors', () => {
if (isTurbopack) {
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
at a (app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx:5:16)
at <unknown> (app/sync-attribution/unguarded-async-unguarded-clientsync/client.tsx:5:16)
3 | export function SyncIO() {
4 | // This is a sync IO access that should not cause an error
> 5 | const data = new Date().toISOString()
......@@ -3339,7 +3336,7 @@ describe('Cache Components Errors', () => {
expect(output).toMatchInlineSnapshot(`
"Error: "use cache: private" must not be used within \`unstable_cache()\`.
at <unknown> (app/use-cache-private-in-unstable-cache/page.tsx:21:38)
at async h (app/use-cache-private-in-unstable-cache/page.tsx:16:16)
at async g (app/use-cache-private-in-unstable-cache/page.tsx:16:16)
19 | }
20 |
> 21 | const getCachedData = unstable_cache(async () => {
......
......@@ -67,7 +67,7 @@ describe('build-output-prerender', () => {
// TODO(veil): Why is the location incomplete unless we enable --no-mangling?
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
at c (app/client/page.tsx:4:28)
at <unknown> (app/client/page.tsx:4:28)
2 |
3 | export default function Page() {
> 4 | return <p>Current time: {new Date().toISOString()}</p>
......
......@@ -398,7 +398,7 @@ pub async fn expand_star_exports(
if key == "default" {
continue;
}
esm_exports.entry(key.clone()).or_insert_with(|| asset);
esm_exports.entry(key.clone()).or_insert(asset);
}
for esm_ref in exports.star_exports.iter() {
if let ReferencedAsset::Some(asset) =
......
......@@ -865,6 +865,7 @@ async fn analyze_ecmascript_module_internal(
&import_references,
&mut analysis,
analyze_mode,
&var_graph,
);
// ModuleReferencesVisitor has already called analysis.add_esm_reexport_reference
// for any references in esm_exports
......@@ -3538,6 +3539,7 @@ struct ModuleReferencesVisitor<'a> {
webpack_runtime: Option<(RcStr, Span)>,
webpack_entry: bool,
webpack_chunks: Vec<Lit>,
var_graph: &'a VarGraph,
}
impl<'a> ModuleReferencesVisitor<'a> {
......@@ -3546,6 +3548,7 @@ impl<'a> ModuleReferencesVisitor<'a> {
import_references: &'a [ResolvedVc<EsmAssetReference>],
analysis: &'a mut AnalyzeEcmascriptModuleResultBuilder,
analyze_mode: AnalyzeMode,
var_graph: &'a VarGraph,
) -> Self {
Self {
analyze_mode,
......@@ -3557,6 +3560,32 @@ impl<'a> ModuleReferencesVisitor<'a> {
webpack_runtime: None,
webpack_entry: false,
webpack_chunks: Vec::new(),
var_graph,
}
}
}
impl<'a> ModuleReferencesVisitor<'a> {
/// Returns the liveness of a given export identifier. An export is live if it might
/// change values after module evaluation.
fn get_export_ident_liveness(&self, id: Id) -> Liveness {
if let Some(crate::analyzer::graph::VarMeta {
value: _,
assignment_scopes: assignment_kinds,
}) = self.var_graph.values.get(&id)
{
// If all assignments are in module scope, the export is not live.
if *assignment_kinds != crate::analyzer::graph::AssignmentScopes::AllInModuleEvalScope {
Liveness::Live
} else {
Liveness::Constant
}
} 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
Liveness::Live
}
}
}
......@@ -3625,6 +3654,7 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
.map(find_turbopack_part_id_in_asserts)
.is_some();
// This is for a statement like `export {a, b as c}` with no `from` clause.
if export.src.is_none() {
for spec in export.specifiers.iter() {
fn to_rcstr(name: &ModuleExportName) -> RcStr {
......@@ -3665,14 +3695,20 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
EsmExport::ImportedNamespace(ResolvedVc::upcast(esm_ref))
}
} else {
let liveness = match orig {
ModuleExportName::Ident(ident) => {
self.get_export_ident_liveness(ident.to_id())
}
ModuleExportName::Str(_) => Liveness::Constant,
};
EsmExport::LocalBinding(
binding_name,
if is_fake_esm {
// it is likely that these are not always actually mutable.
Liveness::Mutable
} else {
// If this is `export {foo} from 'mod'` and `foo` is a const
// in mod then we could export as Const here.
Liveness::Live
liveness
},
)
}
......@@ -3697,30 +3733,23 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
) {
{
let decl: &Decl = &export.decl;
let insert_export_binding = &mut |name: RcStr, liveness: Liveness| {
let insert_export_binding = &mut |id: &Atom, ctx: SyntaxContext| {
let liveness = self.get_export_ident_liveness((id.clone(), ctx));
let name: RcStr = id.as_str().into();
self.esm_exports
.insert(name.clone(), EsmExport::LocalBinding(name, liveness));
};
match decl {
Decl::Class(ClassDecl { ident, .. }) | Decl::Fn(FnDecl { ident, .. }) => {
// TODO: examine whether the value is ever mutated rather than just checking
// 'const'
insert_export_binding(ident.sym.as_str().into(), Liveness::Live);
insert_export_binding(&ident.sym, ident.ctxt);
}
Decl::Var(var_decl) => {
// TODO: examine whether the value is ever mutated rather than just checking
// 'const'
let liveness = match var_decl.kind {
VarDeclKind::Var => Liveness::Live,
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.as_str().into(), liveness)
})
});
var_decl
.decls
.iter()
.for_each(|VarDeclarator { name, .. }| {
for_each_ident_in_pat(name, insert_export_binding);
});
}
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
......@@ -3768,21 +3797,18 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
) {
match &export.decl {
DefaultDecl::Class(ClassExpr { ident, .. }) | DefaultDecl::Fn(FnExpr { ident, .. }) => {
self.esm_exports.insert(
rcstr!("default"),
EsmExport::LocalBinding(
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
} else {
Liveness::Constant
},
let export = match ident {
Some(ident) => EsmExport::LocalBinding(
ident.sym.as_str().into(),
self.get_export_ident_liveness(ident.to_id()),
),
);
// 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(..) => {
// ignore
......
......@@ -153,10 +153,10 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleLocalsModule {
EsmExport::ImportedBinding(..) | EsmExport::ImportedNamespace(..) => {
// not included in locals module
}
EsmExport::LocalBinding(local_name, mutable) => {
EsmExport::LocalBinding(local_name, liveness) => {
exports.insert(
name.clone(),
EsmExport::LocalBinding(local_name.clone(), *mutable),
EsmExport::LocalBinding(local_name.clone(), *liveness),
);
}
EsmExport::Error => {
......
import * as liveDefaultClass from './live_default_class.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'
it('hoisted declarations are live', () => {
......@@ -12,15 +9,15 @@ it('hoisted declarations are live', () => {
})
it('default class export declarations are live', () => {
expect(liveDefaultClass.default()).toBe('defaultClass')
setDefaultClass(
expect(liveDefaultClass.default.default()).toBe('defaultClass')
liveDefaultClass.setDefaultClass(
class {
static default() {
return 'patched'
}
}
)
expect(liveDefaultClass.default()).toBe('patched')
expect(liveDefaultClass.default.default()).toBe('patched')
})
it('default function export declarations are live', () => {
......@@ -36,10 +33,28 @@ it('exported lets are live', () => {
})
it('exported bindings that are not mutated are not live', () => {
// These should be bound to values, but we don't have the analysis yet
expectGetter(liveExports, 'obviouslyneverMutated')
expectGetter(liveExports, 'neverMutated')
expectGetter(constDefaultExportFunction, 'default')
expect(
Object.getOwnPropertyDescriptor(liveExports, 'obviouslyneverMutated')
).toEqual({
configurable: false,
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', () => {
......
import { local } from 'lib'
import { local, namedFunction, default as defaultFunction } from 'lib'
local()
namedFunction()
defaultFunction()
......@@ -9,3 +9,7 @@ function localUnused() {
}
export { local, localUnused }
export function namedFunction() {}
export default function defaultFunction() {}
......@@ -5,6 +5,8 @@
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$__["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([]);
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/reexport-with-locals/input/node_modules/lib/unused.js [test] (ecmascript)", ((__turbopack_context__) => {
......@@ -33,9 +35,18 @@ function localUnused() {
console.log('This is a local unused function');
}
;
function namedFunction() {}
function defaultFunction() {}
__turbopack_context__.s([
"default",
0,
defaultFunction,
"local",
()=>local
0,
local,
"namedFunction",
0,
namedFunction
]);
}),
]);
......
......@@ -2,8 +2,8 @@
"version": 3,
"sources": [],
"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 } from 'lib'\n\nlocal()\n"],"names":[],"mappings":"AAAA;;AAEA,IAAA,yRAAK"}},
{"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": 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": 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]}}]
{"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": 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": 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": 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]}}]
}
\ No newline at end of file
......@@ -6,7 +6,8 @@ function leafX() {}
function leafY() {}
__turbopack_context__.s([
"leafY",
()=>leafY
0,
leafY
]);
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/library/shared.js [test] (ecmascript)", ((__turbopack_context__) => {
......@@ -22,7 +23,8 @@ function sharedY() {
}
__turbopack_context__.s([
"sharedY",
()=>sharedY
0,
sharedY
]);
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/library/y.js [test] (ecmascript)", ((__turbopack_context__) => {
......@@ -36,7 +38,8 @@ function y() {
}
__turbopack_context__.s([
"y",
()=>y
0,
y
]);
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/a.js [test] (ecmascript)", ((__turbopack_context__) => {
......@@ -57,7 +60,8 @@ function used() {
}
__turbopack_context__.s([
"used",
()=>used
0,
used
]);
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/index.js [test] (ecmascript)", ((__turbopack_context__) => {
......
......@@ -3,8 +3,8 @@
"sources": [],
"sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/library/leaf.js"],"sourcesContent":["export function leafX() {}\nexport function leafY() {}\n"],"names":[],"mappings":"AAAO,SAAS,SAAS;AAClB,SAAS,SAAS"}},
{"offset": {"line": 14, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/library/shared.js"],"sourcesContent":["import { leafX, leafY } from './leaf'\n\nexport function sharedX() {\n leafX()\n}\nexport function sharedY() {\n leafY()\n}\n"],"names":[],"mappings":"AAAA;;AAEO,SAAS;IACd,IAAA,uOAAK;AACP;AACO,SAAS;IACd,IAAA,uOAAK;AACP"}},
{"offset": {"line": 30, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/library/y.js"],"sourcesContent":["import { sharedY } from './shared'\n\nglobalThis.yBundled = true\n\nexport function y() {\n sharedY()\n}\n"],"names":[],"mappings":"AAAA;;AAEA,WAAW,QAAQ,GAAG;AAEf,SAAS;IACd,IAAA,2OAAO;AACT"}},
{"offset": {"line": 44, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/a.js"],"sourcesContent":["import { x } from './library/x.js'\nimport { y } from './library/y.js'\n\ny()\n\nfunction helper() {\n return x()\n}\n\nexport function unused() {\n return helper()\n}\n\nexport function used() {\n return 1234\n}\n"],"names":[],"mappings":"AACA;;;AAEA,IAAA,gOAAC;AAED,SAAS;IACP,OAAO,IAAA,gOAAC;AACV;AAEO,SAAS;IACd,OAAO;AACT;AAEO,SAAS;IACd,OAAO;AACT"}},
{"offset": {"line": 65, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/index.js"],"sourcesContent":["import { used } from './a.js'\n\nconsole.log(used)\n"],"names":[],"mappings":"AAAA;;AAEA,QAAQ,GAAG,CAAC,wNAAI"}}]
{"offset": {"line": 15, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/library/shared.js"],"sourcesContent":["import { leafX, leafY } from './leaf'\n\nexport function sharedX() {\n leafX()\n}\nexport function sharedY() {\n leafY()\n}\n"],"names":[],"mappings":"AAAA;;AAEO,SAAS;IACd,IAAA,uOAAK;AACP;AACO,SAAS;IACd,IAAA,uOAAK;AACP"}},
{"offset": {"line": 32, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/library/y.js"],"sourcesContent":["import { sharedY } from './shared'\n\nglobalThis.yBundled = true\n\nexport function y() {\n sharedY()\n}\n"],"names":[],"mappings":"AAAA;;AAEA,WAAW,QAAQ,GAAG;AAEf,SAAS;IACd,IAAA,2OAAO;AACT"}},
{"offset": {"line": 47, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/a.js"],"sourcesContent":["import { x } from './library/x.js'\nimport { y } from './library/y.js'\n\ny()\n\nfunction helper() {\n return x()\n}\n\nexport function unused() {\n return helper()\n}\n\nexport function used() {\n return 1234\n}\n"],"names":[],"mappings":"AACA;;;AAEA,IAAA,gOAAC;AAED,SAAS;IACP,OAAO,IAAA,gOAAC;AACV;AAEO,SAAS;IACd,OAAO;AACT;AAEO,SAAS;IACd,OAAO;AACT"}},
{"offset": {"line": 69, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/exports/input/index.js"],"sourcesContent":["import { used } from './a.js'\n\nconsole.log(used)\n"],"names":[],"mappings":"AAAA;;AAEA,QAAQ,GAAG,CAAC,wNAAI"}}]
}
\ No newline at end of file
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