Unverified Commit 044a7ac3 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

turbopack: handle TypeScript in side effect annotations

Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent 8c875cb8
...@@ -2460,12 +2460,6 @@ impl VisitAstPath for Analyzer<'_, '_> { ...@@ -2460,12 +2460,6 @@ impl VisitAstPath for Analyzer<'_, '_> {
// Attempt to add import effects. // Attempt to add import effects.
if let Some((esm_reference_index, export)) = self.eval_context.imports.get_binding(&id) { if let Some((esm_reference_index, export)) = self.eval_context.imports.get_binding(&id) {
let static_member = member_access_parent(ast_path).and_then(|member| {
self.eval_context
.eval_member_prop(self.arena, &member.prop)
.and_then(|prop| prop.as_str().map(|prop| (member, RcStr::from(prop))))
});
// Optimization: Look for a MemberExpr to see if we only access a few members from the // Optimization: Look for a MemberExpr to see if we only access a few members from the
// module, add those specific effects instead of depending on the entire module. // module, add those specific effects instead of depending on the entire module.
// //
...@@ -2475,13 +2469,15 @@ impl VisitAstPath for Analyzer<'_, '_> { ...@@ -2475,13 +2469,15 @@ impl VisitAstPath for Analyzer<'_, '_> {
.eval_context .eval_context
.imports .imports
.should_import_all(esm_reference_index) .should_import_all(esm_reference_index)
&& let Some((member, prop)) = &static_member && let Some(member) = member_access_parent(ast_path)
&& let Some(prop) = self.eval_context.eval_member_prop(self.arena, &member.prop)
&& let Some(prop_str) = prop.as_str()
{ {
// a namespace member access like // a namespace member access like
// `import * as ns from "..."; ns.exportName` // `import * as ns from "..."; ns.exportName`
self.add_effect(Effect::ImportedBinding { self.add_effect(Effect::ImportedBinding {
esm_reference_index, esm_reference_index,
export: Some(prop.clone()), export: Some(prop_str.into()),
member: None, member: None,
// point to the MemberExpression instead // point to the MemberExpression instead
ast_path: as_parent_path_skip_in(self.arena, ast_path, 1), ast_path: as_parent_path_skip_in(self.arena, ast_path, 1),
......
...@@ -55,7 +55,7 @@ impl NoSideEffectsCollector<'_> { ...@@ -55,7 +55,7 @@ impl NoSideEffectsCollector<'_> {
} }
impl Visit for NoSideEffectsCollector<'_> { impl Visit for NoSideEffectsCollector<'_> {
noop_visit_type!(fail); noop_visit_type!();
fn visit_export_decl(&mut self, export: &ExportDecl) { fn visit_export_decl(&mut self, export: &ExportDecl) {
export.visit_children_with(self); export.visit_children_with(self);
...@@ -110,3 +110,55 @@ impl Visit for NoSideEffectsCollector<'_> { ...@@ -110,3 +110,55 @@ impl Visit for NoSideEffectsCollector<'_> {
} }
} }
} }
#[cfg(test)]
mod tests {
use swc_core::{
common::{FileName, GLOBALS, SourceMap, comments::SingleThreadedComments},
ecma::{
ast::EsVersion,
parser::{Syntax, TsSyntax, parse_file_as_program},
},
};
use super::*;
#[test]
fn collects_annotations_without_visiting_typescript_nodes() {
GLOBALS.set(&Default::default(), || {
let source_map = SourceMap::default();
let source = source_map.new_source_file(
FileName::Custom("fixture.ts".into()).into(),
r#"
interface Shape { value: string }
type Alias = Shape["value"]
export const annotated: (value: Alias) => Alias =
/*#__NO_SIDE_EFFECTS__*/ function (value: Alias): Alias { return value }
export default /*#__NO_SIDE_EFFECTS__*/ function (value: Alias): Alias {
return value
}
"#,
);
let comments = SingleThreadedComments::default();
let mut errors = Vec::new();
let program = parse_file_as_program(
&source,
Syntax::Typescript(TsSyntax::default()),
EsVersion::EsNext,
Some(&comments),
&mut errors,
)
.expect("TypeScript fixture should parse");
assert!(errors.is_empty(), "fixture should not contain parse errors");
let info = collect_no_side_effects(&program, Some(&comments));
assert!(
info.bindings.iter().any(|(name, _)| name == "annotated"),
"annotated TypeScript binding should be collected"
);
assert!(info.default_export());
});
}
}
use anyhow::Result; use anyhow::Result;
use bincode::{Decode, Encode}; use bincode::{Decode, Encode};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use swc_core::ecma::{ use swc_core::{
atoms::atom,
base::SwcComments,
common::{
DUMMY_SP, Spanned,
comments::{Comment, CommentKind, Comments},
},
ecma::{
ast::{Expr, KeyValueProp, Prop, PropName, SimpleAssignTarget}, ast::{Expr, KeyValueProp, Prop, PropName, SimpleAssignTarget},
visit::fields::{CalleeField, PropField}, visit::fields::{
CalleeField, ExprField, MemberExprField, ParenExprField, PropField, TaggedTplField,
VarDeclaratorField,
},
},
}; };
use turbo_rcstr::RcStr; use turbo_rcstr::RcStr;
use turbo_tasks::{FxIndexMap, NonLocalValue, ResolvedVc, Vc}; use turbo_tasks::{FxIndexMap, NonLocalValue, ResolvedVc, Vc};
...@@ -17,12 +28,14 @@ use crate::{ ...@@ -17,12 +28,14 @@ use crate::{
references::esm::{ references::esm::{
EsmAssetReference, EsmAssetReference,
base::{ReferencedAsset, ReferencedAssetIdent}, base::{ReferencedAsset, ReferencedAssetIdent},
export::is_export_no_side_effects,
}, },
}; };
#[derive(Clone, Debug, PartialEq, Eq, NonLocalValue, Encode, Decode, Hash)] #[derive(Clone, Debug, PartialEq, Eq, NonLocalValue, Encode, Decode, Hash)]
struct EsmBinding { struct EsmBinding {
export: Option<RcStr>, export: Option<RcStr>,
namespace_member: Option<RcStr>,
ast_path: AstPathId, ast_path: AstPathId,
keep_this: bool, keep_this: bool,
} }
...@@ -50,6 +63,22 @@ impl EsmBindingsBuilder { ...@@ -50,6 +63,22 @@ impl EsmBindingsBuilder {
.or_default() .or_default()
.push(EsmBinding { .push(EsmBinding {
export, export,
namespace_member: None,
ast_path,
keep_this: false,
});
}
pub fn add_with_namespace_member(
&mut self,
reference: ResolvedVc<EsmAssetReference>,
export: Option<RcStr>,
namespace_member: Option<RcStr>,
ast_path: AstPathId,
) {
self.bindings.entry(reference).or_default().push(EsmBinding {
export,
namespace_member,
ast_path, ast_path,
keep_this: false, keep_this: false,
}); });
...@@ -67,6 +96,7 @@ impl EsmBindingsBuilder { ...@@ -67,6 +96,7 @@ impl EsmBindingsBuilder {
.or_default() .or_default()
.push(EsmBinding { .push(EsmBinding {
export, export,
namespace_member: None,
ast_path, ast_path,
keep_this: true, keep_this: true,
}); });
...@@ -95,6 +125,8 @@ impl EsmBindings { ...@@ -95,6 +125,8 @@ impl EsmBindings {
scope_hoisting_context: ScopeHoistingContext<'_>, scope_hoisting_context: ScopeHoistingContext<'_>,
) -> Result<CodeGeneration> { ) -> Result<CodeGeneration> {
let mut visitors = vec![]; let mut visitors = vec![];
let generated_comments = SwcComments::default();
let mut has_no_side_effects = false;
let unused_references = chunking_context.unused_references(); let unused_references = chunking_context.unused_references();
...@@ -108,6 +140,7 @@ impl EsmBindings { ...@@ -108,6 +140,7 @@ impl EsmBindings {
let imported_module = reference.get_referenced_asset().await?; let imported_module = reference.get_referenced_asset().await?;
let mut exports_cache: FxHashMap<Option<RcStr>, _> = FxHashMap::default(); let mut exports_cache: FxHashMap<Option<RcStr>, _> = FxHashMap::default();
let mut purity_cache: FxHashMap<(RcStr, Option<RcStr>), bool> = FxHashMap::default();
#[derive(Clone)] #[derive(Clone)]
enum ImportedIdent { enum ImportedIdent {
Module(ReferencedAssetIdent), Module(ReferencedAssetIdent),
...@@ -118,10 +151,30 @@ impl EsmBindings { ...@@ -118,10 +151,30 @@ impl EsmBindings {
} }
for EsmBinding { for EsmBinding {
export, export,
namespace_member,
ast_path, ast_path,
keep_this, keep_this,
} in bindings } in bindings
{ {
let no_side_effects =
if let (ReferencedAsset::Some(module), Some(export)) = (&imported_module, export) {
match purity_cache.entry((export.clone(), namespace_member.clone())) {
std::collections::hash_map::Entry::Vacant(entry) => {
let pure = *is_export_no_side_effects(
**module,
export.clone(),
namespace_member.clone(),
)
.await?;
entry.insert(pure);
pure
}
std::collections::hash_map::Entry::Occupied(entry) => *entry.get(),
}
} else {
false
};
has_no_side_effects |= no_side_effects;
let imported_ident = match &imported_module { let imported_ident = match &imported_module {
ReferencedAsset::None => ImportedIdent::None, ReferencedAsset::None => ImportedIdent::None,
ReferencedAsset::Empty => { ReferencedAsset::Empty => {
...@@ -196,13 +249,46 @@ impl EsmBindings { ...@@ -196,13 +249,46 @@ impl EsmBindings {
// Any other expression can be replaced with the import accessor. // Any other expression can be replaced with the import accessor.
Some(swc_core::ecma::visit::AstParentKind::Expr(_)) => { Some(swc_core::ecma::visit::AstParentKind::Expr(_)) => {
ast_path = trie.parent_or_root(ast_path); ast_path = trie.parent_or_root(ast_path);
let in_call = !keep_this let is_invocation_of = |path| {
&& matches!( let kind = trie.get(path);
trie.get(ast_path), (
Some(swc_core::ecma::visit::AstParentKind::Callee( matches!(kind, Some(swc_core::ecma::visit::AstParentKind::Callee(CalleeField::Expr))),
CalleeField::Expr matches!(kind, Some(swc_core::ecma::visit::AstParentKind::TaggedTpl(TaggedTplField::Tag))),
)) )
};
// Only a directly replaced callee/tag may need a `this`-less accessor.
let (direct_is_call, direct_is_tag) = is_invocation_of(ast_path);
// Classify the enclosing use while replacing only the imported base.
let mut usage_path = ast_path;
if namespace_member.is_some() {
usage_path = walk_up_through(
trie,
usage_path,
swc_core::ecma::visit::AstParentKind::MemberExpr(MemberExprField::Obj),
swc_core::ecma::visit::AstParentKind::Expr(ExprField::Member),
);
}
loop {
let next = walk_up_through(
trie,
usage_path,
swc_core::ecma::visit::AstParentKind::ParenExpr(ParenExprField::Expr),
swc_core::ecma::visit::AstParentKind::Expr(ExprField::Paren),
); );
if next == usage_path {
break;
}
usage_path = next;
}
let (is_call, is_tag) = is_invocation_of(usage_path);
let in_var_initializer = matches!(
trie.get(usage_path),
Some(swc_core::ecma::visit::AstParentKind::VarDeclarator(VarDeclaratorField::Init))
);
// Namespace members retain their object as the `this` receiver.
let preserve_this = *keep_this || namespace_member.is_some();
let in_invocation = !preserve_this && (direct_is_call || direct_is_tag);
let generated_comments = generated_comments.clone();
visitors.push(create_visitor!( visitors.push(create_visitor!(
exact, exact,
...@@ -210,10 +296,23 @@ impl EsmBindings { ...@@ -210,10 +296,23 @@ impl EsmBindings {
ast_path, ast_path,
visit_mut_expr, visit_mut_expr,
|expr: &mut Expr| { |expr: &mut Expr| {
use swc_core::common::Spanned; if no_side_effects && (is_call || is_tag || in_var_initializer) {
generated_comments.add_leading(
expr.span().lo,
Comment {
kind: CommentKind::Block,
span: DUMMY_SP,
text: if is_call || is_tag {
atom!("#__PURE__")
} else {
atom!("#__NO_SIDE_EFFECTS__")
},
},
);
}
match &imported_ident { match &imported_ident {
ImportedIdent::Module(imported_ident) => { ImportedIdent::Module(imported_ident) => {
*expr = imported_ident.as_expr(expr.span(), in_call); *expr = imported_ident.as_expr(expr.span(), in_invocation);
} }
ImportedIdent::None => { ImportedIdent::None => {
*expr = *Expr::undefined(expr.span()); *expr = *Expr::undefined(expr.span());
...@@ -272,6 +371,28 @@ impl EsmBindings { ...@@ -272,6 +371,28 @@ impl EsmBindings {
} }
} }
Ok(CodeGeneration::visitors(visitors)) Ok(if has_no_side_effects {
CodeGeneration::visitors_with_comments(visitors, generated_comments)
} else {
CodeGeneration::visitors(visitors)
})
}
}
/// Skip a known wrapper around a binding when classifying its use site.
fn walk_up_through(
trie: &AstPathTrie,
path: AstPathId,
field: swc_core::ecma::visit::AstParentKind,
wrapper: swc_core::ecma::visit::AstParentKind,
) -> AstPathId {
if trie.get(path) != Some(field) {
return path;
}
let parent = trie.parent_or_root(path);
if trie.get(parent) == Some(wrapper) {
trie.parent_or_root(parent)
} else {
parent
} }
} }
...@@ -132,18 +132,21 @@ pub async fn is_export_missing( ...@@ -132,18 +132,21 @@ pub async fn is_export_missing(
/// Returns whether a statically resolved ESM export is backed by a binding annotated with /// Returns whether a statically resolved ESM export is backed by a binding annotated with
/// `NO_SIDE_EFFECTS`. Imported bindings and statically expandable star exports are followed to the /// `NO_SIDE_EFFECTS`. Imported bindings and statically expandable star exports are followed to the
/// local binding that defines the contract. /// local binding that defines the contract. When `member_name` is present, `export_name` must
/// resolve to an imported namespace and that member is then followed as a named export.
#[turbo_tasks::function] #[turbo_tasks::function]
pub async fn is_export_no_side_effects( pub async fn is_export_no_side_effects(
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
export_name: RcStr, export_name: RcStr,
member_name: Option<RcStr>,
) -> Result<Vc<bool>> { ) -> Result<Vc<bool>> {
let mut module = module; let mut module = module;
let mut export_name = export_name; let mut export_name = export_name;
let mut member_name = member_name;
let mut visited = FxHashSet::default(); let mut visited = FxHashSet::default();
loop { loop {
if !visited.insert((module, export_name.clone())) { if !visited.insert((module, export_name.clone(), member_name.clone())) {
return Ok(Vc::cell(false)); return Ok(Vc::cell(false));
} }
...@@ -172,7 +175,7 @@ pub async fn is_export_no_side_effects( ...@@ -172,7 +175,7 @@ pub async fn is_export_no_side_effects(
match &export { match &export {
EsmExport::LocalBinding(_, _, no_side_effects) => { EsmExport::LocalBinding(_, _, no_side_effects) => {
return Ok(Vc::cell(*no_side_effects)); return Ok(Vc::cell(member_name.is_none() && *no_side_effects));
} }
EsmExport::ImportedBinding(reference, imported_name, _) => { EsmExport::ImportedBinding(reference, imported_name, _) => {
let ReferencedAsset::Some(imported_module) = let ReferencedAsset::Some(imported_module) =
...@@ -183,70 +186,19 @@ pub async fn is_export_no_side_effects( ...@@ -183,70 +186,19 @@ pub async fn is_export_no_side_effects(
module = imported_module; module = imported_module;
export_name = imported_name.clone(); export_name = imported_name.clone();
} }
EsmExport::ImportedNamespace(_) | EsmExport::Error => { EsmExport::ImportedNamespace(reference) => {
return Ok(Vc::cell(false)); let Some(member_name) = member_name.take() else {
}
}
}
}
/// Returns whether `member_name` is a no-side-effects export of a namespace exported as
/// `export_name`. Named re-export chains leading to that namespace are followed.
#[turbo_tasks::function]
pub async fn is_exported_namespace_member_no_side_effects(
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
export_name: RcStr,
member_name: RcStr,
) -> Result<Vc<bool>> {
let mut module = module;
let mut export_name = export_name;
let mut visited = FxHashSet::default();
loop {
if !visited.insert((module, export_name.clone())) {
return Ok(Vc::cell(false));
}
let exports = module.get_exports().await?;
let EcmascriptExports::EsmExports(exports) = &*exports else {
return Ok(Vc::cell(false));
};
let exports_vc = *exports;
let exports = exports_vc.await?;
let export = if let Some(export) = exports.exports.get(&export_name) {
export.clone()
} else {
let expanded = exports_vc
.expand_exports(ModuleExportUsageInfo::all())
.await?;
if !expanded.dynamic_exports.is_empty() {
return Ok(Vc::cell(false));
}
let Some(export) = expanded.exports.get(&export_name) else {
return Ok(Vc::cell(false)); return Ok(Vc::cell(false));
}; };
export.clone()
};
match &export {
EsmExport::ImportedBinding(reference, imported_name, _) => {
let ReferencedAsset::Some(imported_module) = let ReferencedAsset::Some(imported_module) =
ReferencedAsset::from_resolve_result(reference.resolve_reference()).await? ReferencedAsset::from_resolve_result(reference.resolve_reference()).await?
else { else {
return Ok(Vc::cell(false)); return Ok(Vc::cell(false));
}; };
module = imported_module; module = imported_module;
export_name = imported_name.clone(); export_name = member_name;
}
EsmExport::ImportedNamespace(reference) => {
let ReferencedAsset::Some(imported_module) =
ReferencedAsset::from_resolve_result(reference.resolve_reference()).await?
else {
return Ok(Vc::cell(false));
};
return Ok(is_export_no_side_effects(*imported_module, member_name));
} }
EsmExport::LocalBinding(..) | EsmExport::Error => { EsmExport::Error => {
return Ok(Vc::cell(false)); return Ok(Vc::cell(false));
} }
} }
......
...@@ -23,7 +23,8 @@ annotated`tagged` ...@@ -23,7 +23,8 @@ annotated`tagged`
const alias = annotated const alias = annotated
alias() alias()
const parenthesizedAlias = annotated // prettier-ignore
const parenthesizedAlias = (annotated)
parenthesizedAlias() parenthesizedAlias()
let argumentState = 0 let argumentState = 0
......
...@@ -29,7 +29,8 @@ annotated`tagged` ...@@ -29,7 +29,8 @@ annotated`tagged`
const alias = annotated const alias = annotated
alias() alias()
const parenthesizedAlias = annotated // prettier-ignore
const parenthesizedAlias = (annotated)
parenthesizedAlias() parenthesizedAlias()
let argumentState = 0 let argumentState = 0
......
...@@ -8,7 +8,8 @@ namespace.annotated() ...@@ -8,7 +8,8 @@ namespace.annotated()
const alias = annotated const alias = annotated
alias() alias()
const parenthesizedAlias = annotated // prettier-ignore
const parenthesizedAlias = (annotated)
parenthesizedAlias() parenthesizedAlias()
unannotated() unannotated()
......
...@@ -12,6 +12,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ...@@ -12,6 +12,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
/*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$namespace$2d$reexport$2e$js__$5b$test$5d$__$28$ecmascript$29$__["namespace"].annotated(); /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$namespace$2d$reexport$2e$js__$5b$test$5d$__$28$ecmascript$29$__["namespace"].annotated();
const alias = /*#__NO_SIDE_EFFECTS__*/ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$library$2e$js__$5b$test$5d$__$28$ecmascript$29$__["annotated"]; const alias = /*#__NO_SIDE_EFFECTS__*/ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$library$2e$js__$5b$test$5d$__$28$ecmascript$29$__["annotated"];
alias(); alias();
// prettier-ignore
const parenthesizedAlias = /*#__NO_SIDE_EFFECTS__*/ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$library$2e$js__$5b$test$5d$__$28$ecmascript$29$__["annotated"]; const parenthesizedAlias = /*#__NO_SIDE_EFFECTS__*/ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$library$2e$js__$5b$test$5d$__$28$ecmascript$29$__["annotated"];
parenthesizedAlias(); parenthesizedAlias();
(0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$library$2e$js__$5b$test$5d$__$28$ecmascript$29$__["unannotated"])(); (0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$no$2d$side$2d$effects$2d$import$2f$input$2f$library$2e$js__$5b$test$5d$__$28$ecmascript$29$__["unannotated"])();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"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/basic/no-side-effects-import/input/index.js"],"sourcesContent":["import { annotated, unannotated } from './library'\nimport { namespace } from './namespace-reexport'\n\nannotated()\nannotated`tagged`\nnamespace.annotated()\n\nconst alias = annotated\nalias()\n\nconst parenthesizedAlias = (annotated)\nparenthesizedAlias()\n\nunannotated()\nunannotated`tagged`\n"],"names":["annotated","alias","parenthesizedAlias"],"mappings":";AAAA;AACA;;;cAEA,IAAA,qOAAS;cACT,IAAA,qOAAS,CAAA,CAAC,MAAM,CAAC;cACjB,mPAAS,CAACA,SAAS;AAEnB,MAAMC,iCAAQ,qOAAS;AACvBA;AAEA,MAAMC,8CAAsB,qOAAS;AACrCA;AAEA,IAAA,uOAAW;AACX,IAAA,uOAAW,CAAA,CAAC,MAAM,CAAC"}}, {"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/no-side-effects-import/input/index.js"],"sourcesContent":["import { annotated, unannotated } from './library'\nimport { namespace } from './namespace-reexport'\n\nannotated()\nannotated`tagged`\nnamespace.annotated()\n\nconst alias = annotated\nalias()\n\n// prettier-ignore\nconst parenthesizedAlias = (annotated)\nparenthesizedAlias()\n\nunannotated()\nunannotated`tagged`\n"],"names":["annotated","alias","parenthesizedAlias"],"mappings":";AAAA;AACA;;;cAEA,IAAA,qOAAS;cACT,IAAA,qOAAS,CAAA,CAAC,MAAM,CAAC;cACjB,mPAAS,CAACA,SAAS;AAEnB,MAAMC,iCAAQ,qOAAS;AACvBA;AAEA,kBAAkB;AAClB,MAAMC,8CAAsB,qOAAS;AACrCA;AAEA,IAAA,uOAAW;AACX,IAAA,uOAAW,CAAA,CAAC,MAAM,CAAC"}},
{"offset": {"line": 22, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/no-side-effects-import/input/library.js"],"sourcesContent":["export const annotated = /*#__NO_SIDE_EFFECTS__*/ function () {}\nexport function unannotated() {}\n"],"names":["annotated","unannotated"],"mappings":";;;;;;AAAO,MAAMA,YAAY,sBAAsB,GAAG,YAAa;AACxD,SAASC,eAAe"}}, {"offset": {"line": 23, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/no-side-effects-import/input/library.js"],"sourcesContent":["export const annotated = /*#__NO_SIDE_EFFECTS__*/ function () {}\nexport function unannotated() {}\n"],"names":["annotated","unannotated"],"mappings":";;;;;;AAAO,MAAMA,YAAY,sBAAsB,GAAG,YAAa;AACxD,SAASC,eAAe"}},
{"offset": {"line": 34, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/no-side-effects-import/input/namespace-reexport.js"],"sourcesContent":["export * as namespace from './library'\n"],"names":[],"mappings":";;;;AAAA"}}] {"offset": {"line": 35, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/no-side-effects-import/input/namespace-reexport.js"],"sourcesContent":["export * as namespace from './library'\n"],"names":[],"mappings":";;;;AAAA"}}]
} }
\ 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