From: Evan You Date: Tue, 21 Nov 2023 01:48:26 +0000 (+0800) Subject: chore: Merge branch 'main' into minor X-Git-Tag: v3.4.0-alpha.2~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ea775633dc0a0c2ab892da04b1cc87d0be28b09;p=thirdparty%2Fvuejs%2Fcore.git chore: Merge branch 'main' into minor --- 1ea775633dc0a0c2ab892da04b1cc87d0be28b09 diff --cc CHANGELOG.md index 858b722d19,bf0c8591f5..5863fc31aa --- a/CHANGELOG.md +++ b/CHANGELOG.md @@@ -1,16 -1,19 +1,32 @@@ + ## [3.3.8](https://github.com/vuejs/core/compare/v3.3.7...v3.3.8) (2023-11-06) + + + ### Bug Fixes + + * **compile-sfc:** support `Error` type in `defineProps` ([#5955](https://github.com/vuejs/core/issues/5955)) ([a989345](https://github.com/vuejs/core/commit/a9893458ec519aae442e1b99e64e6d74685cd22c)) + * **compiler-core:** known global should be shadowed by local variables in expression rewrite ([#9492](https://github.com/vuejs/core/issues/9492)) ([a75d1c5](https://github.com/vuejs/core/commit/a75d1c5c6242e91a73cc5ba01e6da620dea0b3d9)), closes [#9482](https://github.com/vuejs/core/issues/9482) + * **compiler-sfc:** fix dynamic directive arguments usage check for slots ([#9495](https://github.com/vuejs/core/issues/9495)) ([b39fa1f](https://github.com/vuejs/core/commit/b39fa1f8157647859331ce439c42ae016a49b415)), closes [#9493](https://github.com/vuejs/core/issues/9493) + * **deps:** update dependency @vue/repl to ^2.6.2 ([#9536](https://github.com/vuejs/core/issues/9536)) ([5cef325](https://github.com/vuejs/core/commit/5cef325f41e3b38657c72fa1a38dedeee1c7a60a)) + * **deps:** update dependency @vue/repl to ^2.6.3 ([#9540](https://github.com/vuejs/core/issues/9540)) ([176d590](https://github.com/vuejs/core/commit/176d59058c9aecffe9da4d4311e98496684f06d4)) + * **hydration:** fix tagName access eeror on comment/text node hydration mismatch ([dd8a0cf](https://github.com/vuejs/core/commit/dd8a0cf5dcde13d2cbd899262a0e07f16e14e489)), closes [#9531](https://github.com/vuejs/core/issues/9531) + * **types:** avoid exposing lru-cache types in generated dts ([462aeb3](https://github.com/vuejs/core/commit/462aeb3b600765e219ded2ee9a0ed1e74df61de0)), closes [#9521](https://github.com/vuejs/core/issues/9521) + * **warn:** avoid warning on empty children with Suspense ([#3962](https://github.com/vuejs/core/issues/3962)) ([405f345](https://github.com/vuejs/core/commit/405f34587a63a5f1e3d147b9848219ea98acc22d)) + + + +# [3.4.0-alpha.1](https://github.com/vuejs/core/compare/v3.3.7...v3.4.0-alpha.1) (2023-10-28) + + +### Features + +* **compiler-core:** export error message ([#8729](https://github.com/vuejs/core/issues/8729)) ([f7e80ee](https://github.com/vuejs/core/commit/f7e80ee4a065a9eaba98720abf415d9e87756cbd)) +* **compiler-sfc:** expose resolve type-based props and emits ([#8874](https://github.com/vuejs/core/issues/8874)) ([9e77580](https://github.com/vuejs/core/commit/9e77580c0c2f0d977bd0031a1d43cc334769d433)) +* export runtime error strings ([#9301](https://github.com/vuejs/core/issues/9301)) ([feb2f2e](https://github.com/vuejs/core/commit/feb2f2edce2d91218a5e9a52c81e322e4033296b)) +* **reactivity:** more efficient reactivity system ([#5912](https://github.com/vuejs/core/issues/5912)) ([16e06ca](https://github.com/vuejs/core/commit/16e06ca08f5a1e2af3fc7fb35de153dbe0c3087d)), closes [#311](https://github.com/vuejs/core/issues/311) [#1811](https://github.com/vuejs/core/issues/1811) [#6018](https://github.com/vuejs/core/issues/6018) [#7160](https://github.com/vuejs/core/issues/7160) [#8714](https://github.com/vuejs/core/issues/8714) [#9149](https://github.com/vuejs/core/issues/9149) [#9419](https://github.com/vuejs/core/issues/9419) [#9464](https://github.com/vuejs/core/issues/9464) +* **runtime-core:** add `once` option to watch ([#9034](https://github.com/vuejs/core/issues/9034)) ([a645e7a](https://github.com/vuejs/core/commit/a645e7aa51006516ba668b3a4365d296eb92ee7d)) + + + ## [3.3.7](https://github.com/vuejs/core/compare/v3.3.6...v3.3.7) (2023-10-24) diff --cc package.json index 1655ff8b54,59d405b8a1..7f0a46bc14 --- a/package.json +++ b/package.json @@@ -1,7 -1,7 +1,7 @@@ { "private": true, - "version": "3.3.8", + "version": "3.4.0-alpha.1", - "packageManager": "pnpm@8.9.2", + "packageManager": "pnpm@8.10.5", "type": "module", "scripts": { "dev": "node scripts/dev.js", diff --cc packages/compiler-sfc/src/script/resolveType.ts index 12666341e7,cf96007bee..9fde5e97e5 --- a/packages/compiler-sfc/src/script/resolveType.ts +++ b/packages/compiler-sfc/src/script/resolveType.ts @@@ -39,16 -39,10 +39,17 @@@ import { parse as babelParse } from '@b import { parse } from '../parse' import { createCache } from '../cache' import type TS from 'typescript' - import { extname, dirname } from 'path' + import { extname, dirname, join } from 'path' import { minimatch as isMatch } from 'minimatch' + import * as process from 'process' +export type SimpleTypeResolveOptions = Partial< + Pick< + SFCScriptCompileOptions, + 'globalTypeFiles' | 'fs' | 'babelParserPlugins' | 'isProd' + > +> + /** * TypeResolveContext is compatible with ScriptCompileContext * but also allows a simpler version of it with minimal required properties diff --cc packages/reactivity/src/ref.ts index 5a4dd710ea,201766158e..705d442dcf --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@@ -1,10 -1,12 +1,11 @@@ + import type { ComputedRef } from './computed' import { activeEffect, - getDepFromReactive, shouldTrack, - trackEffects, + trackEffect, triggerEffects } from './effect' -import { TrackOpTypes, TriggerOpTypes } from './operations' +import { DirtyLevels, TrackOpTypes, TriggerOpTypes } from './constants' import { isArray, hasChanged, IfAny, isFunction, isObject } from '@vue/shared' import { isProxy, diff --cc packages/runtime-core/__tests__/apiWatch.spec.ts index bddfc5ff54,48fdd2888e..1bc012bb36 --- a/packages/runtime-core/__tests__/apiWatch.spec.ts +++ b/packages/runtime-core/__tests__/apiWatch.spec.ts @@@ -1206,41 -1206,38 +1206,76 @@@ describe('api: watch', () => expect(countW).toBe(2) }) + const options = [ + { name: 'only trigger once watch' }, + { + deep: true, + name: 'only trigger once watch with deep' + }, + { + flush: 'sync', + name: 'only trigger once watch with flush: sync' + }, + { + flush: 'pre', + name: 'only trigger once watch with flush: pre' + }, + { + immediate: true, + name: 'only trigger once watch with immediate' + } + ] as const + test.each(options)('$name', async option => { + const count = ref(0) + const cb = vi.fn() + + watch(count, cb, { once: true, ...option }) + + count.value++ + await nextTick() + + expect(count.value).toBe(1) + expect(cb).toHaveBeenCalledTimes(1) + + count.value++ + await nextTick() + + expect(count.value).toBe(2) + expect(cb).toHaveBeenCalledTimes(1) + }) ++ + // #5151 + test('OnCleanup also needs to be cleaned,', async () => { + const spy1 = vi.fn() + const spy2 = vi.fn() + const num = ref(0) + + watch(num, (value, oldValue, onCleanup) => { + if (value > 1) { + return + } + spy1() + onCleanup(() => { + // OnCleanup also needs to be cleaned + spy2() + }) + }) + + num.value++ + await nextTick() + expect(spy1).toHaveBeenCalledTimes(1) + expect(spy2).toHaveBeenCalledTimes(0) + + num.value++ + await nextTick() + + expect(spy1).toHaveBeenCalledTimes(1) + expect(spy2).toHaveBeenCalledTimes(1) + + num.value++ + await nextTick() + // would not be calld when value>1 + expect(spy1).toHaveBeenCalledTimes(1) + expect(spy2).toHaveBeenCalledTimes(1) + }) }) diff --cc scripts/release.js index 36a304877c,10623eedb7..a9484ff5f4 --- a/scripts/release.js +++ b/scripts/release.js @@@ -335,10 -333,22 +343,22 @@@ async function isInSyncWithRemote() `https://api.github.com/repos/vuejs/core/commits/${branch}?per_page=1` ) const data = await res.json() - return data.sha === (await getSha()) - if (data.sha === sha) { ++ if (data.sha === (await getSha())) { + return true + } else { + // @ts-ignore + const { yes } = await prompt({ + type: 'confirm', + name: 'yes', + message: pico.red( + `Local HEAD is not up-to-date with remote. Are you sure you want to continue?` + ) + }) + return yes + } } catch (e) { console.error( - 'Failed to check whether local HEAD is up-to-date with remote.' + pico.red('Failed to check whether local HEAD is up-to-date with remote.') ) return false } @@@ -420,10 -417,11 +435,10 @@@ async function publishPackage(pkgName, ...(releaseTag ? ['--tag', releaseTag] : []), '--access', 'public', - ...(isDryRun ? ['--dry-run'] : []), - ...(skipGit ? ['--no-git-checks'] : []) + ...additionalFlags ], { - cwd: pkgRoot, + cwd: getPkgRoot(pkgName), stdio: 'pipe' } )