Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei authored Jul 7, 2022
2 parents 694007a + 8dcb6c7 commit a6eca0e
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 52 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"todomvc-app-css": "^2.3.0",
"ts-jest": "^27.0.5",
"tslib": "^2.4.0",
"typescript": "^4.6.4",
"typescript": "^4.7.4",
"vite": "^2.9.8",
"vue": "workspace:*",
"yorkie": "^2.0.0"
Expand Down
13 changes: 13 additions & 0 deletions packages/compiler-sfc/__tests__/compileScript.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,19 @@ defineExpose({ foo: 123 })
expect(content).toMatch(`return { a, b, Baz }`)
assertCode(content)
})

// vuejs/vue#12591
test('v-on inline statement', () => {
// should not error
compile(`
<script setup lang="ts">
import { foo } from './foo'
</script>
<template>
<div @click="$emit('update:a');"></div>
</tempalte>
`)
})
})

describe('inlineTemplate mode', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,8 @@ function processExp(exp: string, dir?: string): string {
if (/ as\s+\w|<.*>|:/.test(exp)) {
if (dir === 'slot') {
exp = `(${exp})=>{}`
} else if (dir === 'on') {
exp = `()=>{${exp}}`
} else if (dir === 'for') {
const inMatch = exp.match(forAliasRE)
if (inMatch) {
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity/src/computed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ComputedRefImpl<T> {
public readonly effect: ReactiveEffect<T>

public readonly __v_isRef = true
public readonly [ReactiveFlags.IS_READONLY]: boolean
public readonly [ReactiveFlags.IS_READONLY]: boolean = false

public _dirty = true
public _cacheable: boolean
Expand Down
6 changes: 3 additions & 3 deletions packages/runtime-core/src/apiDefineComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function defineComponent<
M extends MethodOptions = {},
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
E extends EmitsOptions = EmitsOptions,
E extends EmitsOptions = {},
EE extends string = string
>(
options: ComponentOptionsWithoutProps<
Expand All @@ -130,7 +130,7 @@ export function defineComponent<
M extends MethodOptions = {},
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
E extends EmitsOptions = Record<string, any>,
E extends EmitsOptions = {},
EE extends string = string
>(
options: ComponentOptionsWithArrayProps<
Expand Down Expand Up @@ -168,7 +168,7 @@ export function defineComponent<
M extends MethodOptions = {},
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
E extends EmitsOptions = Record<string, any>,
E extends EmitsOptions = {},
EE extends string = string
>(
options: ComponentOptionsWithObjectProps<
Expand Down
1 change: 1 addition & 0 deletions packages/runtime-core/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ export function finishComponentSetup(
// pass runtime compat config into the compiler
finalCompilerOptions.compatConfig = Object.create(globalCompatConfig)
if (Component.compatConfig) {
// @ts-expect-error types are not compatible
extend(finalCompilerOptions.compatConfig, Component.compatConfig)
}
}
Expand Down
16 changes: 7 additions & 9 deletions packages/server-renderer/__tests__/render.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ function testRender(type: string, render: typeof renderToString) {
await render(
createApp(
defineComponent({
extends: {
extends: defineComponent({
data() {
return { msg: 'hello' }
},
render(this: any) {
render() {
return h('div', this.msg)
}
}
})
})
)
)
Expand All @@ -148,14 +148,14 @@ function testRender(type: string, render: typeof renderToString) {
createApp(
defineComponent({
mixins: [
{
defineComponent({
data() {
return { msg: 'hello' }
},
render(this: any) {
render() {
return h('div', this.msg)
}
}
})
]
})
)
Expand Down Expand Up @@ -675,9 +675,7 @@ function testRender(type: string, render: typeof renderToString) {
const MyComp = {
render: () => h('p', 'hello')
}
expect(await render(h(KeepAlive, () => h(MyComp)))).toBe(
`<p>hello</p>`
)
expect(await render(h(KeepAlive, () => h(MyComp)))).toBe(`<p>hello</p>`)
})

test('Transition', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/server-renderer/src/renderToString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function resolveTeleports(context: SSRContext) {
// note: it's OK to await sequentially here because the Promises were
// created eagerly in parallel.
context.teleports[key] = await unrollBuffer(
(await Promise.all(context.__teleportBuffers[key])) as SSRBuffer
await Promise.all([context.__teleportBuffers[key]])
)
}
}
Expand Down
Loading

0 comments on commit a6eca0e

Please sign in to comment.