Skip to content

Commit b98eaa1

Browse files
Merge branch 'main' into patch-3
2 parents b23a04e + 9a36f2a commit b98eaa1

File tree

38 files changed

+772
-569
lines changed

38 files changed

+772
-569
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [3.5.6](https://github.com/vuejs/core/compare/v3.5.5...v3.5.6) (2024-09-16)
2+
3+
4+
### Bug Fixes
5+
6+
* **compile-dom:** should be able to stringify mathML ([#11891](https://github.com/vuejs/core/issues/11891)) ([85c138c](https://github.com/vuejs/core/commit/85c138ced108268f7656b568dfd3036a1e0aae34))
7+
* **compiler-sfc:** preserve old behavior when using withDefaults with desutructure ([8492c3c](https://github.com/vuejs/core/commit/8492c3c49a922363d6c77ef192c133a8fbce6514)), closes [#11930](https://github.com/vuejs/core/issues/11930)
8+
* **reactivity:** avoid exponential perf cost and reduce call stack depth for deeply chained computeds ([#11944](https://github.com/vuejs/core/issues/11944)) ([c74bb8c](https://github.com/vuejs/core/commit/c74bb8c2dd9e82aaabb0a2a2b368e900929b513b)), closes [#11928](https://github.com/vuejs/core/issues/11928)
9+
* **reactivity:** rely on dirty check only when computed has deps ([#11931](https://github.com/vuejs/core/issues/11931)) ([aa5dafd](https://github.com/vuejs/core/commit/aa5dafd2b55d42d6a29316a3bc91aea85c676a0b)), closes [#11929](https://github.com/vuejs/core/issues/11929)
10+
* **watch:** `once` option should be ignored by watchEffect ([#11884](https://github.com/vuejs/core/issues/11884)) ([49fa673](https://github.com/vuejs/core/commit/49fa673493d93b77ddba2165ab6545bae84fd1ae))
11+
* **watch:** unwatch should be callable during SSR ([#11925](https://github.com/vuejs/core/issues/11925)) ([2d6adf7](https://github.com/vuejs/core/commit/2d6adf78a047eed091db277ffbd9df0822fb0bdd)), closes [#11924](https://github.com/vuejs/core/issues/11924)
12+
13+
14+
115
## [3.5.5](https://github.com/vuejs/core/compare/v3.5.4...v3.5.5) (2024-09-13)
216

317

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"version": "3.5.5",
3+
"version": "3.5.6",
44
"packageManager": "[email protected]",
55
"type": "module",
66
"scripts": {
@@ -17,11 +17,11 @@
1717
"format": "prettier --write --cache .",
1818
"format-check": "prettier --check --cache .",
1919
"test": "vitest",
20-
"test-unit": "vitest -c vitest.unit.config.ts",
21-
"test-e2e": "node scripts/build.js vue -f global -d && vitest -c vitest.e2e.config.ts",
20+
"test-unit": "vitest --project unit",
21+
"test-e2e": "node scripts/build.js vue -f global -d && vitest --project e2e",
2222
"test-dts": "run-s build-dts test-dts-only",
2323
"test-dts-only": "tsc -p packages-private/dts-built-test/tsconfig.json && tsc -p ./packages-private/dts-test/tsconfig.test.json",
24-
"test-coverage": "vitest run -c vitest.unit.config.ts --coverage",
24+
"test-coverage": "vitest run --project unit --coverage",
2525
"test-bench": "vitest bench",
2626
"release": "node scripts/release.js",
2727
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
@@ -66,19 +66,19 @@
6666
"@rollup/plugin-json": "^6.1.0",
6767
"@rollup/plugin-node-resolve": "^15.2.3",
6868
"@rollup/plugin-replace": "5.0.4",
69-
"@swc/core": "^1.7.24",
69+
"@swc/core": "^1.7.26",
7070
"@types/hash-sum": "^1.0.2",
7171
"@types/node": "^20.16.5",
7272
"@types/semver": "^7.5.8",
7373
"@types/serve-handler": "^6.1.4",
74-
"@vitest/coverage-v8": "^2.0.5",
74+
"@vitest/coverage-v8": "^2.1.1",
7575
"@vue/consolidate": "1.0.0",
7676
"conventional-changelog-cli": "^5.0.0",
7777
"enquirer": "^2.4.1",
7878
"esbuild": "^0.23.1",
7979
"esbuild-plugin-polyfill-node": "^0.3.0",
80-
"eslint": "^9.9.1",
81-
"eslint-plugin-import-x": "^3.1.0",
80+
"eslint": "^9.10.0",
81+
"eslint-plugin-import-x": "^4.2.1",
8282
"eslint-plugin-vitest": "^0.5.4",
8383
"estree-walker": "catalog:",
8484
"jsdom": "^25.0.0",
@@ -87,14 +87,14 @@
8787
"magic-string": "^0.30.11",
8888
"markdown-table": "^3.0.3",
8989
"marked": "13.0.3",
90-
"npm-run-all2": "^6.2.2",
90+
"npm-run-all2": "^6.2.3",
9191
"picocolors": "^1.1.0",
9292
"prettier": "^3.3.3",
9393
"pretty-bytes": "^6.1.1",
9494
"pug": "^3.0.3",
9595
"puppeteer": "~23.3.0",
9696
"rimraf": "^6.0.1",
97-
"rollup": "^4.21.2",
97+
"rollup": "^4.21.3",
9898
"rollup-plugin-dts": "^6.1.1",
9999
"rollup-plugin-esbuild": "^6.1.1",
100100
"rollup-plugin-polyfill-node": "^0.13.0",
@@ -105,9 +105,9 @@
105105
"todomvc-app-css": "^2.4.3",
106106
"tslib": "^2.7.0",
107107
"typescript": "~5.6.2",
108-
"typescript-eslint": "^8.4.0",
108+
"typescript-eslint": "^8.5.0",
109109
"vite": "catalog:",
110-
"vitest": "^2.0.5"
110+
"vitest": "^2.1.1"
111111
},
112112
"pnpm": {
113113
"peerDependencyRules": {

packages-private/dts-test/appDirective.test-d.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ import { expectType } from './utils'
33

44
const app = createApp({})
55

6-
app.directive<HTMLElement, string>('custom', {
7-
mounted(el, binding) {
8-
expectType<HTMLElement>(el)
9-
expectType<string>(binding.value)
6+
app.directive<HTMLElement, string, 'prevent' | 'stop', 'arg1' | 'arg2'>(
7+
'custom',
8+
{
9+
mounted(el, binding) {
10+
expectType<HTMLElement>(el)
11+
expectType<string>(binding.value)
12+
expectType<{ prevent: boolean; stop: boolean }>(binding.modifiers)
13+
expectType<'arg1' | 'arg2'>(binding.arg!)
1014

11-
// @ts-expect-error not any
12-
expectType<number>(binding.value)
15+
// @ts-expect-error not any
16+
expectType<number>(binding.value)
17+
},
1318
},
14-
})
19+
)

packages-private/global.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference types="vite/client" />
2+
3+
// Global compile-time constants
4+
declare var __COMMIT__: string
5+
6+
declare module 'file-saver' {
7+
export function saveAs(blob: any, name: any): void
8+
}

packages-private/sfc-playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"vite": "catalog:"
1414
},
1515
"dependencies": {
16-
"@vue/repl": "^4.4.0",
16+
"@vue/repl": "^4.4.2",
1717
"file-saver": "^2.0.5",
1818
"jszip": "^3.10.1",
1919
"vue": "workspace:*"

packages-private/sfc-playground/src/download/template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
},
1313
"devDependencies": {
1414
"@vitejs/plugin-vue": "^5.1.3",
15-
"vite": "^5.4.3"
15+
"vite": "^5.4.5"
1616
}
1717
}

packages-private/template-explorer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
},
1313
"dependencies": {
1414
"monaco-editor": "^0.51.0",
15-
"source-map-js": "^1.2.0"
15+
"source-map-js": "^1.2.1"
1616
}
1717
}

packages/compiler-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-core",
3-
"version": "3.5.5",
3+
"version": "3.5.6",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",

packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,24 @@ describe('stringify static html', () => {
389389
])
390390
})
391391

392+
test('should stringify mathML', () => {
393+
const math = `<math xmlns="http://www.w3.org/1998/Math/MathML">`
394+
const repeated = `<ms>1</ms>`
395+
const { ast } = compileWithStringify(
396+
`<div>${math}${repeat(
397+
repeated,
398+
StringifyThresholds.NODE_COUNT,
399+
)}</math></div>`,
400+
)
401+
402+
expect(ast.cached).toMatchObject([
403+
cachedArrayStaticNodeMatcher(
404+
`${math}${repeat(repeated, StringifyThresholds.NODE_COUNT)}</math>`,
405+
1,
406+
),
407+
])
408+
})
409+
392410
// #5439
393411
test('stringify v-html', () => {
394412
const { code } = compileWithStringify(`

packages/compiler-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-dom",
3-
"version": "3.5.5",
3+
"version": "3.5.6",
44
"description": "@vue/compiler-dom",
55
"main": "index.js",
66
"module": "dist/compiler-dom.esm-bundler.js",

packages/compiler-dom/src/transforms/stringifyStatic.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
isArray,
2525
isBooleanAttr,
2626
isKnownHtmlAttr,
27+
isKnownMathMLAttr,
2728
isKnownSvgAttr,
2829
isString,
2930
isSymbol,
@@ -190,7 +191,9 @@ const isStringifiableAttr = (name: string, ns: Namespaces) => {
190191
? isKnownHtmlAttr(name)
191192
: ns === Namespaces.SVG
192193
? isKnownSvgAttr(name)
193-
: false) || dataAriaRE.test(name)
194+
: ns === Namespaces.MATH_ML
195+
? isKnownMathMLAttr(name)
196+
: false) || dataAriaRE.test(name)
194197
)
195198
}
196199

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,15 @@ describe('sfc reactive props destructure', () => {
378378
).toThrow(`destructure cannot use computed key`)
379379
})
380380

381-
test('should error when used with withDefaults', () => {
382-
expect(() =>
383-
compile(
384-
`<script setup lang="ts">
385-
const { foo } = withDefaults(defineProps<{ foo: string }>(), { foo: 'foo' })
386-
</script>`,
387-
),
388-
).toThrow(`withDefaults() is unnecessary when using destructure`)
381+
test('should warn when used with withDefaults', () => {
382+
compile(
383+
`<script setup lang="ts">
384+
const { foo } = withDefaults(defineProps<{ foo: string }>(), { foo: 'foo' })
385+
</script>`,
386+
)
387+
expect(
388+
`withDefaults() is unnecessary when using destructure`,
389+
).toHaveBeenWarned()
389390
})
390391

391392
test('should error if destructure reference local vars', () => {

packages/compiler-sfc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-sfc",
3-
"version": "3.5.5",
3+
"version": "3.5.6",
44
"description": "@vue/compiler-sfc",
55
"main": "dist/compiler-sfc.cjs.js",
66
"module": "dist/compiler-sfc.esm-browser.js",
@@ -49,7 +49,7 @@
4949
"@vue/shared": "workspace:*",
5050
"estree-walker": "catalog:",
5151
"magic-string": "catalog:",
52-
"postcss": "^8.4.44",
52+
"postcss": "^8.4.47",
5353
"source-map-js": "catalog:"
5454
},
5555
"devDependencies": {

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { ModelDecl } from './defineModel'
88
import type { BindingMetadata } from '../../../compiler-core/src'
99
import MagicString from 'magic-string'
1010
import type { TypeScope } from './resolveType'
11+
import { warn } from '../warn'
1112

1213
export class ScriptCompileContext {
1314
isJS: boolean
@@ -145,20 +146,31 @@ export class ScriptCompileContext {
145146
return block.content.slice(node.start!, node.end!)
146147
}
147148

149+
warn(msg: string, node: Node, scope?: TypeScope): void {
150+
warn(generateError(msg, node, this, scope))
151+
}
152+
148153
error(msg: string, node: Node, scope?: TypeScope): never {
149-
const offset = scope ? scope.offset : this.startOffset!
150154
throw new Error(
151-
`[@vue/compiler-sfc] ${msg}\n\n${
152-
(scope || this.descriptor).filename
153-
}\n${generateCodeFrame(
154-
(scope || this.descriptor).source,
155-
node.start! + offset,
156-
node.end! + offset,
157-
)}`,
155+
`[@vue/compiler-sfc] ${generateError(msg, node, this, scope)}`,
158156
)
159157
}
160158
}
161159

160+
function generateError(
161+
msg: string,
162+
node: Node,
163+
ctx: ScriptCompileContext,
164+
scope?: TypeScope,
165+
) {
166+
const offset = scope ? scope.offset : ctx.startOffset!
167+
return `${msg}\n\n${(scope || ctx.descriptor).filename}\n${generateCodeFrame(
168+
(scope || ctx.descriptor).source,
169+
node.start! + offset,
170+
node.end! + offset,
171+
)}`
172+
}
173+
162174
export function resolveParserPlugins(
163175
lang: string,
164176
userPlugins?: ParserPlugin[],

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function processDefineProps(
4848
ctx: ScriptCompileContext,
4949
node: Node,
5050
declId?: LVal,
51+
isWithDefaults = false,
5152
): boolean {
5253
if (!isCallOf(node, DEFINE_PROPS)) {
5354
return processWithDefaults(ctx, node, declId)
@@ -81,7 +82,7 @@ export function processDefineProps(
8182
}
8283

8384
// handle props destructure
84-
if (declId && declId.type === 'ObjectPattern') {
85+
if (!isWithDefaults && declId && declId.type === 'ObjectPattern') {
8586
processPropsDestructure(ctx, declId)
8687
}
8788

@@ -99,7 +100,14 @@ function processWithDefaults(
99100
if (!isCallOf(node, WITH_DEFAULTS)) {
100101
return false
101102
}
102-
if (!processDefineProps(ctx, node.arguments[0], declId)) {
103+
if (
104+
!processDefineProps(
105+
ctx,
106+
node.arguments[0],
107+
declId,
108+
true /* isWithDefaults */,
109+
)
110+
) {
103111
ctx.error(
104112
`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`,
105113
node.arguments[0] || node,
@@ -113,10 +121,11 @@ function processWithDefaults(
113121
node,
114122
)
115123
}
116-
if (ctx.propsDestructureDecl) {
117-
ctx.error(
124+
if (declId && declId.type === 'ObjectPattern') {
125+
ctx.warn(
118126
`${WITH_DEFAULTS}() is unnecessary when using destructure with ${DEFINE_PROPS}().\n` +
119-
`Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...).`,
127+
`Reactive destructure will be disabled when using withDefaults().\n` +
128+
`Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...). `,
120129
node.callee,
121130
)
122131
}

packages/compiler-ssr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/compiler-ssr",
3-
"version": "3.5.5",
3+
"version": "3.5.6",
44
"description": "@vue/compiler-ssr",
55
"main": "dist/compiler-ssr.cjs.js",
66
"types": "dist/compiler-ssr.d.ts",

packages/global.d.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/// <reference types="vite/client" />
2-
31
// Global compile-time constants
42
declare var __DEV__: boolean
53
declare var __TEST__: boolean
@@ -9,7 +7,6 @@ declare var __ESM_BUNDLER__: boolean
97
declare var __ESM_BROWSER__: boolean
108
declare var __CJS__: boolean
119
declare var __SSR__: boolean
12-
declare var __COMMIT__: string
1310
declare var __VERSION__: string
1411
declare var __COMPAT__: boolean
1512

@@ -21,10 +18,6 @@ declare var __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__: boolean
2118

2219
declare module '*.vue' {}
2320

24-
declare module 'file-saver' {
25-
export function saveAs(blob: any, name: any): void
26-
}
27-
2821
declare module 'estree-walker' {
2922
export function walk<T>(
3023
root: T,

0 commit comments

Comments
 (0)