Skip to content

Commit ae7453f

Browse files
committed
chore: use moduleResolution: bundler + shim estree-walker
1 parent d2c3d8b commit ae7453f

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

packages/compiler-core/src/babelUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function walkIdentifiers(
3232
root.body[0].type === 'ExpressionStatement' &&
3333
root.body[0].expression
3434

35-
;(walk as any)(root, {
35+
walk(root, {
3636
enter(node: Node & { scopeIds?: Set<string> }, parent: Node | undefined) {
3737
parent && parentStack.push(parent)
3838
if (

packages/compiler-sfc/src/compileScript.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ export function compileScript(
607607
node.type.endsWith('Statement')
608608
) {
609609
const scope: Statement[][] = [scriptSetupAst.body]
610-
;(walk as any)(node, {
611-
enter(child: Node, parent: Node) {
610+
walk(node, {
611+
enter(child: Node, parent: Node | undefined) {
612612
if (isFunctionType(child)) {
613613
this.skip()
614614
}
@@ -633,7 +633,7 @@ export function compileScript(
633633
ctx,
634634
child,
635635
needsSemi,
636-
parent.type === 'ExpressionStatement'
636+
parent!.type === 'ExpressionStatement'
637637
)
638638
}
639639
},

packages/compiler-sfc/src/script/definePropsDestructure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export function transformDestructuredProps(
238238
// check root scope first
239239
const ast = ctx.scriptSetupAst!
240240
walkScope(ast, true)
241-
;(walk as any)(ast, {
241+
walk(ast, {
242242
enter(node: Node, parent?: Node) {
243243
parent && parentStack.push(parent)
244244

packages/global.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ declare module 'file-saver' {
3333
export function saveAs(blob: any, name: any): void
3434
}
3535

36+
declare module 'estree-walker' {
37+
export function walk<T>(
38+
root: T,
39+
options: {
40+
enter?: (node: T, parent: T | undefined) => any
41+
leave?: (node: T, parent: T | undefined) => any
42+
exit?: (node: T) => any
43+
} & ThisType<{ skip: () => void }>
44+
)
45+
}
46+
3647
declare interface String {
3748
/**
3849
* @deprecated Please use String.prototype.slice instead of String.prototype.substring in the repository.

packages/reactivity-transform/src/reactivityTransform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ export function transformAST(
636636

637637
// check root scope first
638638
walkScope(ast, true)
639-
;(walk as any)(ast, {
639+
walk(ast, {
640640
enter(node: Node, parent?: Node) {
641641
parent && parentStack.push(parent)
642642

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"newLine": "LF",
88
"useDefineForClassFields": false,
99
"module": "esnext",
10-
"moduleResolution": "node",
10+
"moduleResolution": "bundler",
1111
"allowJs": false,
1212
"strict": true,
1313
"noUnusedLocals": true,

0 commit comments

Comments
 (0)