]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: Merge branch 'main' into minor
authorEvan You <yyx990803@gmail.com>
Thu, 30 May 2024 03:21:12 +0000 (11:21 +0800)
committerEvan You <yyx990803@gmail.com>
Thu, 30 May 2024 03:21:12 +0000 (11:21 +0800)
18 files changed:
1  2 
CHANGELOG.md
package.json
packages/compiler-core/package.json
packages/compiler-sfc/__tests__/compileScript/definePropsDestructure.spec.ts
packages/compiler-sfc/package.json
packages/compiler-sfc/src/compileScript.ts
packages/dts-test/defineComponent.test-d.tsx
packages/reactivity/__tests__/ref.spec.ts
packages/runtime-core/__tests__/apiWatch.spec.ts
packages/runtime-core/src/apiWatch.ts
packages/runtime-core/src/component.ts
packages/runtime-core/src/componentPublicInstance.ts
packages/runtime-core/src/helpers/renderList.ts
packages/runtime-dom/__tests__/customElement.spec.ts
packages/runtime-dom/src/apiCustomElement.ts
packages/server-renderer/src/render.ts
packages/vue-compat/__tests__/instance.spec.ts
packages/vue-compat/package.json

diff --cc CHANGELOG.md
index 468407218070a4f80bd961586a58c19e25bd4fa2,a390f9b0c1ca454851014c7761b1551170dc4d28..086da812a75ef3c2e44f9d04d03e9f5df563040f
@@@ -1,19 -1,16 +1,32 @@@
+ ## [3.4.27](https://github.com/vuejs/core/compare/v3.4.26...v3.4.27) (2024-05-06)
+ ### Bug Fixes
+ * **compat:** include legacy scoped slots ([#10868](https://github.com/vuejs/core/issues/10868)) ([8366126](https://github.com/vuejs/core/commit/83661264a4ced3cb2ff6800904a86dd9e82bbfe2)), closes [#8869](https://github.com/vuejs/core/issues/8869)
+ * **compiler-core:** add support for arrow aysnc function with unbracketed ([#5789](https://github.com/vuejs/core/issues/5789)) ([ca7d421](https://github.com/vuejs/core/commit/ca7d421e8775f6813f8943d32ab485e0c542f98b)), closes [#5788](https://github.com/vuejs/core/issues/5788)
+ * **compiler-dom:** restrict createStaticVNode usage with option elements ([#10846](https://github.com/vuejs/core/issues/10846)) ([0e3d617](https://github.com/vuejs/core/commit/0e3d6178b02d0386d779720ae2cc4eac1d1ec990)), closes [#6568](https://github.com/vuejs/core/issues/6568) [#7434](https://github.com/vuejs/core/issues/7434)
+ * **compiler-sfc:** handle keyof operator ([#10874](https://github.com/vuejs/core/issues/10874)) ([10d34a5](https://github.com/vuejs/core/commit/10d34a5624775f20437ccad074a97270ef74c3fb)), closes [#10871](https://github.com/vuejs/core/issues/10871)
+ * **hydration:** handle edge case of style mismatch without style attribute ([f2c1412](https://github.com/vuejs/core/commit/f2c1412e46a8fad3e13403bfa78335c4f704f21c)), closes [#10786](https://github.com/vuejs/core/issues/10786)
 +# [3.5.0-alpha.2](https://github.com/vuejs/core/compare/v3.4.26...v3.5.0-alpha.2) (2024-05-04)
 +
 +
 +### Bug Fixes
 +
 +* **types:** fix app.component() typing with inline defineComponent ([908f70a](https://github.com/vuejs/core/commit/908f70adc06038d1ea253d96f4024367f4a7545d)), closes [#10843](https://github.com/vuejs/core/issues/10843)
 +* **types:** fix compat with generated types that rely on CreateComponentPublicInstance ([c146186](https://github.com/vuejs/core/commit/c146186396d0c1a65423b8c9a21251c5a6467336)), closes [#10842](https://github.com/vuejs/core/issues/10842)
 +* **types:** props in defineOptions type should be optional ([124c4ca](https://github.com/vuejs/core/commit/124c4cac833a28ae9bc8edc576c1d0c7c41f5985)), closes [#10841](https://github.com/vuejs/core/issues/10841)
 +
 +
 +### Features
 +
 +* **runtime-core:** add app.onUnmount() for registering cleanup functions ([#4619](https://github.com/vuejs/core/issues/4619)) ([582a3a3](https://github.com/vuejs/core/commit/582a3a382b1adda565bac576b913a88d9e8d7a9e)), closes [#4516](https://github.com/vuejs/core/issues/4516)
 +
 +
 +
  ## [3.4.26](https://github.com/vuejs/core/compare/v3.4.25...v3.4.26) (2024-04-29)
  
  
diff --cc package.json
index 23282e991b4c802883ececa3edc0720aaaf2ac5d,cb211ed4b69125947650c3b312ed31ccf1ca1ac3..d454391c703a75da39a071acba81334c8b896ff7
@@@ -1,7 -1,7 +1,7 @@@
  {
    "private": true,
 -  "version": "3.4.27",
 +  "version": "3.5.0-alpha.2",
-   "packageManager": "pnpm@9.0.6",
+   "packageManager": "pnpm@9.1.2",
    "type": "module",
    "scripts": {
      "dev": "node scripts/dev.js",
Simple merge
Simple merge
index ed917dbdd92c3ca16004237854a89d196cd20c04,f42281edd312b17556ff9bd4f99fc4715ea6fa5b..a3f56ab05c26b137c9a7352bdd2396b4da14a62a
@@@ -443,14 -456,15 +456,26 @@@ describe('reactivity/ref', () => 
      expect(a.value).not.toBe(r)
    })
  
 +  test('should not trigger when setting the same raw object', () => {
 +    const obj = {}
 +    const r = ref(obj)
 +    const spy = vi.fn()
 +    effect(() => spy(r.value))
 +    expect(spy).toHaveBeenCalledTimes(1)
 +
 +    r.value = obj
 +    expect(spy).toHaveBeenCalledTimes(1)
 +  })
++
+   test('toValue', () => {
+     const a = ref(1)
+     const b = computed(() => a.value + 1)
+     const c = () => a.value + 2
+     const d = 4
+     expect(toValue(a)).toBe(1)
+     expect(toValue(b)).toBe(2)
+     expect(toValue(c)).toBe(3)
+     expect(toValue(d)).toBe(4)
+   })
  })
index 991419d8ef664ca1075907c1a85981b5cfd370b0,265bc0a0d46f045bada0d0fc29b8ac2bce2c4a9b..c0726cddd786c88a9a626e2afac6513aad390a4b
@@@ -1476,45 -1563,19 +1564,61 @@@ describe('api: watch', () => 
      expect(scope.effects.length).toBe(0)
    })
  
 +  // simplified case of VueUse syncRef
 +  test('sync watcher should not be batched', () => {
 +    const a = ref(0)
 +    const b = ref(0)
 +    let pauseB = false
 +    watch(
 +      a,
 +      () => {
 +        pauseB = true
 +        b.value = a.value + 1
 +        pauseB = false
 +      },
 +      { flush: 'sync' },
 +    )
 +    watch(
 +      b,
 +      () => {
 +        if (!pauseB) {
 +          throw new Error('should not be called')
 +        }
 +      },
 +      { flush: 'sync' },
 +    )
 +
 +    a.value = 1
 +    expect(b.value).toBe(2)
 +  })
 +
 +  test('watchEffect should not fire on computed deps that did not change', async () => {
 +    const a = ref(0)
 +    const c = computed(() => a.value % 2)
 +    const spy = vi.fn()
 +    watchEffect(() => {
 +      spy()
 +      c.value
 +    })
 +    expect(spy).toHaveBeenCalledTimes(1)
 +    a.value += 2
 +    await nextTick()
 +    expect(spy).toHaveBeenCalledTimes(1)
 +  })
++
+   test('circular reference', async () => {
+     const obj = { a: 1 }
+     // @ts-expect-error
+     obj.b = obj
+     const foo = ref(obj)
+     const spy = vi.fn()
+     watch(foo, spy, { deep: true })
+     // @ts-expect-error
+     foo.value.b.a = 2
+     await nextTick()
+     expect(spy).toHaveBeenCalledTimes(1)
+     expect(foo.value.a).toBe(2)
+   })
  })
Simple merge
index 91a7ae8d6d074a90d13eae2ce67225fe5605022d,52801e172ab266f1d93f8df2bbee4cbd21350813..8f244ac1d94dc9984ba2e69e2ffb53e4cdc3b5df
@@@ -317,20 -230,17 +318,20 @@@ export type ComponentPublicInstance
    $watch<T extends string | ((...args: any) => any)>(
      source: T,
      cb: T extends (...args: any) => infer R
-       ? (...args: [R, R]) => any
-       : (...args: any) => any,
+       ? (...args: [R, R, OnCleanup]) => any
+       : (...args: [any, any, OnCleanup]) => any,
      options?: WatchOptions,
    ): WatchStopHandle
 -} & IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> &
 -  ShallowUnwrapRef<B> &
 -  UnwrapNestedRefs<D> &
 -  ExtractComputedReturns<C> &
 -  M &
 -  ComponentCustomProperties &
 -  InjectToObject<I>
 +} & ExposedKeys<
 +  IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B>>> &
 +    ShallowUnwrapRef<B> &
 +    UnwrapNestedRefs<D> &
 +    ExtractComputedReturns<C> &
 +    M &
 +    ComponentCustomProperties &
 +    InjectToObject<I>,
 +  Exposed
 +>
  
  export type PublicPropertiesMap = Record<
    string,
Simple merge