Skip to content

Commit a94072d

Browse files
committed
fix(compiler-sfc): fix defineExpose() codegen regression from #7949
1 parent ffe679c commit a94072d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ exports[`SFC compile <script setup> > defineExpose() 1`] = `
645645
"export default {
646646
setup(__props, { expose: __expose }) {
647647

648-
expose({ foo: 123 })
648+
__expose({ foo: 123 })
649649

650650
return { }
651651
}
@@ -1319,7 +1319,7 @@ exports[`SFC compile <script setup> > inlineTemplate mode > with defineExpose()
13191319
setup(__props, { expose: __expose }) {
13201320

13211321
const count = ref(0)
1322-
expose({ count })
1322+
__expose({ count })
13231323

13241324
return () => {}
13251325
}

packages/compiler-sfc/__tests__/compileScript.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ defineExpose({ foo: 123 })
276276
// should generate correct setup signature
277277
expect(content).toMatch(`setup(__props, { expose: __expose }) {`)
278278
// should replace callee
279-
expect(content).toMatch(/\bexpose\(\{ foo: 123 \}\)/)
279+
expect(content).toMatch(/\b__expose\(\{ foo: 123 \}\)/)
280280
})
281281

282282
test('<script> after <script setup> the script content not end with `\\n`', () => {

packages/compiler-sfc/src/compileScript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ export function compileScript(
12521252
s.overwrite(
12531253
callee.start! + startOffset,
12541254
callee.end! + startOffset,
1255-
'expose'
1255+
'__expose'
12561256
)
12571257
}
12581258
}

0 commit comments

Comments
 (0)