Skip to content

Commit 9d557d9

Browse files
authored
Merge branch 'main' into transition
2 parents 8cd3e33 + ed01d92 commit 9d557d9

File tree

201 files changed

+5750
-2146
lines changed

Some content is hidden

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

201 files changed

+5750
-2146
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
uses: ./.github/workflows/test.yml
1717

1818
continuous-release:
19+
if: github.repository == 'vuejs/core'
1920
runs-on: ubuntu-latest
2021
steps:
2122
- name: Checkout

.github/workflows/size-data.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ env:
1818

1919
jobs:
2020
upload:
21+
if: github.repository == 'vuejs/core'
2122
runs-on: ubuntu-latest
2223

2324
steps:

.github/workflows/size-report.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
size-report:
1919
runs-on: ubuntu-latest
2020
if: >
21+
github.repository == 'vuejs/core' &&
2122
github.event.workflow_run.event == 'pull_request' &&
2223
github.event.workflow_run.conclusion == 'success'
2324
steps:
@@ -65,7 +66,7 @@ jobs:
6566
if_no_artifact_found: warn
6667

6768
- name: Prepare report
68-
run: pnpm tsx scripts/size-report.ts > size-report.md
69+
run: node scripts/size-report.js > size-report.md
6970

7071
- name: Read Size Report
7172
id: size-report

CHANGELOG.md

Lines changed: 280 additions & 0 deletions
Large diffs are not rendered by default.

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: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"private": true,
3-
"version": "3.5.0-rc.1",
4-
"packageManager": "pnpm@9.9.0",
3+
"version": "3.5.12",
4+
"packageManager": "pnpm@9.12.2",
55
"type": "module",
66
"scripts": {
77
"dev": "node scripts/dev.js",
88
"build": "node scripts/build.js",
9-
"build-dts": "tsc -p tsconfig.build-browser.json && tsc -p tsconfig.build-node.json && rollup -c rollup.dts.config.js",
10-
"clean": "rimraf packages/*/dist temp .eslintcache",
11-
"size": "run-s \"size-*\" && tsx scripts/usage-size.ts",
9+
"build-dts": "tsc -p tsconfig.build.json --noCheck && rollup -c rollup.dts.config.js",
10+
"clean": "rimraf --glob packages/*/dist temp .eslintcache",
11+
"size": "run-s \"size-*\" && node scripts/usage-size.js",
1212
"size-global": "node scripts/build.js vue runtime-dom -f global -p --size",
1313
"size-esm-runtime": "node scripts/build.js vue -f esm-bundler-runtime",
1414
"size-esm": "node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler",
@@ -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",
@@ -61,54 +61,53 @@
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.19",
69+
"@swc/core": "^1.7.36",
7070
"@types/hash-sum": "^1.0.2",
71-
"@types/node": "^20.16.2",
71+
"@types/node": "^20.16.13",
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",
78-
"esbuild": "^0.23.1",
78+
"esbuild": "^0.24.0",
7979
"esbuild-plugin-polyfill-node": "^0.3.0",
80-
"eslint": "^9.9.1",
81-
"eslint-plugin-import-x": "^3.1.0",
82-
"eslint-plugin-vitest": "^0.5.4",
80+
"eslint": "^9.13.0",
81+
"eslint-plugin-import-x": "^4.3.1",
82+
"@vitest/eslint-plugin": "^1.0.1",
8383
"estree-walker": "catalog:",
8484
"jsdom": "^25.0.0",
85-
"lint-staged": "^15.2.9",
85+
"lint-staged": "^15.2.10",
8686
"lodash": "^4.17.21",
87-
"magic-string": "^0.30.11",
87+
"magic-string": "^0.30.12",
8888
"markdown-table": "^3.0.3",
8989
"marked": "13.0.3",
90-
"npm-run-all2": "^6.2.2",
91-
"picocolors": "^1.0.1",
90+
"npm-run-all2": "^6.2.6",
91+
"picocolors": "^1.1.1",
9292
"prettier": "^3.3.3",
9393
"pretty-bytes": "^6.1.1",
9494
"pug": "^3.0.3",
95-
"puppeteer": "~23.0.2",
95+
"puppeteer": "~23.3.0",
9696
"rimraf": "^6.0.1",
97-
"rollup": "^4.21.1",
97+
"rollup": "^4.24.0",
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",
107-
"tsx": "^4.19.0",
108-
"typescript": "~5.5.4",
109-
"typescript-eslint": "^8.3.0",
106+
"tslib": "^2.8.0",
107+
"typescript": "~5.6.2",
108+
"typescript-eslint": "^8.10.0",
110109
"vite": "catalog:",
111-
"vitest": "^2.0.5"
110+
"vitest": "^2.1.1"
112111
},
113112
"pnpm": {
114113
"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/dts-test/defineComponent.test-d.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,18 @@ describe('emits', () => {
10411041
},
10421042
})
10431043

