Skip to content

Commit 85de26b

Browse files
committed
Merge branch 'core/main'
* core/main: (94 commits) chore(deps): update dependency @types/node to v22 (vuejs#12320) chore(deps): update lint (vuejs#12319) chore(deps): update all non-major dependencies (vuejs#12316) chore(deps): update build (vuejs#12317) chore(deps): update pnpm to v9.12.3 (vuejs#12278) chore(deps): update dependency typescript-eslint to ^8.11.0 (vuejs#12276) chore(deps): update dependency npm-run-all2 to v7 (vuejs#12277) chore(deps): update all non-major dependencies (vuejs#12275) chore(deps): update build (vuejs#12274) chore(deps): update all non-major dependencies (vuejs#12222) chore(deps): update lint (vuejs#12226) chore(deps): update build (vuejs#12223) docs: update package name to `@vue/compiler-core` (vuejs#12192)[ci skip] chore(deps): update dependency typescript-eslint to ^8.8.1 (vuejs#12167) chore(deps): update dependency magic-string to ^0.30.12 (vuejs#12166) fix(test): update snapshot (vuejs#12169) chore: improve `renderComponentRoot` warn message (vuejs#10914) test(shared): improve test coverage (vuejs#8456) test(defineProps): add intersection type test (vuejs#8684) chore(deps): update dependency @swc/core to ^1.7.35 (vuejs#12165) ...
2 parents 1abf2d0 + 76c43c6 commit 85de26b

File tree

93 files changed

+2868
-1210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2868
-1210
lines changed

CHANGELOG.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,107 @@
1+
## [3.5.12](https://github.com/vuejs/core/compare/v3.5.11...v3.5.12) (2024-10-11)
2+
3+
4+
### Bug Fixes
5+
6+
* **compiler-dom:** avoid stringify option with null value ([#12096](https://github.com/vuejs/core/issues/12096)) ([f6d9926](https://github.com/vuejs/core/commit/f6d99262364b7444ebab8742158599e8cdd79eaa)), closes [#12093](https://github.com/vuejs/core/issues/12093)
7+
* **compiler-sfc:** do not skip TSInstantiationExpression when transforming props destructure ([#12064](https://github.com/vuejs/core/issues/12064)) ([d3ecde8](https://github.com/vuejs/core/commit/d3ecde8a696ff62c8d0ab067fd1d7ee0565b63c5))
8+
* **compiler-sfc:** use sass modern api if available and avoid deprecation warning ([#11992](https://github.com/vuejs/core/issues/11992)) ([4474c11](https://github.com/vuejs/core/commit/4474c113d1fb1c26298dd6794275d5b5c7cc4d93))
9+
* **compiler:** clone loc to `ifNode` ([#12131](https://github.com/vuejs/core/issues/12131)) ([cde2c06](https://github.com/vuejs/core/commit/cde2c0671b00d4f6111fcbd7aa76e45872f20b0c)), closes [vuejs/language-tools#4911](https://github.com/vuejs/language-tools/issues/4911)
10+
* **custom-element:** properly remove hyphenated attribute ([#12143](https://github.com/vuejs/core/issues/12143)) ([e16e9a7](https://github.com/vuejs/core/commit/e16e9a7341e7cfb3c443da4e5e5b06e8158712c3)), closes [#12139](https://github.com/vuejs/core/issues/12139)
11+
* **defineModel:** handle kebab-case model correctly ([#12063](https://github.com/vuejs/core/issues/12063)) ([c0418a3](https://github.com/vuejs/core/commit/c0418a3b8fa96a0b108ab71b7aab5d3388f90557)), closes [#12060](https://github.com/vuejs/core/issues/12060)
12+
* **deps:** update dependency monaco-editor to ^0.52.0 ([#12119](https://github.com/vuejs/core/issues/12119)) ([f7cbea2](https://github.com/vuejs/core/commit/f7cbea2111c7770a180b640f36f6a5d4d6abc698))
13+
* **hydration:** provide compat fallback for idle callback hydration strategy ([#11935](https://github.com/vuejs/core/issues/11935)) ([1ae545a](https://github.com/vuejs/core/commit/1ae545a3786abef983be1c969726489685569c92))
14+
* **reactivity:** trigger reactivity for Map key `undefined` ([#12055](https://github.com/vuejs/core/issues/12055)) ([7ad289e](https://github.com/vuejs/core/commit/7ad289e1e7fea654524008ff91e43a8b8a55ef22)), closes [#12054](https://github.com/vuejs/core/issues/12054)
15+
* **runtime-core:** allow symbol values for slot prop key ([#12069](https://github.com/vuejs/core/issues/12069)) ([d9d4d4e](https://github.com/vuejs/core/commit/d9d4d4e158cd51a9ddda249f29de8467f60b2792)), closes [#12068](https://github.com/vuejs/core/issues/12068)
16+
* **runtime-core:** fix required prop check false positive for kebab-case edge cases ([#12034](https://github.com/vuejs/core/issues/12034)) ([9da1ac1](https://github.com/vuejs/core/commit/9da1ac156552ac449754e1373aac7e349841becb)), closes [#12011](https://github.com/vuejs/core/issues/12011)
17+
* **runtime-dom:** prevent unnecessary updates in v-model checkbox when value is unchanged ([#12146](https://github.com/vuejs/core/issues/12146)) ([ea943af](https://github.com/vuejs/core/commit/ea943afe404c4ca4b729906c5e8daf7aa2ccde9b)), closes [#12144](https://github.com/vuejs/core/issues/12144)
18+
* **teleport:** handle disabled teleport with updateCssVars ([#12113](https://github.com/vuejs/core/issues/12113)) ([76a8223](https://github.com/vuejs/core/commit/76a8223199c148b79a5c0ea19e235164809760cd)), closes [#12112](https://github.com/vuejs/core/issues/12112)
19+
* **transition/ssr:** make transition appear work with Suspense in SSR ([#12047](https://github.com/vuejs/core/issues/12047)) ([f1a4f67](https://github.com/vuejs/core/commit/f1a4f67aedfe83e440c54222213f070774faa421)), closes [#12046](https://github.com/vuejs/core/issues/12046)
20+
* **types:** ensure `this.$props` type does not include `string` ([#12123](https://github.com/vuejs/core/issues/12123)) ([704173e](https://github.com/vuejs/core/commit/704173e24276706de672cca6c9507e4dd9651197)), closes [#12122](https://github.com/vuejs/core/issues/12122)
21+
* **types:** retain union type narrowing with defaults applied ([#12108](https://github.com/vuejs/core/issues/12108)) ([05685a9](https://github.com/vuejs/core/commit/05685a9d7c42d4cd37169b867833776b91154fed)), closes [#12106](https://github.com/vuejs/core/issues/12106)
22+
* **useId:** ensure useId consistency when using serverPrefetch ([#12128](https://github.com/vuejs/core/issues/12128)) ([b4d3534](https://github.com/vuejs/core/commit/b4d35349d8bc39aa15bd3f1094d230e5928b177c)), closes [#12102](https://github.com/vuejs/core/issues/12102)
23+
* **watch:** watchEffect clean-up with SSR ([#12097](https://github.com/vuejs/core/issues/12097)) ([b094c72](https://github.com/vuejs/core/commit/b094c72b3d40c52c7124f145a9db028509a11202)), closes [#11956](https://github.com/vuejs/core/issues/11956)
24+
25+
26+
### Performance Improvements
27+
28+
* **reactivity:** avoid unnecessary recursion in removeSub ([#12135](https://github.com/vuejs/core/issues/12135)) ([ec917cf](https://github.com/vuejs/core/commit/ec917cfdb9d0169cd0835d3a0e28244242657dc9))
29+
30+
31+
32+
## [3.5.11](https://github.com/vuejs/core/compare/v3.5.10...v3.5.11) (2024-10-03)
33+
34+
35+
### Bug Fixes
36+
37+
* **compiler-sfc:** do not skip `TSSatisfiesExpression` when transforming props destructure ([#12062](https://github.com/vuejs/core/issues/12062)) ([2328b05](https://github.com/vuejs/core/commit/2328b051f4efa1f1394b7d4e73b7c3f76e430e7c)), closes [#12061](https://github.com/vuejs/core/issues/12061)
38+
* **reactivity:** prevent overwriting `next` property during batch processing ([#12075](https://github.com/vuejs/core/issues/12075)) ([d3f5e6e](https://github.com/vuejs/core/commit/d3f5e6e5319b4ffaa55ca9a2ea3d95d78e76fa58)), closes [#12072](https://github.com/vuejs/core/issues/12072)
39+
* **scheduler:** job ordering when the post queue is flushing ([#12090](https://github.com/vuejs/core/issues/12090)) ([577edca](https://github.com/vuejs/core/commit/577edca8e7795436efd710d1c289ea8ea2642b0e))
40+
* **types:** correctly infer `TypeProps` when it is `any` ([#12073](https://github.com/vuejs/core/issues/12073)) ([57315ab](https://github.com/vuejs/core/commit/57315ab9688c9741a271d1075bbd28cbe5f71e2f)), closes [#12058](https://github.com/vuejs/core/issues/12058)
41+
* **types:** should not intersect `PublicProps` with `Props` ([#12077](https://github.com/vuejs/core/issues/12077)) ([6f85894](https://github.com/vuejs/core/commit/6f8589437635706f825ccec51800effba1d2bf5f))
42+
* **types:** infer the first generic type of `Ref` correctly ([#12094](https://github.com/vuejs/core/issues/12094)) ([c97bb84](https://github.com/vuejs/core/commit/c97bb84d0b0a16b012f886b6498e924415ed63e5))
43+
44+
45+
46+
## [3.5.10](https://github.com/vuejs/core/compare/v3.5.9...v3.5.10) (2024-09-27)
47+
48+
49+
### Bug Fixes
50+
51+
* **custom-element:** properly set kebab-case props on Vue custom elements ([ea3efa0](https://github.com/vuejs/core/commit/ea3efa09e008918c1d9ba7226833a8b1a7a57244)), closes [#12030](https://github.com/vuejs/core/issues/12030) [#12032](https://github.com/vuejs/core/issues/12032)
52+
* **reactivity:** fix nested batch edge case ([93c95dd](https://github.com/vuejs/core/commit/93c95dd4cd416503f43a98a1455f62658d22b0b2))
53+
* **reactivity:** only clear notified flags for computed in first batch iteration ([aa9ef23](https://github.com/vuejs/core/commit/aa9ef2386a0cd39a174e5a887ec2b1a3525034fc)), closes [#12045](https://github.com/vuejs/core/issues/12045)
54+
* **types/ref:** handle nested refs in UnwrapRef ([#12049](https://github.com/vuejs/core/issues/12049)) ([e2c19c2](https://github.com/vuejs/core/commit/e2c19c20cfee9788519a80c0e53e216b78505994)), closes [#12044](https://github.com/vuejs/core/issues/12044)
55+
56+
57+
58+
## [3.5.9](https://github.com/vuejs/core/compare/v3.5.8...v3.5.9) (2024-09-26)
59+
60+
61+
### Bug Fixes
62+
63+
* **reactivity:** fix property dep removal regression ([6001e5c](https://github.com/vuejs/core/commit/6001e5c81a05c894586f9287fbd991677bdd0455)), closes [#12020](https://github.com/vuejs/core/issues/12020) [#12021](https://github.com/vuejs/core/issues/12021)
64+
* **reactivity:** fix recursive sync watcher on computed edge case ([10ff159](https://github.com/vuejs/core/commit/10ff15924053d9bd95ad706f78ce09e288213fcf)), closes [#12033](https://github.com/vuejs/core/issues/12033) [#12037](https://github.com/vuejs/core/issues/12037)
65+
* **runtime-core:** avoid rendering plain object as VNode ([#12038](https://github.com/vuejs/core/issues/12038)) ([cb34b28](https://github.com/vuejs/core/commit/cb34b28a4a9bf868be4785b001c526163eda342e)), closes [#12035](https://github.com/vuejs/core/issues/12035) [vitejs/vite-plugin-vue#353](https://github.com/vitejs/vite-plugin-vue/issues/353)
66+
* **runtime-core:** make useId() always return a string ([a177092](https://github.com/vuejs/core/commit/a177092754642af2f98c33a4feffe8f198c3c950))
67+
* **types:** correct type inference of union event names ([#12022](https://github.com/vuejs/core/issues/12022)) ([4da6881](https://github.com/vuejs/core/commit/4da688141d9e7c15b622c289deaa81b11845b2c7))
68+
* **vue:** properly cache runtime compilation ([#12019](https://github.com/vuejs/core/issues/12019)) ([fa0ba24](https://github.com/vuejs/core/commit/fa0ba24b3ace02d7ecab65e57c2bea89a2550dcb))
69+
70+
71+
72+
## [3.5.8](https://github.com/vuejs/core/compare/v3.5.7...v3.5.8) (2024-09-22)
73+
74+
75+
### Bug Fixes
76+
77+
* **reactivity:** do not remove dep from depsMap when cleaning up deps of computed ([#11995](https://github.com/vuejs/core/issues/11995)) ([0267a58](https://github.com/vuejs/core/commit/0267a588017eee4951ac2a877fe1ccae84cad905))
78+
79+
80+
81+
## [3.5.7](https://github.com/vuejs/core/compare/v3.5.6...v3.5.7) (2024-09-20)
82+
83+
84+
### Bug Fixes
85+
86+
* **compile-core:** fix v-model with newlines edge case ([#11960](https://github.com/vuejs/core/issues/11960)) ([6224288](https://github.com/vuejs/core/commit/62242886d705ece88dbcad45bb78072ecccad0ca)), closes [#8306](https://github.com/vuejs/core/issues/8306)
87+
* **compiler-sfc:** initialize scope with null prototype object ([#11963](https://github.com/vuejs/core/issues/11963)) ([215e154](https://github.com/vuejs/core/commit/215e15407294bf667261360218f975b88c99c2e5))
88+
* **hydration:** avoid observing non-Element node ([#11954](https://github.com/vuejs/core/issues/11954)) ([7257e6a](https://github.com/vuejs/core/commit/7257e6a34200409b3fc347d3bb807e11e2785974)), closes [#11952](https://github.com/vuejs/core/issues/11952)
89+
* **reactivity:** do not remove dep from depsMap when unsubbed by computed ([960706e](https://github.com/vuejs/core/commit/960706eebf73f08ebc9d5dd853a05def05e2c153))
90+
* **reactivity:** fix dev-only memory leak by updating dep.subsHead on sub removal ([5c8b76e](https://github.com/vuejs/core/commit/5c8b76ed6cfbbcee4cbaac0b72beab7291044e4f)), closes [#11956](https://github.com/vuejs/core/issues/11956)
91+
* **reactivity:** fix memory leak from dep instances of garbage collected objects ([235ea47](https://github.com/vuejs/core/commit/235ea4772ed2972914cf142da8b7ac1fb04f7585)), closes [#11979](https://github.com/vuejs/core/issues/11979) [#11971](https://github.com/vuejs/core/issues/11971)
92+
* **reactivity:** fix triggerRef call on ObjectRefImpl returned by toRef ([#11986](https://github.com/vuejs/core/issues/11986)) ([b030c8b](https://github.com/vuejs/core/commit/b030c8bc7327877efb98aa3d9a58eb287a6ff07a)), closes [#11982](https://github.com/vuejs/core/issues/11982)
93+
* **scheduler:** ensure recursive jobs can't be queued twice ([#11955](https://github.com/vuejs/core/issues/11955)) ([d18d6aa](https://github.com/vuejs/core/commit/d18d6aa1b20dc57a8103c51ec4d61e8e53ed936d))
94+
* **ssr:** don't render comments in TransitionGroup ([#11961](https://github.com/vuejs/core/issues/11961)) ([a2f6ede](https://github.com/vuejs/core/commit/a2f6edeb02faedbb673c4bc5c6a59d9a79a37d07)), closes [#11958](https://github.com/vuejs/core/issues/11958)
95+
* **transition:** respect `duration` setting even when it is `0` ([#11967](https://github.com/vuejs/core/issues/11967)) ([f927a4a](https://github.com/vuejs/core/commit/f927a4ae6f7c453f70ba89498ee0c737dc9866fd))
96+
* **types:** correct type inference of all-optional props ([#11644](https://github.com/vuejs/core/issues/11644)) ([9eca65e](https://github.com/vuejs/core/commit/9eca65ee9871d1ac878755afa9a3eb1b02030350)), closes [#11733](https://github.com/vuejs/core/issues/11733) [vuejs/language-tools#4704](https://github.com/vuejs/language-tools/issues/4704)
97+
98+
99+
### Performance Improvements
100+
101+
* **hydration:** avoid observer if element is in viewport ([#11639](https://github.com/vuejs/core/issues/11639)) ([e075dfa](https://github.com/vuejs/core/commit/e075dfad5c7649c6045e3711687ec888e7aa1a39))
102+
103+
104+
1105
## [3.5.6](https://github.com/vuejs/core/compare/v3.5.5...v3.5.6) (2024-09-16)
2106

3107

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import importX from 'eslint-plugin-import-x'
22
import tseslint from 'typescript-eslint'
3-
import vitest from 'eslint-plugin-vitest'
3+
import vitest from '@vitest/eslint-plugin'
44
import { builtinModules } from 'node:module'
55

66
const DOMGlobals = ['window', 'document']

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
3-
"version": "3.5.6",
4-
"packageManager": "pnpm@9.10.0",
3+
"version": "3.5.12",
4+
"packageManager": "pnpm@9.12.3",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
@@ -61,51 +61,51 @@
6161
"devDependencies": {
6262
"@babel/parser": "catalog:",
6363
"@babel/types": "catalog:",
64-
"@rollup/plugin-alias": "^5.1.0",
65-
"@rollup/plugin-commonjs": "^26.0.1",
64+
"@rollup/plugin-alias": "^5.1.1",
65+
"@rollup/plugin-commonjs": "^28.0.1",
6666
"@rollup/plugin-json": "^6.1.0",
67-
"@rollup/plugin-node-resolve": "^15.2.3",
67+
"@rollup/plugin-node-resolve": "^15.3.0",
6868
"@rollup/plugin-replace": "5.0.4",
69-
"@swc/core": "^1.7.26",
69+
"@swc/core": "^1.7.42",
7070
"@types/hash-sum": "^1.0.2",
71-
"@types/node": "^20.16.5",
71+
"@types/node": "^22.8.7",
7272
"@types/semver": "^7.5.8",
7373
"@types/serve-handler": "^6.1.4",
7474
"@vitest/coverage-v8": "^2.1.1",
7575
"@vue/consolidate": "1.0.0",
7676
"conventional-changelog-cli": "^5.0.0",
7777
"enquirer": "^2.4.1",
78-
"esbuild": "^0.23.1",
78+
"esbuild": "^0.24.0",
7979
"esbuild-plugin-polyfill-node": "^0.3.0",
80-
"eslint": "^9.10.0",
81-
"eslint-plugin-import-x": "^4.2.1",
82-
"eslint-plugin-vitest": "^0.5.4",
80+
"eslint": "^9.14.0",
81+
"eslint-plugin-import-x": "^4.4.0",
82+
"@vitest/eslint-plugin": "^1.0.1",
8383
"estree-walker": "catalog:",
8484
"jsdom": "^25.0.0",
8585
"lint-staged": "^15.2.10",
8686
"lodash": "^4.17.21",
87-
"magic-string": "^0.30.11",
88-
"markdown-table": "^3.0.3",
87+
"magic-string": "^0.30.12",
88+
"markdown-table": "^3.0.4",
8989
"marked": "13.0.3",
90-
"npm-run-all2": "^6.2.3",
91-
"picocolors": "^1.1.0",
90+
"npm-run-all2": "^7.0.1",
91+
"picocolors": "^1.1.1",
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.3",
97+
"rollup": "^4.24.3",
9898
"rollup-plugin-dts": "^6.1.1",
9999
"rollup-plugin-esbuild": "^6.1.1",
100100
"rollup-plugin-polyfill-node": "^0.13.0",
101101
"semver": "^7.6.3",
102-
"serve": "^14.2.3",
103-
"serve-handler": "^6.1.5",
102+
"serve": "^14.2.4",
103+
"serve-handler": "^6.1.6",
104104
"simple-git-hooks": "^2.11.1",
105105
"todomvc-app-css": "^2.4.3",
106-
"tslib": "^2.7.0",
106+
"tslib": "^2.8.1",
107107
"typescript": "~5.6.2",
108-
"typescript-eslint": "^8.5.0",
108+
"typescript-eslint": "^8.12.2",
109109
"vite": "catalog:",
110110
"vitest": "^2.1.1"
111111
},

packages-private/dts-test/defineComponent.test-d.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,3 +2068,13 @@ expectString(instance.actionText)
20682068
// public prop on $props should be optional
20692069
// @ts-expect-error
20702070
expectString(instance.$props.actionText)
2071+
2072+
// #12122
2073+
defineComponent({
2074+
props: { foo: String },
2075+
render() {
2076+
expectType<{ readonly foo?: string }>(this.$props)
2077+
// @ts-expect-error
2078+
expectType<string>(this.$props)
2079+
},
2080+
})

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,24 @@ describe('allow getter and setter types to be unrelated', <T>() => {
189189
f.value = ref(1)
190190
})
191191

192+
describe('correctly unwraps nested refs', () => {
193+
const obj = {
194+
n: 24,
195+
ref: ref(24),
196+
nestedRef: ref({ n: ref(0) }),
197+
}
198+
199+
const a = ref(obj)
200+
expectType<number>(a.value.n)
201+
expectType<number>(a.value.ref)
202+
expectType<number>(a.value.nestedRef.n)
203+
204+
const b = reactive({ a })
205+
expectType<number>(b.a.n)
206+
expectType<number>(b.a.ref)
207+
expectType<number>(b.a.nestedRef.n)
208+
})
209+
192210
// computed
193211
describe('allow computed getter and setter types to be unrelated', () => {
194212
const obj = ref({

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,23 @@ describe('withDefaults w/ defineProp type is different from the defaults type',
240240
res1.value
241241
})
242242

243+
describe('withDefaults w/ defineProp discriminate union type', () => {
244+
const props = withDefaults(
245+
defineProps<
246+
{ type: 'button'; buttonType?: 'submit' } | { type: 'link'; href: string }
247+
>(),
248+
{
249+
type: 'button',
250+
},
251+
)
252+
if (props.type === 'button') {
253+
expectType<'submit' | undefined>(props.buttonType)
254+
}
255+
if (props.type === 'link') {
256+
expectType<string>(props.href)
257+
}
258+
})
259+
243260
describe('defineProps w/ runtime declaration', () => {
244261
// runtime declaration
245262
const props = defineProps({

packages-private/sfc-playground/src/App.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ onMounted(() => {
123123
:prod="productionMode"
124124
:ssr="useSSRMode"
125125
:autoSave="autoSave"
126+
:theme="theme"
126127
@toggle-theme="toggleTheme"
127128
@toggle-prod="toggleProdMode"
128129
@toggle-ssr="toggleSSR"
@@ -136,7 +137,8 @@ onMounted(() => {
136137
@keydown.ctrl.s.prevent
137138
@keydown.meta.s.prevent
138139
:ssr="useSSRMode"
139-
:autoSave="autoSave"
140+
:model-value="autoSave"
141+
:editorOptions="{ autoSaveText: false }"
140142
:store="store"
141143
:showCompileOutput="true"
142144
:autoResize="true"

packages-private/sfc-playground/src/Header.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const props = defineProps<{
1515
prod: boolean
1616
ssr: boolean
1717
autoSave: boolean
18+
theme: 'dark' | 'light'
1819
}>()
1920
const emit = defineEmits([
2021
'toggle-theme',
@@ -117,7 +118,11 @@ function toggleDark() {
117118
>
118119
<span>{{ autoSave ? 'AutoSave ON' : 'AutoSave OFF' }}</span>
119120
</button>
120-
<button title="Toggle dark mode" class="toggle-dark" @click="toggleDark">
121+
<button
122+
:title="`Switch to ${theme === 'dark' ? 'light' : 'dark'} theme`"
123+
class="toggle-dark"
124+
@click="toggleDark"
125+
>
121126
<Sun class="light" />
122127
<Moon class="dark" />
123128
</button>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"vue": "^3.4.0"
1212
},
1313
"devDependencies": {
14-
"@vitejs/plugin-vue": "^5.1.3",
15-
"vite": "^5.4.5"
14+
"@vitejs/plugin-vue": "^5.1.4",
15+
"vite": "^5.4.10"
1616
}
1717
}

packages-private/template-explorer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"enableNonBrowserBranches": true
1212
},
1313
"dependencies": {
14-
"monaco-editor": "^0.51.0",
14+
"monaco-editor": "^0.52.0",
1515
"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.6",
3+
"version": "3.5.12",
44
"description": "@vue/compiler-core",
55
"main": "index.js",
66
"module": "dist/compiler-core.esm-bundler.js",

packages/compiler-core/src/parser.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,10 @@ function getLoc(start: number, end?: number): SourceLocation {
933933
}
934934
}
935935

936+
export function cloneLoc(loc: SourceLocation): SourceLocation {
937+
return getLoc(loc.start.offset, loc.end.offset)
938+
}
939+
936940
function setLocEnd(loc: SourceLocation, end: number) {
937941
loc.end = tokenizer.getPos(end)
938942
loc.source = getSlice(loc.start.offset, end)

packages/compiler-core/src/transforms/vIf.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
import { ErrorCodes, createCompilerError } from '../errors'
3131
import { processExpression } from './transformExpression'
3232
import { validateBrowserExpression } from '../validateExpression'
33+
import { cloneLoc } from '../parser'
3334
import { CREATE_COMMENT, FRAGMENT } from '../runtimeHelpers'
3435
import { findDir, findProp, getMemoedVNodeCall, injectProp } from '../utils'
3536
import { PatchFlags } from '@vue/shared'
@@ -110,7 +111,7 @@ export function processIf(
110111
const branch = createIfBranch(node, dir)
111112
const ifNode: IfNode = {
112113
type: NodeTypes.IF,
113-
loc: node.loc,
114+
loc: cloneLoc(node.loc),
114115
branches: [branch],
115116
}
116117
context.replaceNode(ifNode)

packages/compiler-core/src/transforms/vModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
3131

3232
// we assume v-model directives are always parsed
3333
// (not artificially created by a transform)
34-
const rawExp = exp.loc.source
34+
const rawExp = exp.loc.source.trim()
3535
const expString =
3636
exp.type === NodeTypes.SIMPLE_EXPRESSION ? exp.content : rawExp
3737

0 commit comments

Comments
 (0)