Skip to content

Commit 6e2786d

Browse files
committed
perf(bundler): remove redundant scope walks
1 parent 9e864b8 commit 6e2786d

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

packages/bundler/src/unplugin/TreeshakeServerComposables.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ export const TreeshakeServerComposables = createUnplugin<TreeshakeServerComposab
100100
const ast = parseAndWalkSource(code, id, { scopeTracker })
101101
const s = new MagicString(code)
102102

103-
// The parse walk collects all declarations first so hoisted locals
104-
// (`function useServerHead() {}` below a call site) are visible when
105-
// the removal walk visits earlier statements.
106-
walk(ast.program, { scopeTracker })
103+
// The parse walk collected all declarations, including hoisted locals.
107104
scopeTracker.freeze()
108105

109106
walk(ast.program, {

packages/bundler/src/unplugin/UseSeoMetaTransform.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ export const UseSeoMetaTransform = createUnplugin<UseSeoMetaTransformOptions, fa
109109
const ast = parseAndWalkSource(code, id, { scopeTracker })
110110
const s = new MagicString(code)
111111

112-
// The parse walk collects all declarations first so hoisted locals
113-
// (`function useSeoMeta() {}` below a call site) are visible when
114-
// the rewrite walk visits earlier statements.
115-
walk(ast.program, { scopeTracker })
112+
// The parse walk collected all declarations, including hoisted locals.
116113
scopeTracker.freeze()
117114

118115
// Track which ImportDeclarations need specifier rewrites

0 commit comments

Comments
 (0)