1044+
// #11803 manual props annotation in setup()
1045+
const Hello = defineComponent({
1046+
name: 'HelloWorld',
1047+
inheritAttrs: false,
1048+
props: { foo: String },
1049+
emits: {
1050+
customClick: (args: string) => typeof args === 'string',
1051+
},
1052+
setup(props: { foo?: string }) {},
1053+
})
1054+
;<Hello onCustomClick={() => {}} />
1055+
10441056
// without emits
10451057
defineComponent({
10461058
setup(props, { emit }) {
@@ -1810,6 +1822,15 @@ describe('__typeRefs backdoor, object syntax', () => {
18101822
expectType<number>(refs.child.$refs.foo)
18111823
})
18121824

1825+
describe('__typeEl backdoor', () => {
1826+
const Comp = defineComponent({
1827+
__typeEl: {} as HTMLAnchorElement,
1828+
})
1829+
const c = new Comp()
1830+
1831+
expectType<HTMLAnchorElement>(c.$el)
1832+
})
1833+
18131834
defineComponent({
18141835
props: {
18151836
foo: [String, null],
@@ -2047,3 +2068,13 @@ expectString(instance.actionText)
20472068
// public prop on $props should be optional
20482069
// @ts-expect-error
20492070
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: 62 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({
@@ -427,6 +444,51 @@ describe('defineModel', () => {
427444
defineModel<string>({ default: 123 })
428445
// @ts-expect-error unknown props option
429446
defineModel({ foo: 123 })
447+
448+
// unrelated getter and setter types
449+
{
450+
const modelVal = defineModel({
451+
get(_: string[]): string {
452+
return ''
453+
},
454+
set(_: number) {
455+
return 1
456+
},
457+
})
458+
expectType<string | undefined>(modelVal.value)
459+
modelVal.value = 1
460+
modelVal.value = undefined
461+
// @ts-expect-error
462+
modelVal.value = 'foo'
463+
464+
const [modelVal2] = modelVal
465+
expectType<string | undefined>(modelVal2.value)
466+
modelVal2.value = 1
467+
modelVal2.value = undefined
468+
// @ts-expect-error
469+
modelVal.value = 'foo'
470+
471+
const count = defineModel('count', {
472+
get(_: string[]): string {
473+
return ''
474+
},
475+
set(_: number) {
476+
return ''
477+
},
478+
})
479+
expectType<string | undefined>(count.value)
480+
count.value = 1
481+
count.value = undefined
482+
// @ts-expect-error
483+
count.value = 'foo'
484+
485+
const [count2] = count
486+
expectType<string | undefined>(count2.value)
487+
count2.value = 1
488+
count2.value = undefined
489+
// @ts-expect-error
490+
count2.value = 'foo'
491+
}
430492
})
431493

432494
describe('useModel', () => {

0 commit comments

Comments
 (0)