Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.2.44
Choose a base ref
...
head repository: vuejs/core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.2.45
Choose a head ref

Commits on Nov 10, 2022

  1. Copy the full SHA
    001184e View commit details
  2. Copy the full SHA
    d45cbfc View commit details
  3. chore: fix test

    yyx990803 committed Nov 10, 2022
    Copy the full SHA
    9ca8b7c View commit details
  4. fix(teleport/css-v-bind): fix css v-bind for teleported content

    fix #4605
    close #4609 (used tests from this PR)
    yyx990803 committed Nov 10, 2022
    Copy the full SHA
    42239cf View commit details
  5. Copy the full SHA
    11214ee View commit details
  6. Copy the full SHA
    f793faa View commit details
  7. Copy the full SHA
    15e889a View commit details
  8. fix(sfc): ensure <script setup> binding behavior consistency on `th…

    …is` between prod and dev
    
    close #6248
    yyx990803 committed Nov 10, 2022
    Copy the full SHA
    f73925d View commit details
  9. fix(sfc): ensure consistent dev/prod behavior for non-reactive variab…

    …les declared in `<script setup>`
    
    fix #5655
    yyx990803 committed Nov 10, 2022
    Copy the full SHA
    5a3d45a View commit details
  10. Copy the full SHA
    0594400 View commit details
  11. Copy the full SHA
    a54bff2 View commit details
  12. Copy the full SHA
    4049ffc View commit details

Commits on Nov 11, 2022

  1. Copy the full SHA
    845efbb View commit details
  2. Copy the full SHA
    4798a9f View commit details
  3. Copy the full SHA
    192dcb6 View commit details
  4. Copy the full SHA
    0b39e46 View commit details
  5. Copy the full SHA
    665f2ae View commit details
  6. Copy the full SHA
    5e50909 View commit details
  7. Copy the full SHA
    afe8899 View commit details
  8. Copy the full SHA
    89f37ce View commit details
  9. Copy the full SHA
    55382ae View commit details
  10. Copy the full SHA
    ffef822 View commit details
  11. Copy the full SHA
    67890da View commit details
  12. test: test case for #6966

    yyx990803 committed Nov 11, 2022
    Copy the full SHA
    24964da View commit details
  13. release: v3.2.45

    yyx990803 committed Nov 11, 2022
    Copy the full SHA
    6f663d4 View commit details
Showing with 756 additions and 217 deletions.
  1. +0 −2 .github/contributing.md
  2. +27 −1 CHANGELOG.md
  3. +1 −4 package.json
  4. +19 −1 packages/compiler-core/__tests__/transforms/vModel.spec.ts
  5. +2 −2 packages/compiler-core/package.json
  6. +2 −0 packages/compiler-core/src/errors.ts
  7. +13 −2 packages/compiler-core/src/transforms/vModel.ts
  8. +3 −3 packages/compiler-dom/package.json
  9. +22 −22 packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap
  10. +2 −2 packages/compiler-sfc/__tests__/__snapshots__/compileScriptRefTransform.spec.ts.snap
  11. +1 −1 packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap
  12. +44 −9 packages/compiler-sfc/__tests__/compileScript.spec.ts
  13. +4 −1 packages/compiler-sfc/__tests__/compileScriptRefTransform.spec.ts
  14. +6 −6 packages/compiler-sfc/package.json
  15. +21 −1 packages/compiler-sfc/src/compileScript.ts
  16. +3 −3 packages/compiler-ssr/package.json
  17. +3 −3 packages/reactivity-transform/package.json
  18. +2 −2 packages/reactivity/package.json
  19. +22 −1 packages/runtime-core/__tests__/componentPublicInstance.spec.ts
  20. +67 −0 packages/runtime-core/__tests__/hmr.spec.ts
  21. +36 −0 packages/runtime-core/__tests__/rendererFragment.spec.ts
  22. +3 −3 packages/runtime-core/package.json
  23. +7 −4 packages/runtime-core/src/apiAsyncComponent.ts
  24. +10 −0 packages/runtime-core/src/component.ts
  25. +15 −23 packages/runtime-core/src/componentPublicInstance.ts
  26. +4 −11 packages/runtime-core/src/components/KeepAlive.ts
  27. +17 −0 packages/runtime-core/src/components/Teleport.ts
  28. +2 −5 packages/runtime-core/src/helpers/renderSlot.ts
  29. +0 −8 packages/runtime-core/src/hmr.ts
  30. +4 −0 packages/runtime-core/src/renderer.ts
  31. +13 −2 packages/runtime-core/src/vnode.ts
  32. +177 −4 packages/runtime-dom/__tests__/customElement.spec.ts
  33. +79 −0 packages/runtime-dom/__tests__/helpers/useCssVars.spec.ts
  34. +3 −3 packages/runtime-dom/package.json
  35. +62 −39 packages/runtime-dom/src/apiCustomElement.ts
  36. +13 −2 packages/runtime-dom/src/helpers/useCssVars.ts
  37. +3 −3 packages/runtime-test/package.json
  38. +4 −4 packages/server-renderer/package.json
  39. +2 −2 packages/sfc-playground/package.json
  40. +1 −1 packages/shared/package.json
  41. +1 −1 packages/size-check/package.json
  42. +1 −1 packages/template-explorer/package.json
  43. +2 −2 packages/vue-compat/package.json
  44. +6 −6 packages/vue/package.json
  45. +27 −27 pnpm-lock.yaml
