diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 8808b599e..aad4afa13 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,18 +1,17 @@ { $schema: 'https://docs.renovatebot.com/renovate-schema.json', - extends: ['config:base', 'schedule:weekly', 'group:allNonMajor'], + extends: ['config:recommended', 'schedule:weekly', 'group:allNonMajor'], labels: ['dependencies'], ignorePaths: ['**/__tests__/**'], rangeStrategy: 'bump', packageRules: [ { - depTypeList: ['peerDependencies'], + matchDepTypes: ['peerDependencies'], enabled: false, }, { groupName: 'test', - matchPackageNames: ['vitest', 'jsdom', 'puppeteer'], - matchPackagePrefixes: ['@vitest'], + matchPackageNames: ['vitest', 'jsdom', 'puppeteer', '@vitest{/,}**'], }, { groupName: 'playground', @@ -23,18 +22,28 @@ }, { groupName: 'compiler', - matchPackageNames: ['magic-string'], - matchPackagePrefixes: ['@babel', 'postcss'], + matchPackageNames: ['magic-string', '@babel{/,}**', 'postcss{/,}**'], }, { groupName: 'build', - matchPackageNames: ['vite', '@swc/core'], - matchPackagePrefixes: ['rollup', 'esbuild', '@rollup', '@vitejs'], + matchPackageNames: [ + 'vite', + '@swc/core', + 'rollup{/,}**', + 'esbuild{/,}**', + '@rollup{/,}**', + '@vitejs{/,}**', + ], }, { groupName: 'lint', - matchPackageNames: ['simple-git-hooks', 'lint-staged'], - matchPackagePrefixes: ['typescript-eslint', 'eslint', 'prettier'], + matchPackageNames: [ + 'simple-git-hooks', + 'lint-staged', + 'typescript-eslint{/,}**', + 'eslint{/,}**', + 'prettier{/,}**', + ], }, ], ignoreDeps: [ diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index d5c31beff..9816f7f52 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 @@ -31,4 +31,4 @@ jobs: - name: Run prettier run: pnpm run format - - uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c + - uses: autofix-ci/action@551dded8c6cc8a1054039c8bc0b8b48c51dfc6ef diff --git a/.github/workflows/canary-minor.yml b/.github/workflows/canary-minor.yml index b5d75b9ce..0b6401b8c 100644 --- a/.github/workflows/canary-minor.yml +++ b/.github/workflows/canary-minor.yml @@ -17,7 +17,7 @@ jobs: ref: minor - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index bb622725a..71c794c70 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/size-data.yml b/.github/workflows/size-data.yml index 7f8bf7b08..5a370b8b9 100644 --- a/.github/workflows/size-data.yml +++ b/.github/workflows/size-data.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/size-report.yml b/.github/workflows/size-report.yml index f9d2052b6..66b5ad0ef 100644 --- a/.github/workflows/size-report.yml +++ b/.github/workflows/size-report.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 @@ -37,7 +37,7 @@ jobs: run: pnpm install - name: Download Size Data - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v9 with: name: size-data run_id: ${{ github.event.workflow_run.id }} @@ -56,7 +56,7 @@ jobs: path: temp/size/base.txt - name: Download Previous Size Data - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v9 with: branch: ${{ steps.pr-base.outputs.content }} workflow: size-data.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70dc82248..1122eb355 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 @@ -63,7 +63,7 @@ jobs: key: chromium-${{ hashFiles('pnpm-lock.yaml') }} - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 @@ -88,7 +88,7 @@ jobs: - uses: actions/checkout@v4 - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 + uses: pnpm/action-setup@v4.1.0 - name: Install Node.js uses: actions/setup-node@v4 @@ -104,5 +104,8 @@ jobs: - name: Run prettier run: pnpm run format-check + - name: Run tsc + run: pnpm run check + - name: Run type declaration tests run: pnpm run test-dts diff --git a/.node-version b/.node-version index 209e3ef4b..7d41c735d 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20 +22.14.0 diff --git a/.vscode/settings.json b/.vscode/settings.json index 1dcc2819c..302428290 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,5 +13,6 @@ }, "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" - } + }, + "editor.formatOnSave": true } diff --git a/.well-known/funding-manifest-urls b/.well-known/funding-manifest-urls new file mode 100644 index 000000000..f26079d41 --- /dev/null +++ b/.well-known/funding-manifest-urls @@ -0,0 +1 @@ +https://vuejs.org/funding.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 930c8b590..2dbae4c79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,74 @@ +## [3.5.14](https://github.com/vuejs/core/compare/v3.5.13...v3.5.14) (2025-05-15) + + +### Bug Fixes + +* **compat:** correct deprecation message for v-bind.sync usage ([#13137](https://github.com/vuejs/core/issues/13137)) ([466b30f](https://github.com/vuejs/core/commit/466b30f4049ec89fb282624ec17d1a93472ab93f)), closes [#13133](https://github.com/vuejs/core/issues/13133) +* **compiler-core:** remove slot cache from parent renderCache during unmounting ([#13215](https://github.com/vuejs/core/issues/13215)) ([5d166f3](https://github.com/vuejs/core/commit/5d166f3796a03a497435fc079c6a83a4e9c6cf52)) +* **compiler-sfc:** fix scope handling for props destructure in function parameters and catch clauses ([8e34357](https://github.com/vuejs/core/commit/8e3435779a667de485cf9efd78667d0ca14c5f84)), closes [#12790](https://github.com/vuejs/core/issues/12790) +* **compiler-sfc:** treat the return value of `useTemplateRef` as a definite ref ([#13197](https://github.com/vuejs/core/issues/13197)) ([8ae1122](https://github.com/vuejs/core/commit/8ae11226e8ee938615e17c7b81dc38ae3f7cefb9)) +* **compiler:** fix spelling error in domTagConfig ([#13043](https://github.com/vuejs/core/issues/13043)) ([388295b](https://github.com/vuejs/core/commit/388295b27f3cc69eba25d325bbe60a36a3df831a)) +* **customFormatter:** properly accessing ref value during debugger ([#12948](https://github.com/vuejs/core/issues/12948)) ([fdbd026](https://github.com/vuejs/core/commit/fdbd02658301dd794fe0c84f0018d080a07fca9f)) +* **hmr/teleport:** adjust static children traversal for HMR in dev mode ([#12819](https://github.com/vuejs/core/issues/12819)) ([5e37dd0](https://github.com/vuejs/core/commit/5e37dd009562bcd8080a200c32abde2d6e4f0305)), closes [#12816](https://github.com/vuejs/core/issues/12816) +* **hmr:** avoid hydration for hmr root reload ([#12450](https://github.com/vuejs/core/issues/12450)) ([1f98a9c](https://github.com/vuejs/core/commit/1f98a9c493d01c21befa90107f0593bc92a58932)), closes [vitejs/vite-plugin-vue#146](https://github.com/vitejs/vite-plugin-vue/issues/146) [vitejs/vite-plugin-vue#477](https://github.com/vitejs/vite-plugin-vue/issues/477) +* **hmr:** avoid hydration for hmr updating ([#12262](https://github.com/vuejs/core/issues/12262)) ([9c4dbbc](https://github.com/vuejs/core/commit/9c4dbbc5185125835ad3e49baba303bd54676111)), closes [#7706](https://github.com/vuejs/core/issues/7706) [#8170](https://github.com/vuejs/core/issues/8170) +* **reactivity:** ensure markRaw objects are not reactive ([#12824](https://github.com/vuejs/core/issues/12824)) ([295b5ec](https://github.com/vuejs/core/commit/295b5ec19b6a52c4a56652cc4d6e93a4ea7c14ed)), closes [#12807](https://github.com/vuejs/core/issues/12807) +* **reactivity:** ensure multiple effectScope on() and off() calls maintains correct active scope ([22dcbf3](https://github.com/vuejs/core/commit/22dcbf3e20eb84f69c8952f6f70d9990136a4a68)), closes [#12631](https://github.com/vuejs/core/issues/12631) [#12632](https://github.com/vuejs/core/issues/12632) [#12641](https://github.com/vuejs/core/issues/12641) +* **reactivity:** should not recompute if computed does not track reactive data ([#12341](https://github.com/vuejs/core/issues/12341)) ([0b23fd2](https://github.com/vuejs/core/commit/0b23fd23833cf085e7e112bf4435cfc9b360d072)), closes [#12337](https://github.com/vuejs/core/issues/12337) +* **runtime-core:** stop tracking deps in setRef during unmount ([#13210](https://github.com/vuejs/core/issues/13210)) ([016c472](https://github.com/vuejs/core/commit/016c472bd2e7604b21c69dee1da8545ce26e4d2f)) +* **runtime-core:** update __vnode of static nodes when patching along the optimized path ([#13223](https://github.com/vuejs/core/issues/13223)) ([b3ecee3](https://github.com/vuejs/core/commit/b3ecee3da8ed5c55dea89ce6b4b376b2b722b018)) +* **runtime-core:** inherit comment nodes during block patch in production build ([#10748](https://github.com/vuejs/core/issues/10748)) ([6264505](https://github.com/vuejs/core/commit/626450590d81f79117b34d2a73073b1dc8f551bd)), closes [#10747](https://github.com/vuejs/core/issues/10747) [#12650](https://github.com/vuejs/core/issues/12650) +* **runtime-core:** prevent unmounted vnode from being inserted during transition leave ([#12862](https://github.com/vuejs/core/issues/12862)) ([d6a6ec1](https://github.com/vuejs/core/commit/d6a6ec13ce521683bfb2a22932778ef7b51f8600)), closes [#12860](https://github.com/vuejs/core/issues/12860) +* **runtime-core:** respect immutability for readonly reactive arrays in `v-for` ([#13091](https://github.com/vuejs/core/issues/13091)) ([3f27c58](https://github.com/vuejs/core/commit/3f27c58ffbd4309df369bc89493fdc284dc540bb)), closes [#13087](https://github.com/vuejs/core/issues/13087) +* **runtime-dom:** always treat autocorrect as attribute ([#13001](https://github.com/vuejs/core/issues/13001)) ([1499135](https://github.com/vuejs/core/commit/1499135c227236e037bb746beeb777941b0b58ff)), closes [#5705](https://github.com/vuejs/core/issues/5705) +* **slots:** properly warn if slot invoked in setup ([#12195](https://github.com/vuejs/core/issues/12195)) ([9196222](https://github.com/vuejs/core/commit/9196222ae1d63b52b35ac5fbf5e71494587ccf05)), closes [#12194](https://github.com/vuejs/core/issues/12194) +* **ssr:** properly init slots during ssr rendering ([#12441](https://github.com/vuejs/core/issues/12441)) ([2206cd2](https://github.com/vuejs/core/commit/2206cd235a1627c540e795e378b7564a55b47313)), closes [#12438](https://github.com/vuejs/core/issues/12438) +* **transition:** fix KeepAlive with transition out-in mode behavior in production ([#12468](https://github.com/vuejs/core/issues/12468)) ([343c891](https://github.com/vuejs/core/commit/343c89122448719bd6ed6bd9de986dfb2721d6bf)), closes [#12465](https://github.com/vuejs/core/issues/12465) +* **TransitionGroup:** reset prevChildren to prevent memory leak ([#13183](https://github.com/vuejs/core/issues/13183)) ([8b848cb](https://github.com/vuejs/core/commit/8b848cbbd2af337d23e19e202f9ab433f8580855)), closes [#13181](https://github.com/vuejs/core/issues/13181) +* **types:** allow return any for Options API lifecycle hooks ([#5914](https://github.com/vuejs/core/issues/5914)) ([06310e8](https://github.com/vuejs/core/commit/06310e82f5bed62d1b9733dcb18cd8d6edc988de)) +* **types:** the directive's modifiers should be optional ([#12605](https://github.com/vuejs/core/issues/12605)) ([10e54dc](https://github.com/vuejs/core/commit/10e54dcc86a7967f3196d96200bcbd1d3d42082f)) +* **typos:** fix comments referencing transformElement.ts ([#12551](https://github.com/vuejs/core/issues/12551))[ci-skip] ([11c053a](https://github.com/vuejs/core/commit/11c053a5429ad0d27a0e2c78b6b026ea00ace116)) + + +### Features + +* **types:** add type TemplateRef ([#12645](https://github.com/vuejs/core/issues/12645)) ([636a861](https://github.com/vuejs/core/commit/636a8619f06c71dfd79f7f6412fd130c4f84226f)) + + + +## [3.5.13](https://github.com/vuejs/core/compare/v3.5.12...v3.5.13) (2024-11-15) + + +### Bug Fixes + +* **compiler-core:** handle v-memo + v-for with functional key ([#12014](https://github.com/vuejs/core/issues/12014)) ([99009ee](https://github.com/vuejs/core/commit/99009eee0efc238392daba93792d478525b21afa)), closes [#12013](https://github.com/vuejs/core/issues/12013) +* **compiler-dom:** properly stringify template string style ([#12392](https://github.com/vuejs/core/issues/12392)) ([2d78539](https://github.com/vuejs/core/commit/2d78539da35322aea5f821b3cf9b02d006abac72)), closes [#12391](https://github.com/vuejs/core/issues/12391) +* **custom-element:** avoid triggering mutationObserver when relecting props ([352bc88](https://github.com/vuejs/core/commit/352bc88c1bd2fda09c61ab17ea1a5967ffcd7bc0)), closes [#12214](https://github.com/vuejs/core/issues/12214) [#12215](https://github.com/vuejs/core/issues/12215) +* **deps:** update dependency postcss to ^8.4.48 ([#12356](https://github.com/vuejs/core/issues/12356)) ([b5ff930](https://github.com/vuejs/core/commit/b5ff930089985a58c3553977ef999cec2a6708a4)) +* **hydration:** the component vnode's el should be updated when a mismatch occurs. ([#12255](https://github.com/vuejs/core/issues/12255)) ([a20a4cb](https://github.com/vuejs/core/commit/a20a4cb36a3e717d1f8f259d0d59f133f508ff0a)), closes [#12253](https://github.com/vuejs/core/issues/12253) +* **reactivity:** avoid unnecessary watcher effect removal from inactive scope ([2193284](https://github.com/vuejs/core/commit/21932840eae72ffcd357a62ec596aaecc7ec224a)), closes [#5783](https://github.com/vuejs/core/issues/5783) [#5806](https://github.com/vuejs/core/issues/5806) +* **reactivity:** release nested effects/scopes on effect scope stop ([#12373](https://github.com/vuejs/core/issues/12373)) ([bee2f5e](https://github.com/vuejs/core/commit/bee2f5ee62dc0cd04123b737779550726374dd0a)), closes [#12370](https://github.com/vuejs/core/issues/12370) +* **runtime-dom:** set css vars before user onMounted hooks ([2d5c5e2](https://github.com/vuejs/core/commit/2d5c5e25e9b7a56e883674fb434135ac514429b5)), closes [#11533](https://github.com/vuejs/core/issues/11533) +* **runtime-dom:** set css vars on update to handle child forcing reflow in onMount ([#11561](https://github.com/vuejs/core/issues/11561)) ([c4312f9](https://github.com/vuejs/core/commit/c4312f9c715c131a09e552ba46e9beb4b36d55e6)) +* **ssr:** avoid updating subtree of async component if it is resolved ([#12363](https://github.com/vuejs/core/issues/12363)) ([da7ad5e](https://github.com/vuejs/core/commit/da7ad5e3d24f3e108401188d909d27a4910da095)), closes [#12362](https://github.com/vuejs/core/issues/12362) +* **ssr:** ensure v-text updates correctly with custom directives in SSR output ([#12311](https://github.com/vuejs/core/issues/12311)) ([1f75d4e](https://github.com/vuejs/core/commit/1f75d4e6dfe18121ebe443cd3e8105d54f727893)), closes [#12309](https://github.com/vuejs/core/issues/12309) +* **ssr:** handle initial selected state for select with v-model + v-for option ([#12399](https://github.com/vuejs/core/issues/12399)) ([4f8d807](https://github.com/vuejs/core/commit/4f8d8078221ee52deed266677a227ad2a6d8dd22)), closes [#12395](https://github.com/vuejs/core/issues/12395) +* **teleport:** handle deferred teleport update before mounted ([#12168](https://github.com/vuejs/core/issues/12168)) ([8bff142](https://github.com/vuejs/core/commit/8bff142f99b646e9dd15897ec75368fbf34f1534)), closes [#12161](https://github.com/vuejs/core/issues/12161) +* **templateRef:** set ref on cached async component which wrapped in KeepAlive ([#12290](https://github.com/vuejs/core/issues/12290)) ([983eb50](https://github.com/vuejs/core/commit/983eb50a17eac76f1bba4394ad0316c62b72191d)), closes [#4999](https://github.com/vuejs/core/issues/4999) [#5004](https://github.com/vuejs/core/issues/5004) +* **test:** update snapshot ([#12169](https://github.com/vuejs/core/issues/12169)) ([828d4a4](https://github.com/vuejs/core/commit/828d4a443919fa2aa4e2e92fbd03a5f04b258eea)) +* **Transition:** fix transition memory leak edge case ([#12182](https://github.com/vuejs/core/issues/12182)) ([660132d](https://github.com/vuejs/core/commit/660132df6c6a8c14bf75e593dc47d2fdada30322)), closes [#12181](https://github.com/vuejs/core/issues/12181) +* **transition:** reflow before leave-active class after leave-from ([#12288](https://github.com/vuejs/core/issues/12288)) ([4b479db](https://github.com/vuejs/core/commit/4b479db61d233b054561402ae94ef08550073ea1)), closes [#2593](https://github.com/vuejs/core/issues/2593) +* **types:** defineEmits w/ interface declaration ([#12343](https://github.com/vuejs/core/issues/12343)) ([1022eab](https://github.com/vuejs/core/commit/1022eabaa1aaf8436876f5ec5573cb1e4b3959a6)), closes [#8457](https://github.com/vuejs/core/issues/8457) +* **v-once:** setting hasOnce to current block only when in v-once ([#12374](https://github.com/vuejs/core/issues/12374)) ([37300fc](https://github.com/vuejs/core/commit/37300fc26190a7299efddbf98800ffd96d5cad96)), closes [#12371](https://github.com/vuejs/core/issues/12371) + + +### Performance Improvements + +* **reactivity:** do not track inner key `__v_skip`` ([#11690](https://github.com/vuejs/core/issues/11690)) ([d637bd6](https://github.com/vuejs/core/commit/d637bd6c0164c2883e6eabd3c2f1f8c258dedfb1)) +* **runtime-core:** use feature flag for call to resolveMergedOptions ([#12163](https://github.com/vuejs/core/issues/12163)) ([1755ac0](https://github.com/vuejs/core/commit/1755ac0a108ba3486bd8397e56d3bdcd69196594)) + + + ## [3.5.12](https://github.com/vuejs/core/compare/v3.5.11...v3.5.12) (2024-10-11) diff --git a/README.md b/README.md index afe5711e8..6b4935abd 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Please make sure to respect issue requirements and use [the new issue helper](ht ## Stay In Touch -- [Twitter](https://twitter.com/vuejs) +- [X](https://x.com/vuejs) +- [Bluesky](https://bsky.app/profile/vuejs.org) - [Blog](https://blog.vuejs.org/) - [Job Board](https://vuejobs.com/?ref=vuejs) @@ -44,7 +45,9 @@ Please make sure to read the [Contributing Guide](https://github.com/vuejs/core/ Thank you to all the people who already contributed to Vue! - + + +_Note: Showing the first 500 contributors only due to GitHub image size limitations_ ## License diff --git a/changelogs/CHANGELOG-3.4.md b/changelogs/CHANGELOG-3.4.md index 6c97e4829..645dc7197 100644 --- a/changelogs/CHANGELOG-3.4.md +++ b/changelogs/CHANGELOG-3.4.md @@ -741,17 +741,6 @@ Note that this is a type-only breaking change in a minor release, which adheres -## [3.3.13](https://github.com/vuejs/core/compare/v3.3.12...v3.3.13) (2023-12-19) - - -### Bug Fixes - -* **compiler-core:** fix v-on with modifiers on inline expression of undefined ([#9866](https://github.com/vuejs/core/issues/9866)) ([bae79dd](https://github.com/vuejs/core/commit/bae79ddf8564a2da4a5365cfeb8d811990f42335)), closes [#9865](https://github.com/vuejs/core/issues/9865) -* **runtime-dom:** cache event handlers by key/modifiers ([#9851](https://github.com/vuejs/core/issues/9851)) ([04d2c05](https://github.com/vuejs/core/commit/04d2c05054c26b02fbc1d84839b0ed5cd36455b6)), closes [#9849](https://github.com/vuejs/core/issues/9849) -* **types:** extract properties from extended collections ([#9854](https://github.com/vuejs/core/issues/9854)) ([24b1c1d](https://github.com/vuejs/core/commit/24b1c1dd57fd55d998aa231a147500e010b10219)), closes [#9852](https://github.com/vuejs/core/issues/9852) - - - # [3.4.0-beta.3](https://github.com/vuejs/core/compare/v3.3.12...v3.4.0-beta.3) (2023-12-16) @@ -764,19 +753,6 @@ Note that this is a type-only breaking change in a minor release, which adheres -## [3.3.12](https://github.com/vuejs/core/compare/v3.3.11...v3.3.12) (2023-12-16) - -### Bug Fixes - -* **hydration:** handle appear transition before patch props ([#9837](https://github.com/vuejs/core/issues/9837)) ([e70f4c4](https://github.com/vuejs/core/commit/e70f4c47c553b6e16d8fad70743271ca23802fe7)), closes [#9832](https://github.com/vuejs/core/issues/9832) -* **sfc/cssVars:** fix loss of CSS v-bind variables when setting inline style with string value ([#9824](https://github.com/vuejs/core/issues/9824)) ([0a387df](https://github.com/vuejs/core/commit/0a387dfb1d04afb6eae4296b6da76dfdaca77af4)), closes [#9821](https://github.com/vuejs/core/issues/9821) -* **ssr:** fix suspense hydration of fallback content ([#7188](https://github.com/vuejs/core/issues/7188)) ([60415b5](https://github.com/vuejs/core/commit/60415b5d67df55f1fd6b176615299c08640fa142)) -* **types:** add `xmlns:xlink` to `SVGAttributes` ([#9300](https://github.com/vuejs/core/issues/9300)) ([0d61b42](https://github.com/vuejs/core/commit/0d61b429ecf63591d31e09702058fa4c7132e1a7)), closes [#9299](https://github.com/vuejs/core/issues/9299) -* **types:** fix `shallowRef` type error ([#9839](https://github.com/vuejs/core/issues/9839)) ([9a57158](https://github.com/vuejs/core/commit/9a571582b53220270e498d8712ea59312c0bef3a)) -* **types:** support for generic keyof slots ([#8374](https://github.com/vuejs/core/issues/8374)) ([213eba4](https://github.com/vuejs/core/commit/213eba479ce080efc1053fe636f6be4a4c889b44)) - - - # [3.4.0-beta.2](https://github.com/vuejs/core/compare/v3.4.0-beta.1...v3.4.0-beta.2) (2023-12-14) @@ -836,22 +812,6 @@ default. -## [3.3.11](https://github.com/vuejs/core/compare/v3.3.10...v3.3.11) (2023-12-08) - - -### Bug Fixes - -* **custom-element:** correctly handle number type props in prod ([#8989](https://github.com/vuejs/core/issues/8989)) ([d74d364](https://github.com/vuejs/core/commit/d74d364d62db8e48881af6b5a75ce4fb5f36cc35)) -* **reactivity:** fix mutation on user proxy of reactive Array ([6ecbd5c](https://github.com/vuejs/core/commit/6ecbd5ce2a7f59314a8326a1d193874b87f4d8c8)), closes [#9742](https://github.com/vuejs/core/issues/9742) [#9751](https://github.com/vuejs/core/issues/9751) [#9750](https://github.com/vuejs/core/issues/9750) -* **runtime-dom:** fix width and height prop check condition ([5b00286](https://github.com/vuejs/core/commit/5b002869c533220706f9788b496b8ca8d8e98609)), closes [#9762](https://github.com/vuejs/core/issues/9762) -* **shared:** handle Map with symbol keys in toDisplayString ([#9731](https://github.com/vuejs/core/issues/9731)) ([364821d](https://github.com/vuejs/core/commit/364821d6bdb1775e2f55a69bcfb9f40f7acf1506)), closes [#9727](https://github.com/vuejs/core/issues/9727) -* **shared:** handle more Symbol cases in toDisplayString ([983d45d](https://github.com/vuejs/core/commit/983d45d4f8eb766b5a16b7ea93b86d3c51618fa6)) -* **Suspense:** properly get anchor when mount fallback vnode ([#9770](https://github.com/vuejs/core/issues/9770)) ([b700328](https://github.com/vuejs/core/commit/b700328342e17dc16b19316c2e134a26107139d2)), closes [#9769](https://github.com/vuejs/core/issues/9769) -* **types:** ref() return type should not be any when initial value is any ([#9768](https://github.com/vuejs/core/issues/9768)) ([cdac121](https://github.com/vuejs/core/commit/cdac12161ec27b45ded48854c3d749664b6d4a6d)) -* **watch:** should not fire pre watcher on child component unmount ([#7181](https://github.com/vuejs/core/issues/7181)) ([6784f0b](https://github.com/vuejs/core/commit/6784f0b1f8501746ea70d87d18ed63a62cf6b76d)), closes [#7030](https://github.com/vuejs/core/issues/7030) - - - # [3.4.0-alpha.4](https://github.com/vuejs/core/compare/v3.3.10...v3.4.0-alpha.4) (2023-12-04) @@ -873,37 +833,6 @@ default. -## [3.3.10](https://github.com/vuejs/core/compare/v3.3.9...v3.3.10) (2023-12-04) - - -### Bug Fixes - -* **app:** prevent template from being cached between apps with different options ([#9724](https://github.com/vuejs/core/issues/9724)) ([ec71585](https://github.com/vuejs/core/commit/ec715854ca12520b2afc9e9b3981cbae05ae5206)), closes [#9618](https://github.com/vuejs/core/issues/9618) -* **compiler-sfc:** avoid passing forEach index to genMap ([f12db7f](https://github.com/vuejs/core/commit/f12db7fb564a534cef2e5805cc9f54afe5d72fbf)) -* **compiler-sfc:** deindent pug/jade templates ([6345197](https://github.com/vuejs/core/commit/634519720a21fb5a6871454e1cadad7053a568b8)), closes [#3231](https://github.com/vuejs/core/issues/3231) [#3842](https://github.com/vuejs/core/issues/3842) [#7723](https://github.com/vuejs/core/issues/7723) -* **compiler-sfc:** fix :where and :is selector in scoped mode with multiple selectors ([#9735](https://github.com/vuejs/core/issues/9735)) ([c3e2c55](https://github.com/vuejs/core/commit/c3e2c556b532656b50b8ab5cd2d9eabc26622d63)), closes [#9707](https://github.com/vuejs/core/issues/9707) -* **compiler-sfc:** generate more treeshaking friendly code ([#9507](https://github.com/vuejs/core/issues/9507)) ([8d74ca0](https://github.com/vuejs/core/commit/8d74ca0e6fa2738ca6854b7e879ff59419f948c7)), closes [#9500](https://github.com/vuejs/core/issues/9500) -* **compiler-sfc:** support inferring generic types ([#8511](https://github.com/vuejs/core/issues/8511)) ([eb5e307](https://github.com/vuejs/core/commit/eb5e307c0be62002e62c4c800d0dfacb39b0d4ca)), closes [#8482](https://github.com/vuejs/core/issues/8482) -* **compiler-sfc:** support resolving components from props ([#8785](https://github.com/vuejs/core/issues/8785)) ([7cbcee3](https://github.com/vuejs/core/commit/7cbcee3d831241a8bd3588ae92d3f27e3641e25f)) -* **compiler-sfc:** throw error when failing to load TS during type resolution ([#8883](https://github.com/vuejs/core/issues/8883)) ([4936d2e](https://github.com/vuejs/core/commit/4936d2e11a8d0ca3704bfe408548cb26bb3fd5e9)) -* **cssVars:** cssVar names should be double-escaped when generating code for ssr ([#8824](https://github.com/vuejs/core/issues/8824)) ([5199a12](https://github.com/vuejs/core/commit/5199a12f8855cd06f24bf355708b5a2134f63176)), closes [#7823](https://github.com/vuejs/core/issues/7823) -* **deps:** update compiler to ^7.23.4 ([#9681](https://github.com/vuejs/core/issues/9681)) ([31f6ebc](https://github.com/vuejs/core/commit/31f6ebc4df84490ed29fb75e7bf4259200eb51f0)) -* **runtime-core:** Suspense get anchor properly in Transition ([#9309](https://github.com/vuejs/core/issues/9309)) ([65f3fe2](https://github.com/vuejs/core/commit/65f3fe273127a8b68e1222fbb306d28d85f01757)), closes [#8105](https://github.com/vuejs/core/issues/8105) -* **runtime-dom:** set width/height with units as attribute ([#8781](https://github.com/vuejs/core/issues/8781)) ([bfc1838](https://github.com/vuejs/core/commit/bfc1838f31199de3f189198a3c234fa7bae91386)) -* **ssr:** avoid computed being accidentally cached before server render ([#9688](https://github.com/vuejs/core/issues/9688)) ([30d5d93](https://github.com/vuejs/core/commit/30d5d93a92b2154406ec04f8aca6b217fa01177c)), closes [#5300](https://github.com/vuejs/core/issues/5300) -* **types:** expose emits as props in functional components ([#9234](https://github.com/vuejs/core/issues/9234)) ([887e54c](https://github.com/vuejs/core/commit/887e54c347ea9eac4c721b5e2288f054873d1d30)) -* **types:** fix reactive collection types ([#8960](https://github.com/vuejs/core/issues/8960)) ([ad27473](https://github.com/vuejs/core/commit/ad274737015c36906d76f3189203093fa3a2e4e7)), closes [#8904](https://github.com/vuejs/core/issues/8904) -* **types:** improve return type withKeys and withModifiers ([#9734](https://github.com/vuejs/core/issues/9734)) ([43c3cfd](https://github.com/vuejs/core/commit/43c3cfdec5ae5d70fa2a21e857abc2d73f1a0d07)) - - -### Performance Improvements - -* optimize on* prop check ([38aaa8c](https://github.com/vuejs/core/commit/38aaa8c88648c54fe2616ad9c0961288092fcb44)) -* **runtime-dom:** cache modifier wrapper functions ([da4a4fb](https://github.com/vuejs/core/commit/da4a4fb5e8eee3c6d31f24ebd79a9d0feca56cb2)), closes [#8882](https://github.com/vuejs/core/issues/8882) -* **v-on:** constant handlers with modifiers should not be treated as dynamic ([4d94ebf](https://github.com/vuejs/core/commit/4d94ebfe75174b340d2b794e699cad1add3600a9)) - - - # [3.4.0-alpha.3](https://github.com/vuejs/core/compare/v3.4.0-alpha.2...v3.4.0-alpha.3) (2023-11-28) @@ -960,55 +889,6 @@ default. -## [3.3.9](https://github.com/vuejs/core/compare/v3.3.8...v3.3.9) (2023-11-25) - - -### Bug Fixes - -* **compiler-core:** avoid rewriting scope variables in inline for loops ([#7245](https://github.com/vuejs/core/issues/7245)) ([a2d810e](https://github.com/vuejs/core/commit/a2d810eb40cef631f61991ca68b426ee9546aba0)), closes [#7238](https://github.com/vuejs/core/issues/7238) -* **compiler-core:** fix `resolveParserPlugins` decorators check ([#9566](https://github.com/vuejs/core/issues/9566)) ([9d0eba9](https://github.com/vuejs/core/commit/9d0eba916f3bf6fb5c03222400edae1a2db7444f)), closes [#9560](https://github.com/vuejs/core/issues/9560) -* **compiler-sfc:** consistently escape type-only prop names ([#8654](https://github.com/vuejs/core/issues/8654)) ([3e08d24](https://github.com/vuejs/core/commit/3e08d246dfd8523c54fb8e7a4a6fd5506ffb1bcc)), closes [#8635](https://github.com/vuejs/core/issues/8635) [#8910](https://github.com/vuejs/core/issues/8910) [vitejs/vite-plugin-vue#184](https://github.com/vitejs/vite-plugin-vue/issues/184) -* **compiler-sfc:** malformed filename on windows using path.posix.join() ([#9478](https://github.com/vuejs/core/issues/9478)) ([f18a174](https://github.com/vuejs/core/commit/f18a174979626b3429db93c5d5b7ae5448917c70)), closes [#8671](https://github.com/vuejs/core/issues/8671) [#9583](https://github.com/vuejs/core/issues/9583) [#9446](https://github.com/vuejs/core/issues/9446) [#9473](https://github.com/vuejs/core/issues/9473) -* **compiler-sfc:** support `:is` and `:where` selector in scoped css rewrite ([#8929](https://github.com/vuejs/core/issues/8929)) ([3227e50](https://github.com/vuejs/core/commit/3227e50b32105f8893f7dff2f29278c5b3a9f621)) -* **compiler-sfc:** support resolve extends interface for defineEmits ([#8470](https://github.com/vuejs/core/issues/8470)) ([9e1b74b](https://github.com/vuejs/core/commit/9e1b74bcd5fa4151f5d1bc02c69fbbfa4762f577)), closes [#8465](https://github.com/vuejs/core/issues/8465) -* **hmr/transition:** fix kept-alive component inside transition disappearing after hmr ([#7126](https://github.com/vuejs/core/issues/7126)) ([d11e978](https://github.com/vuejs/core/commit/d11e978fc98dcc83526c167e603b8308f317f786)), closes [#7121](https://github.com/vuejs/core/issues/7121) -* **hydration:** force hydration for v-bind with .prop modifier ([364f319](https://github.com/vuejs/core/commit/364f319d214226770d97c98d8fcada80c9e8dde3)), closes [#7490](https://github.com/vuejs/core/issues/7490) -* **hydration:** properly hydrate indeterminate prop ([34b5a5d](https://github.com/vuejs/core/commit/34b5a5da4ae9c9faccac237acd7acc8e7e017571)), closes [#7476](https://github.com/vuejs/core/issues/7476) -* **reactivity:** clear method on readonly collections should return undefined ([#7316](https://github.com/vuejs/core/issues/7316)) ([657476d](https://github.com/vuejs/core/commit/657476dcdb964be4fbb1277c215c073f3275728e)) -* **reactivity:** onCleanup also needs to be cleaned ([#8655](https://github.com/vuejs/core/issues/8655)) ([73fd810](https://github.com/vuejs/core/commit/73fd810eebdd383a2b4629f67736c4db1f428abd)), closes [#5151](https://github.com/vuejs/core/issues/5151) [#7695](https://github.com/vuejs/core/issues/7695) -* **ssr:** hydration `__vnode` missing for devtools ([#9328](https://github.com/vuejs/core/issues/9328)) ([5156ac5](https://github.com/vuejs/core/commit/5156ac5b38cfa80d3db26f2c9bf40cb22a7521cb)) -* **types:** allow falsy value types in `StyleValue` ([#7954](https://github.com/vuejs/core/issues/7954)) ([17aa92b](https://github.com/vuejs/core/commit/17aa92b79b31d8bb8b5873ddc599420cb9806db8)), closes [#7955](https://github.com/vuejs/core/issues/7955) -* **types:** defineCustomElement using defineComponent return type with emits ([#7937](https://github.com/vuejs/core/issues/7937)) ([5d932a8](https://github.com/vuejs/core/commit/5d932a8e6d14343c9d7fc7c2ecb58ac618b2f938)), closes [#7782](https://github.com/vuejs/core/issues/7782) -* **types:** fix `unref` and `toValue` when input union type contains ComputedRef ([#8748](https://github.com/vuejs/core/issues/8748)) ([176d476](https://github.com/vuejs/core/commit/176d47671271b1abc21b1508e9a493c7efca6451)), closes [#8747](https://github.com/vuejs/core/issues/8747) [#8857](https://github.com/vuejs/core/issues/8857) -* **types:** fix instance type when props type is incompatible with setup returned type ([#7338](https://github.com/vuejs/core/issues/7338)) ([0e1e8f9](https://github.com/vuejs/core/commit/0e1e8f919e5a74cdaadf9c80ee135088b25e7fa3)), closes [#5885](https://github.com/vuejs/core/issues/5885) -* **types:** fix shallowRef return type with union value type ([#7853](https://github.com/vuejs/core/issues/7853)) ([7c44800](https://github.com/vuejs/core/commit/7c448000b0def910c2cfabfdf7ff20a3d6bc844f)), closes [#7852](https://github.com/vuejs/core/issues/7852) -* **types:** more precise types for class bindings ([#8012](https://github.com/vuejs/core/issues/8012)) ([46e3374](https://github.com/vuejs/core/commit/46e33744c890bd49482c5e5c5cdea44e00ec84d5)) -* **types:** remove optional properties from defineProps return type ([#6421](https://github.com/vuejs/core/issues/6421)) ([94c049d](https://github.com/vuejs/core/commit/94c049d930d922069e38ea8700d7ff0970f71e61)), closes [#6420](https://github.com/vuejs/core/issues/6420) -* **types:** return type of withDefaults should be readonly ([#8601](https://github.com/vuejs/core/issues/8601)) ([f15debc](https://github.com/vuejs/core/commit/f15debc01acb22d23f5acee97e6f02db88cef11a)) -* **types:** revert class type restrictions ([5d077c8](https://github.com/vuejs/core/commit/5d077c8754cc14f85d2d6d386df70cf8c0d93842)), closes [#8012](https://github.com/vuejs/core/issues/8012) -* **types:** update jsx type definitions ([#8607](https://github.com/vuejs/core/issues/8607)) ([58e2a94](https://github.com/vuejs/core/commit/58e2a94871ae06a909c5f8bad07fb401193e6a38)) -* **types:** widen ClassValue type ([2424013](https://github.com/vuejs/core/commit/242401305944422d0c361b16101a4d18908927af)) -* **v-model:** avoid overwriting number input with same value ([#7004](https://github.com/vuejs/core/issues/7004)) ([40f4b77](https://github.com/vuejs/core/commit/40f4b77bb570868cb6e47791078767797e465989)), closes [#7003](https://github.com/vuejs/core/issues/7003) -* **v-model:** unnecessary value binding error should apply to dynamic instead of static binding ([2859b65](https://github.com/vuejs/core/commit/2859b653c9a22460e60233cac10fe139e359b046)), closes [#3596](https://github.com/vuejs/core/issues/3596) - - - -## [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 error 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) diff --git a/netlify.toml b/netlify.toml index 277cc55a7..b7304df16 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,3 +1,3 @@ [build.environment] - NODE_VERSION = "18" + NODE_VERSION = "22" NPM_FLAGS = "--version" # prevent Netlify npm install diff --git a/package.json b/package.json index 347075ae5..2bd85346c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, - "version": "3.5.12", - "packageManager": "pnpm@9.12.2", + "version": "3.5.14", + "packageManager": "pnpm@10.11.0", "type": "module", "scripts": { "dev": "node scripts/dev.js", @@ -22,7 +22,10 @@ "test-dts": "run-s build-dts test-dts-only", "test-dts-only": "tsc -p packages-private/dts-built-test/tsconfig.json && tsc -p ./packages-private/dts-test/tsconfig.test.json", "test-coverage": "vitest run --project unit --coverage", - "test-bench": "vitest bench", + "prebench": "node scripts/build.js -pf esm-browser reactivity", + "prebench-compare": "node scripts/build.js -pf esm-browser reactivity", + "bench": "vitest bench --project=unit --outputJson=temp/bench.json", + "bench-compare": "vitest bench --project=unit --compare=temp/bench.json", "release": "node scripts/release.js", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", "dev-esm": "node scripts/dev.js -if esm-bundler-runtime", @@ -62,62 +65,51 @@ "@babel/parser": "catalog:", "@babel/types": "catalog:", "@rollup/plugin-alias": "^5.1.1", - "@rollup/plugin-commonjs": "^28.0.1", + "@rollup/plugin-commonjs": "^28.0.3", "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.3.0", + "@rollup/plugin-node-resolve": "^16.0.1", "@rollup/plugin-replace": "5.0.4", - "@swc/core": "^1.7.36", + "@swc/core": "^1.11.24", "@types/hash-sum": "^1.0.2", - "@types/node": "^20.16.13", - "@types/semver": "^7.5.8", + "@types/node": "^22.15.21", + "@types/semver": "^7.7.0", "@types/serve-handler": "^6.1.4", - "@vitest/coverage-v8": "^2.1.1", + "@vitest/coverage-v8": "^3.1.4", + "@vitest/eslint-plugin": "^1.2.0", "@vue/consolidate": "1.0.0", "conventional-changelog-cli": "^5.0.0", "enquirer": "^2.4.1", - "esbuild": "^0.24.0", + "esbuild": "^0.25.4", "esbuild-plugin-polyfill-node": "^0.3.0", - "eslint": "^9.13.0", - "eslint-plugin-import-x": "^4.3.1", - "@vitest/eslint-plugin": "^1.0.1", + "eslint": "^9.27.0", + "eslint-plugin-import-x": "^4.12.2", "estree-walker": "catalog:", - "jsdom": "^25.0.0", - "lint-staged": "^15.2.10", + "jsdom": "^26.1.0", + "lint-staged": "^15.5.2", "lodash": "^4.17.21", - "magic-string": "^0.30.12", - "markdown-table": "^3.0.3", + "magic-string": "^0.30.17", + "markdown-table": "^3.0.4", "marked": "13.0.3", - "npm-run-all2": "^6.2.6", + "npm-run-all2": "^7.0.2", "picocolors": "^1.1.1", - "prettier": "^3.3.3", + "prettier": "^3.5.3", "pretty-bytes": "^6.1.1", "pug": "^3.0.3", - "puppeteer": "~23.3.0", + "puppeteer": "~24.9.0", "rimraf": "^6.0.1", - "rollup": "^4.24.0", - "rollup-plugin-dts": "^6.1.1", - "rollup-plugin-esbuild": "^6.1.1", + "rollup": "^4.41.0", + "rollup-plugin-dts": "^6.2.1", + "rollup-plugin-esbuild": "^6.2.1", "rollup-plugin-polyfill-node": "^0.13.0", - "semver": "^7.6.3", + "semver": "^7.7.2", "serve": "^14.2.4", "serve-handler": "^6.1.6", - "simple-git-hooks": "^2.11.1", + "simple-git-hooks": "^2.13.0", "todomvc-app-css": "^2.4.3", - "tslib": "^2.8.0", + "tslib": "^2.8.1", "typescript": "~5.6.2", - "typescript-eslint": "^8.10.0", + "typescript-eslint": "^8.32.1", "vite": "catalog:", - "vitest": "^2.1.1" - }, - "pnpm": { - "peerDependencyRules": { - "allowedVersions": { - "typescript-eslint>eslint": "^9.0.0", - "@typescript-eslint/eslint-plugin>eslint": "^9.0.0", - "@typescript-eslint/parser>eslint": "^9.0.0", - "@typescript-eslint/type-utils>eslint": "^9.0.0", - "@typescript-eslint/utils>eslint": "^9.0.0" - } - } + "vitest": "^3.1.4" } } diff --git a/packages-private/dts-test/appDirective.test-d.ts b/packages-private/dts-test/appDirective.test-d.ts index fb655a039..59101c22e 100644 --- a/packages-private/dts-test/appDirective.test-d.ts +++ b/packages-private/dts-test/appDirective.test-d.ts @@ -9,7 +9,7 @@ app.directive( mounted(el, binding) { expectType(el) expectType(binding.value) - expectType<{ prevent: boolean; stop: boolean }>(binding.modifiers) + expectType<{ prevent?: boolean; stop?: boolean }>(binding.modifiers) expectType<'arg1' | 'arg2'>(binding.arg!) // @ts-expect-error not any diff --git a/packages-private/dts-test/appUse.test-d.ts b/packages-private/dts-test/appUse.test-d.ts index 065f69568..21d702c9c 100644 --- a/packages-private/dts-test/appUse.test-d.ts +++ b/packages-private/dts-test/appUse.test-d.ts @@ -12,8 +12,11 @@ app.use(PluginWithoutType, 2) app.use(PluginWithoutType, { anything: 'goes' }, true) type PluginOptions = { + /** option1 */ option1?: string + /** option2 */ option2: number + /** option3 */ option3: boolean } @@ -25,6 +28,20 @@ const PluginWithObjectOptions = { }, } +const objectPluginOptional = { + install(app: App, options?: PluginOptions) {}, +} +app.use(objectPluginOptional) +app.use( + objectPluginOptional, + // Test JSDoc and `go to definition` for options + { + option1: 'foo', + option2: 1, + option3: true, + }, +) + for (const Plugin of [ PluginWithObjectOptions, PluginWithObjectOptions.install, @@ -92,7 +109,27 @@ const PluginTyped: Plugin = (app, options) => {} // @ts-expect-error: needs options app.use(PluginTyped) -app.use(PluginTyped, { option2: 2, option3: true }) +app.use( + PluginTyped, + // Test autocomplete for options + { + option1: '', + option2: 2, + option3: true, + }, +) + +const functionPluginOptional = (app: App, options?: PluginOptions) => {} +app.use(functionPluginOptional) +app.use(functionPluginOptional, { option2: 2, option3: true }) + +// type optional params +const functionPluginOptional2: Plugin<[options?: PluginOptions]> = ( + app, + options, +) => {} +app.use(functionPluginOptional2) +app.use(functionPluginOptional2, { option2: 2, option3: true }) // vuetify usage const key: string = '' diff --git a/packages-private/dts-test/componentInstance.test-d.tsx b/packages-private/dts-test/componentInstance.test-d.tsx index a804bb10d..c6911d3a8 100644 --- a/packages-private/dts-test/componentInstance.test-d.tsx +++ b/packages-private/dts-test/componentInstance.test-d.tsx @@ -137,3 +137,18 @@ describe('Generic component', () => { expectType(comp.msg) expectType>(comp.list) }) + +// #12751 +{ + const Comp = defineComponent({ + __typeEmits: {} as { + 'update:visible': [value?: boolean] + }, + }) + const comp: ComponentInstance = {} as any + + expectType<((value?: boolean) => any) | undefined>(comp['onUpdate:visible']) + expectType<{ 'onUpdate:visible'?: (value?: boolean) => any }>(comp['$props']) + // @ts-expect-error + comp['$props']['$props'] +} diff --git a/packages-private/dts-test/defineComponent.test-d.tsx b/packages-private/dts-test/defineComponent.test-d.tsx index fda3ca485..1967668dc 100644 --- a/packages-private/dts-test/defineComponent.test-d.tsx +++ b/packages-private/dts-test/defineComponent.test-d.tsx @@ -20,6 +20,9 @@ import { type IsAny, type IsUnion, describe, expectType } from './utils' describe('with object props', () => { interface ExpectedProps { a?: number | undefined + aa: number + aaa: number | null + aaaa: number | undefined b: string e?: Function h: boolean @@ -53,6 +56,19 @@ describe('with object props', () => { const props = { a: Number, + aa: { + type: Number as PropType, + default: 1, + }, + aaa: { + type: Number as PropType, + default: 1, + }, + aaaa: { + type: Number as PropType, + // `as const` prevents widening to `boolean` (keeps literal `true` type) + required: true as const, + }, // required should make property non-void b: { type: String, @@ -146,6 +162,13 @@ describe('with object props', () => { setup(props) { // type assertion. See https://github.com/SamVerschueren/tsd expectType(props.a) + expectType(props.aa) + expectType(props.aaa) + + // @ts-expect-error should included `undefined` + expectType(props.aaaa) + expectType(props.aaaa) + expectType(props.b) expectType(props.e) expectType(props.h) @@ -198,6 +221,8 @@ describe('with object props', () => { render() { const props = this.$props expectType(props.a) + expectType(props.aa) + expectType(props.aaa) expectType(props.b) expectType(props.e) expectType(props.h) @@ -225,6 +250,8 @@ describe('with object props', () => { // should also expose declared props on `this` expectType(this.a) + expectType(this.aa) + expectType(this.aaa) expectType(this.b) expectType(this.e) expectType(this.h) @@ -269,6 +296,7 @@ describe('with object props', () => { expectType( {}} @@ -295,6 +323,7 @@ describe('with object props', () => { expectType( { value: number oldValue: number | null arg?: 'Arg' - modifiers: Record<'a' | 'b', boolean> + modifiers: Partial> }>(testDirective()) expectType<{ diff --git a/packages-private/dts-test/ref.test-d.ts b/packages-private/dts-test/ref.test-d.ts index 89b80a70f..cf99b7bca 100644 --- a/packages-private/dts-test/ref.test-d.ts +++ b/packages-private/dts-test/ref.test-d.ts @@ -4,6 +4,7 @@ import { type MaybeRefOrGetter, type Ref, type ShallowRef, + type TemplateRef, type ToRefs, type WritableComputedRef, computed, @@ -535,7 +536,7 @@ expectType(toValue(unref2)) // useTemplateRef const tRef = useTemplateRef('foo') -expectType>>(tRef) +expectType(tRef) const tRef2 = useTemplateRef('bar') -expectType>>(tRef2) +expectType>(tRef2) diff --git a/packages-private/dts-test/setupHelpers.test-d.ts b/packages-private/dts-test/setupHelpers.test-d.ts index 7b5d6f147..656f1da79 100644 --- a/packages-private/dts-test/setupHelpers.test-d.ts +++ b/packages-private/dts-test/setupHelpers.test-d.ts @@ -306,6 +306,14 @@ describe('defineEmits w/ type declaration', () => { emit2('baz') }) +describe('defineEmits w/ interface declaration', () => { + interface Emits { + foo: [value: string] + } + const emit = defineEmits() + emit('foo', 'hi') +}) + describe('defineEmits w/ alt type declaration', () => { const emit = defineEmits<{ foo: [id: string] diff --git a/packages-private/sfc-playground/package.json b/packages-private/sfc-playground/package.json index 51175417d..418b43d22 100644 --- a/packages-private/sfc-playground/package.json +++ b/packages-private/sfc-playground/package.json @@ -13,7 +13,7 @@ "vite": "catalog:" }, "dependencies": { - "@vue/repl": "^4.4.2", + "@vue/repl": "^4.5.1", "file-saver": "^2.0.5", "jszip": "^3.10.1", "vue": "workspace:*" diff --git a/packages-private/sfc-playground/src/App.vue b/packages-private/sfc-playground/src/App.vue index d163b1a3e..740d77026 100644 --- a/packages-private/sfc-playground/src/App.vue +++ b/packages-private/sfc-playground/src/App.vue @@ -165,8 +165,9 @@ onMounted(() => { body { font-size: 13px; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, - Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, + Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; margin: 0; --base: #444; --nav-height: 50px; diff --git a/packages-private/sfc-playground/src/Header.vue b/packages-private/sfc-playground/src/Header.vue index aea6c022a..bf1c9bad6 100644 --- a/packages-private/sfc-playground/src/Header.vue +++ b/packages-private/sfc-playground/src/Header.vue @@ -46,6 +46,7 @@ function resetVueVersion() { async function copyLink(e: MouseEvent) { if (e.metaKey) { + resetVueVersion() // hidden logic for going to local debug from play.vuejs.org window.location.href = 'http://localhost:5173/' + window.location.hash return diff --git a/packages-private/sfc-playground/src/download/download.ts b/packages-private/sfc-playground/src/download/download.ts index 28d836edb..6b051abae 100644 --- a/packages-private/sfc-playground/src/download/download.ts +++ b/packages-private/sfc-playground/src/download/download.ts @@ -17,7 +17,10 @@ export async function downloadProject(store: ReplStore) { // basic structure zip.file('index.html', index) - zip.file('package.json', pkg) + zip.file( + 'package.json', + pkg.replace(`"vue": "latest"`, `"vue": "${store.vueVersion || 'latest'}"`), + ) zip.file('vite.config.js', config) zip.file('README.md', readme) diff --git a/packages-private/sfc-playground/src/download/template/package.json b/packages-private/sfc-playground/src/download/template/package.json index 1e8c5d68c..b9bb278ed 100644 --- a/packages-private/sfc-playground/src/download/template/package.json +++ b/packages-private/sfc-playground/src/download/template/package.json @@ -8,10 +8,10 @@ "serve": "vite preview" }, "dependencies": { - "vue": "^3.4.0" + "vue": "latest" }, "devDependencies": { - "@vitejs/plugin-vue": "^5.1.4", - "vite": "^5.4.9" + "@vitejs/plugin-vue": "^5.2.4", + "vite": "^6.3.5" } } diff --git a/packages-private/template-explorer/package.json b/packages-private/template-explorer/package.json index e8bdf0bcc..08da34b17 100644 --- a/packages-private/template-explorer/package.json +++ b/packages-private/template-explorer/package.json @@ -11,7 +11,7 @@ "enableNonBrowserBranches": true }, "dependencies": { - "monaco-editor": "^0.52.0", + "monaco-editor": "^0.52.2", "source-map-js": "^1.2.1" } } diff --git a/packages-private/template-explorer/style.css b/packages-private/template-explorer/style.css index 93f6f623c..eed9e18a0 100644 --- a/packages-private/template-explorer/style.css +++ b/packages-private/template-explorer/style.css @@ -1,8 +1,9 @@ body { margin: 0; overflow: hidden; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, - Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + font-family: + -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, + Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; --bg: #1d1f21; --border: #333; } diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/vMemo.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/vMemo.spec.ts.snap index 220bc1774..86e0b3d2f 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/vMemo.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/vMemo.spec.ts.snap @@ -1,5 +1,23 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`compiler: v-memo transform > element v-for key expression prefixing + v-memo 1`] = ` +"import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, isMemoSame as _isMemoSame, withMemo as _withMemo } from "vue" + +export function render(_ctx, _cache) { + return (_openBlock(), _createElementBlock("div", null, [ + (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.tableData, (data, __, ___, _cached) => { + const _memo = (_ctx.getLetter(data)) + if (_cached && _cached.key === _ctx.getId(data) && _isMemoSame(_cached, _memo)) return _cached + const _item = (_openBlock(), _createElementBlock("span", { + key: _ctx.getId(data) + })) + _item.memo = _memo + return _item + }, _cache, 0), 128 /* KEYED_FRAGMENT */)) + ])) +}" +`; + exports[`compiler: v-memo transform > on component 1`] = ` "import { resolveComponent as _resolveComponent, createVNode as _createVNode, withMemo as _withMemo, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue" diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap index 3d13c4066..6660865a5 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap @@ -8,7 +8,7 @@ return function render(_ctx, _cache) { const { setBlockTracking: _setBlockTracking, createElementVNode: _createElementVNode } = _Vue return _cache[0] || ( - _setBlockTracking(-1), + _setBlockTracking(-1, true), (_cache[0] = _createElementVNode("div", { id: foo }, null, 8 /* PROPS */, ["id"])).cacheIndex = 0, _setBlockTracking(1), _cache[0] @@ -28,7 +28,7 @@ return function render(_ctx, _cache) { return (_openBlock(), _createElementBlock("div", null, [ _cache[0] || ( - _setBlockTracking(-1), + _setBlockTracking(-1, true), (_cache[0] = _createVNode(_component_Comp, { id: foo }, null, 8 /* PROPS */, ["id"])).cacheIndex = 0, _setBlockTracking(1), _cache[0] @@ -47,7 +47,7 @@ return function render(_ctx, _cache) { return (_openBlock(), _createElementBlock("div", null, [ _cache[0] || ( - _setBlockTracking(-1), + _setBlockTracking(-1, true), (_cache[0] = _createElementVNode("div", { id: foo }, null, 8 /* PROPS */, ["id"])).cacheIndex = 0, _setBlockTracking(1), _cache[0] @@ -66,7 +66,7 @@ return function render(_ctx, _cache) { return (_openBlock(), _createElementBlock("div", null, [ _cache[0] || ( - _setBlockTracking(-1), + _setBlockTracking(-1, true), (_cache[0] = _renderSlot($slots, "default")).cacheIndex = 0, _setBlockTracking(1), _cache[0] @@ -85,7 +85,7 @@ return function render(_ctx, _cache) { return (_openBlock(), _createElementBlock("div", null, [ _cache[0] || ( - _setBlockTracking(-1), + _setBlockTracking(-1, true), (_cache[0] = _createElementVNode("div")).cacheIndex = 0, _setBlockTracking(1), _cache[0] diff --git a/packages/compiler-core/__tests__/transforms/cacheStatic.spec.ts b/packages/compiler-core/__tests__/transforms/cacheStatic.spec.ts index ab5ed7bae..358c0e31c 100644 --- a/packages/compiler-core/__tests__/transforms/cacheStatic.spec.ts +++ b/packages/compiler-core/__tests__/transforms/cacheStatic.spec.ts @@ -170,6 +170,11 @@ describe('compiler: cacheStatic transform', () => { { /* _ slot flag */ }, + { + type: NodeTypes.JS_PROPERTY, + key: { content: '__' }, + value: { content: '[0]' }, + }, ], }) }) @@ -197,6 +202,11 @@ describe('compiler: cacheStatic transform', () => { { /* _ slot flag */ }, + { + type: NodeTypes.JS_PROPERTY, + key: { content: '__' }, + value: { content: '[0]' }, + }, ], }) }) diff --git a/packages/compiler-core/__tests__/transforms/vMemo.spec.ts b/packages/compiler-core/__tests__/transforms/vMemo.spec.ts index 85769e6e9..41e7d922e 100644 --- a/packages/compiler-core/__tests__/transforms/vMemo.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vMemo.spec.ts @@ -53,4 +53,12 @@ describe('compiler: v-memo transform', () => { ), ).toMatchSnapshot() }) + + test('element v-for key expression prefixing + v-memo', () => { + expect( + compile( + ``, + ), + ).toMatchSnapshot() + }) }) diff --git a/packages/compiler-core/package.json b/packages/compiler-core/package.json index a4e941aa4..7311f4693 100644 --- a/packages/compiler-core/package.json +++ b/packages/compiler-core/package.json @@ -1,6 +1,6 @@ { "name": "@vue/compiler-core", - "version": "3.5.12", + "version": "3.5.14", "description": "@vue/compiler-core", "main": "index.js", "module": "dist/compiler-core.esm-bundler.js", diff --git a/packages/compiler-core/src/ast.ts b/packages/compiler-core/src/ast.ts index cfd5fee25..2d6df9d90 100644 --- a/packages/compiler-core/src/ast.ts +++ b/packages/compiler-core/src/ast.ts @@ -418,6 +418,7 @@ export interface CacheExpression extends Node { index: number value: JSChildNode needPauseTracking: boolean + inVOnce: boolean needArraySpread: boolean } @@ -774,12 +775,14 @@ export function createCacheExpression( index: number, value: JSChildNode, needPauseTracking: boolean = false, + inVOnce: boolean = false, ): CacheExpression { return { type: NodeTypes.JS_CACHE_EXPRESSION, index, value, needPauseTracking: needPauseTracking, + inVOnce, needArraySpread: false, loc: locStub, } diff --git a/packages/compiler-core/src/codegen.ts b/packages/compiler-core/src/codegen.ts index 6b6f24b3a..6b4559fab 100644 --- a/packages/compiler-core/src/codegen.ts +++ b/packages/compiler-core/src/codegen.ts @@ -188,7 +188,9 @@ function createCodegenContext( name = content } } - addMapping(node.loc.start, name) + if (node.loc.source) { + addMapping(node.loc.start, name) + } } if (newlineIndex === NewlineType.Unknown) { // multiple newlines, full iteration @@ -225,7 +227,7 @@ function createCodegenContext( context.column = code.length - newlineIndex } } - if (node && node.loc !== locStub) { + if (node && node.loc !== locStub && node.loc.source) { addMapping(node.loc.end) } } @@ -1017,7 +1019,9 @@ function genCacheExpression(node: CacheExpression, context: CodegenContext) { push(`_cache[${node.index}] || (`) if (needPauseTracking) { indent() - push(`${helper(SET_BLOCK_TRACKING)}(-1),`) + push(`${helper(SET_BLOCK_TRACKING)}(-1`) + if (node.inVOnce) push(`, true`) + push(`),`) newline() push(`(`) } diff --git a/packages/compiler-core/src/parser.ts b/packages/compiler-core/src/parser.ts index 95c5e129f..7d1b01360 100644 --- a/packages/compiler-core/src/parser.ts +++ b/packages/compiler-core/src/parser.ts @@ -388,7 +388,7 @@ const tokenizer = new Tokenizer(stack, { CompilerDeprecationTypes.COMPILER_V_BIND_SYNC, currentOptions, currentProp.loc, - currentProp.rawName, + currentProp.arg!.loc.source, ) ) { currentProp.name = 'model' diff --git a/packages/compiler-core/src/transform.ts b/packages/compiler-core/src/transform.ts index b47b6b8d4..aeb96cc2b 100644 --- a/packages/compiler-core/src/transform.ts +++ b/packages/compiler-core/src/transform.ts @@ -116,7 +116,7 @@ export interface TransformContext addIdentifiers(exp: ExpressionNode | string): void removeIdentifiers(exp: ExpressionNode | string): void hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode - cache(exp: JSChildNode, isVNode?: boolean): CacheExpression + cache(exp: JSChildNode, isVNode?: boolean, inVOnce?: boolean): CacheExpression constantCache: WeakMap // 2.x Compat only @@ -297,11 +297,12 @@ export function createTransformContext( identifier.hoisted = exp return identifier }, - cache(exp, isVNode = false) { + cache(exp, isVNode = false, inVOnce = false) { const cacheExp = createCacheExpression( context.cached.length, exp, isVNode, + inVOnce, ) context.cached.push(cacheExp) return cacheExp diff --git a/packages/compiler-core/src/transforms/cacheStatic.ts b/packages/compiler-core/src/transforms/cacheStatic.ts index 8d5961643..e5d673806 100644 --- a/packages/compiler-core/src/transforms/cacheStatic.ts +++ b/packages/compiler-core/src/transforms/cacheStatic.ts @@ -12,11 +12,14 @@ import { type RootNode, type SimpleExpressionNode, type SlotFunctionExpression, + type SlotsObjectProperty, type TemplateChildNode, type TemplateNode, type TextCallNode, type VNodeCall, createArrayExpression, + createObjectProperty, + createSimpleExpression, getVNodeBlockHelper, getVNodeHelper, } from '../ast' @@ -140,6 +143,7 @@ function walk( } let cachedAsArray = false + const slotCacheKeys = [] if (toCache.length === children.length && node.type === NodeTypes.ELEMENT) { if ( node.tagType === ElementTypes.ELEMENT && @@ -163,6 +167,7 @@ function walk( // default slot const slot = getSlotNode(node.codegenNode, 'default') if (slot) { + slotCacheKeys.push(context.cached.length) slot.returns = getCacheExpression( createArrayExpression(slot.returns as TemplateChildNode[]), ) @@ -186,6 +191,7 @@ function walk( slotName.arg && getSlotNode(parent.codegenNode, slotName.arg) if (slot) { + slotCacheKeys.push(context.cached.length) slot.returns = getCacheExpression( createArrayExpression(slot.returns as TemplateChildNode[]), ) @@ -196,10 +202,31 @@ function walk( if (!cachedAsArray) { for (const child of toCache) { + slotCacheKeys.push(context.cached.length) child.codegenNode = context.cache(child.codegenNode!) } } + // put the slot cached keys on the slot object, so that the cache + // can be removed when component unmounting to prevent memory leaks + if ( + slotCacheKeys.length && + node.type === NodeTypes.ELEMENT && + node.tagType === ElementTypes.COMPONENT && + node.codegenNode && + node.codegenNode.type === NodeTypes.VNODE_CALL && + node.codegenNode.children && + !isArray(node.codegenNode.children) && + node.codegenNode.children.type === NodeTypes.JS_OBJECT_EXPRESSION + ) { + node.codegenNode.children.properties.push( + createObjectProperty( + `__`, + createSimpleExpression(JSON.stringify(slotCacheKeys), false), + ) as SlotsObjectProperty, + ) + } + function getCacheExpression(value: JSChildNode): CacheExpression { const exp = context.cache(value) // #6978, #7138, #7114 diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index 76ca1d443..1dca0c514 100644 --- a/packages/compiler-core/src/transforms/transformElement.ts +++ b/packages/compiler-core/src/transforms/transformElement.ts @@ -594,11 +594,9 @@ export function buildProps( hasDynamicKeys = true if (exp) { if (isVBind) { - // #10696 in case a v-bind object contains ref - pushRefVForMarker() - // have to merge early for compat build check - pushMergeArg() if (__COMPAT__) { + // have to merge early for compat build check + pushMergeArg() // 2.x v-bind object order compat if (__DEV__) { const hasOverridableKeys = mergeArgs.some(arg => { @@ -641,6 +639,9 @@ export function buildProps( } } + // #10696 in case a v-bind object contains ref + pushRefVForMarker() + pushMergeArg() mergeArgs.push(exp) } else { // v-on="obj" -> toHandlers(obj) diff --git a/packages/compiler-core/src/transforms/transformExpression.ts b/packages/compiler-core/src/transforms/transformExpression.ts index ec2d46853..9ae8897e6 100644 --- a/packages/compiler-core/src/transforms/transformExpression.ts +++ b/packages/compiler-core/src/transforms/transformExpression.ts @@ -24,7 +24,7 @@ import { isStaticPropertyKey, walkIdentifiers, } from '../babelUtils' -import { advancePositionWithClone, isSimpleIdentifier } from '../utils' +import { advancePositionWithClone, findDir, isSimpleIdentifier } from '../utils' import { genPropsAccessExp, hasOwn, @@ -54,6 +54,7 @@ export const transformExpression: NodeTransform = (node, context) => { ) } else if (node.type === NodeTypes.ELEMENT) { // handle directives on element + const memo = findDir(node, 'memo') for (let i = 0; i < node.props.length; i++) { const dir = node.props[i] // do not process for v-on & v-for since they are special handled @@ -65,7 +66,14 @@ export const transformExpression: NodeTransform = (node, context) => { if ( exp && exp.type === NodeTypes.SIMPLE_EXPRESSION && - !(dir.name === 'on' && arg) + !(dir.name === 'on' && arg) && + // key has been processed in transformFor(vMemo + vFor) + !( + memo && + arg && + arg.type === NodeTypes.SIMPLE_EXPRESSION && + arg.content === 'key' + ) ) { dir.exp = processExpression( exp, diff --git a/packages/compiler-core/src/transforms/vBind.ts b/packages/compiler-core/src/transforms/vBind.ts index 233ed1e7e..1e5e37141 100644 --- a/packages/compiler-core/src/transforms/vBind.ts +++ b/packages/compiler-core/src/transforms/vBind.ts @@ -12,7 +12,7 @@ import { camelize } from '@vue/shared' import { CAMELIZE } from '../runtimeHelpers' import { processExpression } from './transformExpression' -// v-bind without arg is handled directly in ./transformElements.ts due to it affecting +// v-bind without arg is handled directly in ./transformElement.ts due to its affecting // codegen for the entire props object. This transform here is only for v-bind // *with* args. export const transformBind: DirectiveTransform = (dir, _node, context) => { diff --git a/packages/compiler-core/src/transforms/vFor.ts b/packages/compiler-core/src/transforms/vFor.ts index ec1c21ff8..0dca0ba9a 100644 --- a/packages/compiler-core/src/transforms/vFor.ts +++ b/packages/compiler-core/src/transforms/vFor.ts @@ -63,17 +63,27 @@ export const transformFor: NodeTransform = createStructuralDirectiveTransform( const isTemplate = isTemplateNode(node) const memo = findDir(node, 'memo') const keyProp = findProp(node, `key`, false, true) - if (keyProp && keyProp.type === NodeTypes.DIRECTIVE && !keyProp.exp) { + const isDirKey = keyProp && keyProp.type === NodeTypes.DIRECTIVE + if (isDirKey && !keyProp.exp) { // resolve :key shorthand #10882 transformBindShorthand(keyProp, context) } - const keyExp = + let keyExp = keyProp && (keyProp.type === NodeTypes.ATTRIBUTE ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : undefined : keyProp.exp) + + if (memo && keyExp && isDirKey) { + if (!__BROWSER__) { + keyProp.exp = keyExp = processExpression( + keyExp as SimpleExpressionNode, + context, + ) + } + } const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null diff --git a/packages/compiler-core/src/transforms/vOn.ts b/packages/compiler-core/src/transforms/vOn.ts index ed809a2d7..047c5e7d1 100644 --- a/packages/compiler-core/src/transforms/vOn.ts +++ b/packages/compiler-core/src/transforms/vOn.ts @@ -17,7 +17,7 @@ import { hasScopeRef, isFnExpression, isMemberExpression } from '../utils' import { TO_HANDLER_KEY } from '../runtimeHelpers' export interface VOnDirectiveNode extends DirectiveNode { - // v-on without arg is handled directly in ./transformElements.ts due to it affecting + // v-on without arg is handled directly in ./transformElement.ts due to its affecting // codegen for the entire props object. This transform here is only for v-on // *with* args. arg: ExpressionNode diff --git a/packages/compiler-core/src/transforms/vOnce.ts b/packages/compiler-core/src/transforms/vOnce.ts index 483b98da9..685da59cc 100644 --- a/packages/compiler-core/src/transforms/vOnce.ts +++ b/packages/compiler-core/src/transforms/vOnce.ts @@ -17,7 +17,11 @@ export const transformOnce: NodeTransform = (node, context) => { context.inVOnce = false const cur = context.currentNode as ElementNode | IfNode | ForNode if (cur.codegenNode) { - cur.codegenNode = context.cache(cur.codegenNode, true /* isVNode */) + cur.codegenNode = context.cache( + cur.codegenNode, + true /* isVNode */, + true /* inVOnce */, + ) } } } diff --git a/packages/compiler-core/src/transforms/vSlot.ts b/packages/compiler-core/src/transforms/vSlot.ts index db367f39c..28625439a 100644 --- a/packages/compiler-core/src/transforms/vSlot.ts +++ b/packages/compiler-core/src/transforms/vSlot.ts @@ -342,7 +342,6 @@ export function buildSlots( : hasForwardedSlots(node.children) ? SlotFlags.FORWARDED : SlotFlags.STABLE - let slots = createObjectExpression( slotsProperties.concat( createObjectProperty( diff --git a/packages/compiler-dom/__tests__/transforms/__snapshots__/stringifyStatic.spec.ts.snap b/packages/compiler-dom/__tests__/transforms/__snapshots__/stringifyStatic.spec.ts.snap index a863eb32e..2ed15ef5e 100644 --- a/packages/compiler-dom/__tests__/transforms/__snapshots__/stringifyStatic.spec.ts.snap +++ b/packages/compiler-dom/__tests__/transforms/__snapshots__/stringifyStatic.spec.ts.snap @@ -32,6 +32,16 @@ return function render(_ctx, _cache) { }" `; +exports[`stringify static html > serializing template string style 1`] = ` +"const { toDisplayString: _toDisplayString, normalizeClass: _normalizeClass, createElementVNode: _createElementVNode, createStaticVNode: _createStaticVNode, openBlock: _openBlock, createElementBlock: _createElementBlock } = Vue + +return function render(_ctx, _cache) { + return (_openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [ + _createStaticVNode("
1 + false1 + false1 + false1 + false1 + false
", 1) + ]))) +}" +`; + exports[`stringify static html > should bail for