2 changes: 0 additions & 2 deletions .github/contributing.md
Original file line number Diff line number Diff line change
@@ -267,8 +267,6 @@ Test coverage is continuously deployed at https://vue-next-coverage.netlify.app/

### Testing Type Definition Correctness

This project uses [tsd](https://github.com/SamVerschueren/tsd) to test the built definition files (`*.d.ts`).

Type tests are located in the `test-dts` directory. To run the dts tests, run `nr test-dts`. Note that the type test requires all relevant `*.d.ts` files to be built first (and the script does it for you). Once the `d.ts` files are built and up-to-date, the tests can be re-run by simply running `nr test-dts`.

## Financial Contribution
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## [3.2.45](https://github.com/vuejs/core/compare/v3.2.44...v3.2.45) (2022-11-11)


### Bug Fixes

* **compiler/v-model:** catch incorrect v-model usage on prop bindings ([001184e](https://github.com/vuejs/core/commit/001184e6bbbc85c4698f460b1f810beca3aed262)), closes [#5584](https://github.com/vuejs/core/issues/5584)
* **custom-elements:** also dispatch hyphenated version of emitted events ([#5378](https://github.com/vuejs/core/issues/5378)) ([0b39e46](https://github.com/vuejs/core/commit/0b39e46192c6258d5bf9d3b6992b84edb0b641d3)), closes [#5373](https://github.com/vuejs/core/issues/5373)
* **custom-elements:** custom element should re-instantiate when inserted again ([#6966](https://github.com/vuejs/core/issues/6966)) ([67890da](https://github.com/vuejs/core/commit/67890daad1a8474c5178565f32a4efa427db911a)), closes [#6934](https://github.com/vuejs/core/issues/6934)
* **custom-elements:** define declared properties in constructor ([#5328](https://github.com/vuejs/core/issues/5328)) ([55382ae](https://github.com/vuejs/core/commit/55382aed58aa3d937f442ad9445b3fff83a07de1))
* **custom-elements:** ensure custom elements can inherit provides from ancestors ([#5098](https://github.com/vuejs/core/issues/5098)) ([192dcb6](https://github.com/vuejs/core/commit/192dcb648c0630ac20d2009eed512e142a72654a)), closes [#5096](https://github.com/vuejs/core/issues/5096)
* **custom-elements:** fix event emitting for async custom elements ([#5601](https://github.com/vuejs/core/issues/5601)) ([665f2ae](https://github.com/vuejs/core/commit/665f2ae121ec31d65cf22bd577f12fb1d9ffa4a2)), closes [#5599](https://github.com/vuejs/core/issues/5599)
* **custom-elements:** fix number type props casting check ([89f37ce](https://github.com/vuejs/core/commit/89f37ceb62363c77697d177675790a9ab81ba34f)), closes [#5793](https://github.com/vuejs/core/issues/5793) [#5794](https://github.com/vuejs/core/issues/5794)
* **custom-elements:** properties set pre-upgrade should not show up in $attrs ([afe8899](https://github.com/vuejs/core/commit/afe889999cbcaa11020c46c30b591a5ee6c3d4cf))
* **custom-elements:** respect slot props in custom element mode ([ffef822](https://github.com/vuejs/core/commit/ffef8228694b39638f07c0fe5bc30d826262b672))
* **custom-elements:** should not reflect non-decalred properties set before upgrade ([5e50909](https://github.com/vuejs/core/commit/5e509091000779acbfae4c85cc1cc3973b1b2e64))
* **hmr/keep-alive:** fix error in reload component ([#7049](https://github.com/vuejs/core/issues/7049)) ([a54bff2](https://github.com/vuejs/core/commit/a54bff2c9c8e1d908b4a0f3826ac715c9a35e68c)), closes [#7042](https://github.com/vuejs/core/issues/7042)
* **runtime-core:** fix move/removal of static fragments containing text nodes ([#6858](https://github.com/vuejs/core/issues/6858)) ([4049ffc](https://github.com/vuejs/core/commit/4049ffcf29dc12dca71f682edf0b422a5c502e23)), closes [#6852](https://github.com/vuejs/core/issues/6852)
* **sfc:** also generate getter for import bindings during dev ([0594400](https://github.com/vuejs/core/commit/0594400980d3bdc394e92db63fc939a6609f7a94))
* **sfc:** ensure `<script setup>` binding behavior consistency on `this` between prod and dev ([f73925d](https://github.com/vuejs/core/commit/f73925d76a76ee259749b8b48cb68895f539a00f)), closes [#6248](https://github.com/vuejs/core/issues/6248)
* **sfc:** ensure consistent dev/prod behavior for non-reactive variables declared in `<script setup>` ([5a3d45a](https://github.com/vuejs/core/commit/5a3d45ae29e26938a36e16c7ab9a804bfe4bcb08)), closes [#5655](https://github.com/vuejs/core/issues/5655)
* **teleport/css-v-bind:** fix css v-bind for teleported content ([42239cf](https://github.com/vuejs/core/commit/42239cf2846f50b6ac2c060dad381113840d9ea1)), closes [#4605](https://github.com/vuejs/core/issues/4605) [#4609](https://github.com/vuejs/core/issues/4609)
* **teleport/css-v-bind:** fix css v-bind in teleport in child component slot ([11214ee](https://github.com/vuejs/core/commit/11214eedd2699e15106c44927f4d1206b111fbd3))
* **v-model:** fix incorrect codegen for non-ref bindings ([15e889a](https://github.com/vuejs/core/commit/15e889afaf75143484946b2dde281572ebf9e8ab)), closes [#6241](https://github.com/vuejs/core/issues/6241)



## [3.2.44](https://github.com/vuejs/core/compare/v3.2.43...v3.2.44) (2022-11-09)


@@ -33,7 +59,7 @@
* **compiler-sfc:** fix macro usage in multi-variable declaration ([#6778](https://github.com/vuejs/core/issues/6778)) ([99b6697](https://github.com/vuejs/core/commit/99b6697fb44dd1094ea0bf372c1d05214ffb92a2)), closes [#6757](https://github.com/vuejs/core/issues/6757)
* **compiler-sfc:** handle method shorthand syntax in withDefaults ([#6972](https://github.com/vuejs/core/issues/6972)) ([8a882ce](https://github.com/vuejs/core/commit/8a882ce0a10bfa5482d6b8a9b68fd49cff4f6937)), closes [#6971](https://github.com/vuejs/core/issues/6971)
* **compiler-sfc:** only escape parsing-breaking characters in v-bind css var names ([#6816](https://github.com/vuejs/core/issues/6816)) ([57c9013](https://github.com/vuejs/core/commit/57c901383792176fd7267b7d34d845088dbeff63)), closes [#6803](https://github.com/vuejs/core/issues/6803)
* **compiler-sfc:** require <template> or <script> in SFC ([#6781](https://github.com/vuejs/core/issues/6781)) ([a0c7f27](https://github.com/vuejs/core/commit/a0c7f271a2efb2bacf0889a9ac259263b5526112)), closes [#6676](https://github.com/vuejs/core/issues/6676)
* **compiler-sfc:** require \<template\> or \<script\> in SFC ([#6781](https://github.com/vuejs/core/issues/6781)) ([a0c7f27](https://github.com/vuejs/core/commit/a0c7f271a2efb2bacf0889a9ac259263b5526112)), closes [#6676](https://github.com/vuejs/core/issues/6676)
* **compiler-sfc:** resolve computed object key ([#6963](https://github.com/vuejs/core/issues/6963)) ([910fa76](https://github.com/vuejs/core/commit/910fa7677f4ef690b612fae4a069b2293672c439))
* **compiler-sfc:** support using extends interface with defineProps() ([#4512](https://github.com/vuejs/core/issues/4512)) ([83f7e6f](https://github.com/vuejs/core/commit/83f7e6f8a688e823274379fe79f58b90ea58892d)), closes [#4498](https://github.com/vuejs/core/issues/4498)
* **compiler-ssr:** fix invalid codegen when v-slot name is explicit empty attr ([#3326](https://github.com/vuejs/core/issues/3326)) ([09bb3e9](https://github.com/vuejs/core/commit/09bb3e996ef17967022243a519d7dcc2921dd049))
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "3.2.44",
"version": "3.2.45",
"packageManager": "pnpm@7.1.0",
"scripts": {
"dev": "node scripts/dev.js",
@@ -31,9 +31,6 @@
"postinstall": "simple-git-hooks"
},
"types": "test-dts/index.d.ts",
"tsd": {
"directory": "test-dts"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged",
"commit-msg": "node scripts/verifyCommit.mjs"
20 changes: 19 additions & 1 deletion packages/compiler-core/__tests__/transforms/vModel.spec.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ import {
ComponentNode,
NodeTypes,
VNodeCall,
NORMALIZE_PROPS
NORMALIZE_PROPS,
BindingTypes
} from '../../src'
import { ErrorCodes } from '../../src/errors'
import { transformModel } from '../../src/transforms/vModel'
@@ -561,5 +562,22 @@ describe('compiler: transform v-model', () => {
})
)
})

test('used on props', () => {
const onError = jest.fn()
parseWithVModel('<div v-model="p" />', {
onError,
bindingMetadata: {
p: BindingTypes.PROPS
}
})

expect(onError).toHaveBeenCalledTimes(1)
expect(onError).toHaveBeenCalledWith(
expect.objectContaining({
code: ErrorCodes.X_V_MODEL_ON_PROPS
})
)
})
})
})
4 changes: 2 additions & 2 deletions packages/compiler-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-core",
"version": "3.2.44",
"version": "3.2.45",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": {
"@vue/shared": "3.2.44",
"@vue/shared": "3.2.45",
"@babel/parser": "^7.16.4",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
2 changes: 2 additions & 0 deletions packages/compiler-core/src/errors.ts
Original file line number Diff line number Diff line change
@@ -87,6 +87,7 @@ export const enum ErrorCodes {
X_V_MODEL_NO_EXPRESSION,
X_V_MODEL_MALFORMED_EXPRESSION,
X_V_MODEL_ON_SCOPE_VARIABLE,
X_V_MODEL_ON_PROPS,
X_INVALID_EXPRESSION,
X_KEEP_ALIVE_INVALID_CHILDREN,

@@ -168,6 +169,7 @@ export const errorMessages: Record<ErrorCodes, string> = {
[ErrorCodes.X_V_MODEL_NO_EXPRESSION]: `v-model is missing expression.`,
[ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION]: `v-model value must be a valid JavaScript member expression.`,
[ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
[ErrorCodes.X_V_MODEL_ON_PROPS]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
[ErrorCodes.X_INVALID_EXPRESSION]: `Error parsing JavaScript expression: `,
[ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN]: `<KeepAlive> expects exactly one child component.`,

15 changes: 13 additions & 2 deletions packages/compiler-core/src/transforms/vModel.ts
Original file line number Diff line number Diff line change
@@ -35,11 +35,22 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
// im SFC <script setup> inline mode, the exp may have been transformed into
// _unref(exp)
const bindingType = context.bindingMetadata[rawExp]

// check props
if (
bindingType === BindingTypes.PROPS ||
bindingType === BindingTypes.PROPS_ALIASED
) {
context.onError(createCompilerError(ErrorCodes.X_V_MODEL_ON_PROPS, exp.loc))
return createTransformProps()
}

const maybeRef =
!__BROWSER__ &&
context.inline &&
bindingType &&
bindingType !== BindingTypes.SETUP_CONST
(bindingType === BindingTypes.SETUP_LET ||
bindingType === BindingTypes.SETUP_REF ||
bindingType === BindingTypes.SETUP_MAYBE_REF)

if (
!expString.trim() ||
6 changes: 3 additions & 3 deletions packages/compiler-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-dom",
"version": "3.2.44",
"version": "3.2.45",
"description": "@vue/compiler-dom",
"main": "index.js",
"module": "dist/compiler-dom.esm-bundler.js",
@@ -37,7 +37,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
"dependencies": {
"@vue/shared": "3.2.44",
"@vue/compiler-core": "3.2.44"
"@vue/shared": "3.2.45",
"@vue/compiler-core": "3.2.45"
}
}
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ export default {
expose();


return { n, x }
return { n, get x() { return x } }
}

}"
@@ -71,7 +71,7 @@ export default /*#__PURE__*/Object.assign(__default__, {

x()

return { n, x }
return { n, get x() { return x } }
}

})"
@@ -90,7 +90,7 @@ export default /*#__PURE__*/Object.assign(__default__, {

x()

return { n, x }
return { n, get x() { return x } }
}

})"
@@ -112,7 +112,7 @@ export default /*#__PURE__*/_defineComponent({

x()

return { x }
return { get x() { return x } }
}

})"
@@ -134,7 +134,7 @@ export default /*#__PURE__*/Object.assign(__default__, {

x()

return { n, def, x }
return { n, def, get x() { return x } }
}

})"
@@ -154,7 +154,7 @@ export default /*#__PURE__*/Object.assign(__default__, {

x()

return { n, x }
return { n, get x() { return x } }
}

})"
@@ -174,7 +174,7 @@ export default /*#__PURE__*/Object.assign(__default__, {

x()

return { n, x }
return { n, get x() { return x } }
}

})"
@@ -646,7 +646,7 @@ const props = __props;



return { props, propsModel }
return { props, get propsModel() { return propsModel } }
}

}"
@@ -663,7 +663,7 @@ export default {
const props = __props;


return { props, x }
return { props, get x() { return x } }
}

}"
@@ -750,7 +750,7 @@ export default /*#__PURE__*/_defineComponent({
const a = 1
function b() {}

return { a, b, Baz }
return { a, b, get Baz() { return Baz } }
}

})"
@@ -766,7 +766,7 @@ export default /*#__PURE__*/_defineComponent({

const cond = true

return { cond, bar, baz }
return { cond, get bar() { return bar }, get baz() { return baz } }
}

})"
@@ -782,7 +782,7 @@ export default /*#__PURE__*/_defineComponent({

const fooBar: FooBar = 1

return { fooBar, FooBaz, FooQux, foo }
return { fooBar, get FooBaz() { return FooBaz }, get FooQux() { return FooQux }, get foo() { return foo } }
}

})"
@@ -797,7 +797,7 @@ export default /*#__PURE__*/_defineComponent({
expose();


return { vMyDir }
return { get vMyDir() { return vMyDir } }
}

})"
@@ -812,7 +812,7 @@ export default /*#__PURE__*/_defineComponent({
expose();


return { VAR, VAR3 }
return { get VAR() { return VAR }, get VAR3() { return VAR3 } }
}

})"
@@ -827,7 +827,7 @@ export default /*#__PURE__*/_defineComponent({
expose();


return { FooBaz, Last }
return { get FooBaz() { return FooBaz }, get Last() { return Last } }
}

})"
@@ -842,7 +842,7 @@ export default /*#__PURE__*/_defineComponent({
expose();


return { x, z, x$y }
return { get x() { return x }, get z() { return z }, get x$y() { return x$y } }
}

})"
@@ -866,7 +866,7 @@ export default {



return { bar }
return { get bar() { return bar } }
}

}"
@@ -920,7 +920,7 @@ export default {

x()

return { x }
return { get x() { return x } }
}

}"
@@ -954,7 +954,7 @@ export default {
expose();


return { a, b }
return { get a() { return a }, get b() { return b } }
}

}"
@@ -1280,7 +1280,7 @@ export default {
function c() {}
class d {}

return { aa, bb, cc, dd, a, b, c, d, xx, x }
return { get aa() { return aa }, set aa(v) { aa = v }, bb, cc, dd, get a() { return a }, set a(v) { a = v }, b, c, d, get xx() { return xx }, get x() { return x } }
}

}"
@@ -1668,7 +1668,7 @@ export default /*#__PURE__*/_defineComponent({
expose();


return { Baz }
return { get Baz() { return Baz } }
}

})"
@@ -1729,7 +1729,7 @@ const props = __props as {



return { props, defaults }
return { props, get defaults() { return defaults } }
}

})"
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ export default {
let c = () => {}
let d
return { foo, a, b, c, d, ref, shallowRef }
return { foo, a, b, get c() { return c }, set c(v) { c = v }, get d() { return d }, set d(v) { d = v }, ref, shallowRef }
}
}"
@@ -36,7 +36,7 @@ export default {
let c = () => {}
let d
return { foo, a, b, c, d }
return { foo, a, b, get c() { return c }, set c(v) { c = v }, get d() { return d }, set d(v) { d = v } }
}
}"
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ _useCssVars(_ctx => ({
let b = 200
let foo = 300
return { a, b, foo }
return { get a() { return a }, set a(v) { a = v }, get b() { return b }, set b(v) { b = v }, get foo() { return foo }, set foo(v) { foo = v } }
}
}"
Loading