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.3.6
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.3.7
Choose a head ref
  • 18 commits
  • 53 files changed
  • 7 contributors

Commits on Oct 21, 2023

  1. Copy the full SHA
    e9e2778 View commit details
  2. Copy the full SHA
    089d36d View commit details
  3. Copy the full SHA
    a8f6638 View commit details
  4. Copy the full SHA
    d8990fc View commit details
  5. Copy the full SHA
    c568778 View commit details
  6. chore: upgrade deps (#9443)

    sxzz authored Oct 21, 2023
    Copy the full SHA
    6021d02 View commit details
  7. Copy the full SHA
    7334376 View commit details
  8. Copy the full SHA
    00de3e6 View commit details

Commits on Oct 22, 2023

  1. Copy the full SHA
    28a6f05 View commit details

Commits on Oct 23, 2023

  1. chore(deps): update dependency todomvc-app-css to ^2.4.3 (#9458)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Oct 23, 2023
    Copy the full SHA
    27e5052 View commit details
  2. chore(deps): update dependency puppeteer to ~21.4.0 (#9459)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Oct 23, 2023
    1
    Copy the full SHA
    4885515 View commit details
  3. chore(deps): update lint (#9461)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Oct 23, 2023
    1
    Copy the full SHA
    105c564 View commit details
  4. chore(deps): update dependency rollup to v4 (#9462)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Oct 23, 2023
    1
    Copy the full SHA
    f36c49f View commit details
  5. 1
    Copy the full SHA
    16ecb44 View commit details

Commits on Oct 24, 2023

  1. 1
    Copy the full SHA
    5ea8a8a View commit details
  2. 1
    Copy the full SHA
    7374e93 View commit details
  3. 1
    Copy the full SHA
    e09c26b View commit details
  4. release: v3.3.7

    yyx990803 committed Oct 24, 2023
    1
    Copy the full SHA
    1789c1c View commit details
Showing with 1,568 additions and 962 deletions.
  1. +1 −1 .github/workflows/ci.yml
  2. +19 −0 CHANGELOG.md
  3. +11 −11 package.json
  4. +12 −0 packages/compiler-core/__tests__/transforms/hoistStatic.spec.ts
  5. +2 −2 packages/compiler-core/package.json
  6. +6 −0 packages/compiler-core/src/options.ts
  7. +2 −0 packages/compiler-core/src/transform.ts
  8. +8 −1 packages/compiler-core/src/transforms/hoistStatic.ts
  9. +13 −6 packages/compiler-core/src/transforms/vSlot.ts
  10. +3 −3 packages/compiler-dom/package.json
  11. +33 −4 packages/compiler-sfc/__tests__/compileScript/resolveType.spec.ts
  12. +68 −0 packages/compiler-sfc/__tests__/cssVars.spec.ts
  13. +6 −6 packages/compiler-sfc/package.json
  14. +1 −1 packages/compiler-sfc/src/compileScript.ts
  15. +1 −0 packages/compiler-sfc/src/compileTemplate.ts
  16. +1 −1 packages/compiler-sfc/src/script/normalScript.ts
  17. +1 −1 packages/compiler-sfc/src/script/resolveType.ts
  18. +11 −8 packages/compiler-ssr/__tests__/ssrComponent.spec.ts
  19. +25 −0 packages/compiler-ssr/__tests__/ssrTransition.spec.ts
  20. +3 −3 packages/compiler-ssr/package.json
  21. +24 −9 packages/compiler-ssr/src/transforms/ssrTransformComponent.ts
  22. +18 −14 packages/compiler-ssr/src/transforms/ssrTransformSuspense.ts
  23. +36 −0 packages/compiler-ssr/src/transforms/ssrTransformTransition.ts
  24. +5 −0 packages/dts-built-test/README.md
  25. +11 −0 packages/dts-built-test/package.json
  26. +12 −0 packages/dts-built-test/src/index.ts
  27. +13 −0 packages/dts-test/built.test-d.ts
  28. +16 −0 packages/dts-test/h.test-d.ts
  29. +3 −2 packages/dts-test/package.json
  30. +3 −3 packages/reactivity-transform/package.json
  31. +16 −0 packages/reactivity/__tests__/effect.spec.ts
  32. +2 −2 packages/reactivity/package.json
  33. +2 −2 packages/reactivity/src/effect.ts
  34. +37 −1 packages/runtime-core/__tests__/hmr.spec.ts
  35. +96 −2 packages/runtime-core/__tests__/hydration.spec.ts
  36. +53 −1 packages/runtime-core/__tests__/scheduler.spec.ts
  37. +3 −3 packages/runtime-core/package.json
  38. +3 −5 packages/runtime-core/src/componentPublicInstance.ts
  39. +6 −3 packages/runtime-core/src/components/Suspense.ts
  40. +8 −0 packages/runtime-core/src/h.ts
  41. +99 −27 packages/runtime-core/src/hydration.ts
  42. +13 −4 packages/runtime-core/src/renderer.ts
  43. +7 −2 packages/runtime-core/src/scheduler.ts
  44. +3 −3 packages/runtime-dom/package.json
  45. +3 −3 packages/runtime-test/package.json
  46. +4 −4 packages/server-renderer/package.json
  47. +1 −1 packages/sfc-playground/package.json
  48. +1 −1 packages/shared/package.json
  49. +1 −1 packages/template-explorer/package.json
  50. +2 −2 packages/vue-compat/package.json
  51. +88 −0 packages/vue/__tests__/e2e/Transition.spec.ts
  52. +6 −6 packages/vue/package.json
  53. +746 −813 pnpm-lock.yaml
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ jobs:
cache: 'pnpm'

- run: pnpm install
- run: node node_modules/puppeteer/install.js
- run: node node_modules/puppeteer/install.mjs

- name: Run e2e tests
run: pnpm run test-e2e
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## [3.3.7](https://github.com/vuejs/core/compare/v3.3.6...v3.3.7) (2023-10-24)


### Bug Fixes

* **compiler-sfc:** avoid gen useCssVars when targeting SSR ([#6979](https://github.com/vuejs/core/issues/6979)) ([c568778](https://github.com/vuejs/core/commit/c568778ea3265d8e57f788b00864c9509bf88a4e)), closes [#6926](https://github.com/vuejs/core/issues/6926)
* **compiler-ssr:** proper scope analysis for ssr vnode slot fallback ([#7184](https://github.com/vuejs/core/issues/7184)) ([e09c26b](https://github.com/vuejs/core/commit/e09c26bc9bc4394c2c2d928806d382515c2676f3)), closes [#7095](https://github.com/vuejs/core/issues/7095)
* correctly resolve types from relative paths on Windows ([#9446](https://github.com/vuejs/core/issues/9446)) ([089d36d](https://github.com/vuejs/core/commit/089d36d167dc7834065b03ca689f9b6a44eead8a)), closes [#8671](https://github.com/vuejs/core/issues/8671)
* **hmr:** fix hmr error for hoisted children array in v-for ([7334376](https://github.com/vuejs/core/commit/733437691f70ebca8dd6cc3bc8356f5b57d4d5d8)), closes [#6978](https://github.com/vuejs/core/issues/6978) [#7114](https://github.com/vuejs/core/issues/7114)
* **reactivity:** assigning array.length while observing a symbol property ([#7568](https://github.com/vuejs/core/issues/7568)) ([e9e2778](https://github.com/vuejs/core/commit/e9e2778e9ec5cca07c1df5f0c9b7b3595a1a3244))
* **scheduler:** ensure jobs are in the correct order ([#7748](https://github.com/vuejs/core/issues/7748)) ([a8f6638](https://github.com/vuejs/core/commit/a8f663867b8cd2736b82204bc58756ef02441276)), closes [#7576](https://github.com/vuejs/core/issues/7576)
* **ssr:** fix hydration mismatch for disabled teleport at component root ([#9399](https://github.com/vuejs/core/issues/9399)) ([d8990fc](https://github.com/vuejs/core/commit/d8990fc6182d1c2cf0a8eab7b35a9d04df668507)), closes [#6152](https://github.com/vuejs/core/issues/6152)
* **Suspense:** calling hooks before the transition finishes ([#9388](https://github.com/vuejs/core/issues/9388)) ([00de3e6](https://github.com/vuejs/core/commit/00de3e61ed7a55e7d6c2e1987551d66ad0f909ff)), closes [#5844](https://github.com/vuejs/core/issues/5844) [#5952](https://github.com/vuejs/core/issues/5952)
* **transition/ssr:** make transition appear work with SSR ([#8859](https://github.com/vuejs/core/issues/8859)) ([5ea8a8a](https://github.com/vuejs/core/commit/5ea8a8a4fab4e19a71e123e4d27d051f5e927172)), closes [#6951](https://github.com/vuejs/core/issues/6951)
* **types:** fix ComponentCustomProps augmentation ([#9468](https://github.com/vuejs/core/issues/9468)) ([7374e93](https://github.com/vuejs/core/commit/7374e93f0281f273b90ab5a6724cc47332a01d6c)), closes [#8376](https://github.com/vuejs/core/issues/8376)
* **types:** improve `h` overload to support union of string and component ([#5432](https://github.com/vuejs/core/issues/5432)) ([16ecb44](https://github.com/vuejs/core/commit/16ecb44c89cd8299a3b8de33cccc2e2cc36f065b)), closes [#5431](https://github.com/vuejs/core/issues/5431)



## [3.3.6](https://github.com/vuejs/core/compare/v3.3.5...v3.3.6) (2023-10-20)


22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "3.3.6",
"version": "3.3.7",
"packageManager": "pnpm@8.9.2",
"type": "module",
"scripts": {
@@ -66,16 +66,16 @@
"@rollup/plugin-replace": "^5.0.4",
"@rollup/plugin-terser": "^0.4.4",
"@types/hash-sum": "^1.0.1",
"@types/node": "^18.18.6",
"@types/node": "^20.8.7",
"@typescript-eslint/parser": "^6.8.0",
"@vitest/coverage-istanbul": "^0.34.4",
"@vitest/coverage-istanbul": "^0.34.6",
"@vue/consolidate": "0.17.3",
"conventional-changelog-cli": "^4.1.0",
"enquirer": "^2.4.1",
"esbuild": "^0.19.5",
"esbuild-plugin-polyfill-node": "^0.3.0",
"eslint": "^8.51.0",
"eslint-plugin-jest": "^27.4.2",
"eslint": "^8.52.0",
"eslint-plugin-jest": "^27.4.3",
"estree-walker": "^2.0.2",
"execa": "^8.0.1",
"jsdom": "^22.1.0",
@@ -90,21 +90,21 @@
"prettier": "^3.0.3",
"pretty-bytes": "^6.1.1",
"pug": "^3.0.2",
"puppeteer": "~21.2.1",
"puppeteer": "~21.4.0",
"rimraf": "^5.0.5",
"rollup": "^3.29.4",
"rollup": "^4.1.4",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.0",
"rollup-plugin-polyfill-node": "^0.12.0",
"semver": "^7.5.4",
"serve": "^14.2.1",
"simple-git-hooks": "^2.9.0",
"terser": "^5.22.0",
"todomvc-app-css": "^2.4.2",
"todomvc-app-css": "^2.4.3",
"tslib": "^2.6.2",
"tsx": "^3.14.0",
"typescript": "^5.1.6",
"vite": "^4.3.0",
"vitest": "^0.34.4"
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vitest": "^0.34.6"
}
}
12 changes: 12 additions & 0 deletions packages/compiler-core/__tests__/transforms/hoistStatic.spec.ts
Original file line number Diff line number Diff line change
@@ -593,5 +593,17 @@ describe('compiler: hoistStatic transform', () => {
expect(root.hoists.length).toBe(2)
expect(generate(root).code).toMatchSnapshot()
})

test('clone hoisted array children in HMR mode', () => {
const root = transformWithHoist(`<div><span class="hi"></span></div>`, {
hmr: true
})
expect(root.hoists.length).toBe(2)
expect(root.codegenNode).toMatchObject({
children: {
content: '[..._hoisted_2]'
}
})
})
})
})
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.3.6",
"version": "3.3.7",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm-bundler.js",
@@ -33,7 +33,7 @@
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
"dependencies": {
"@babel/parser": "^7.23.0",
"@vue/shared": "3.3.6",
"@vue/shared": "3.3.7",
"estree-walker": "^2.0.2",
"source-map-js": "^1.0.2"
},
6 changes: 6 additions & 0 deletions packages/compiler-core/src/options.ts
Original file line number Diff line number Diff line change
@@ -256,6 +256,12 @@ export interface TransformOptions
* needed to render inline CSS variables on component root
*/
ssrCssVars?: string
/**
* Whether to compile the template assuming it needs to handle HMR.
* Some edge cases may need to generate different code for HMR to work
* correctly, e.g. #6938, #7138
*/
hmr?: boolean
}

export interface CodegenOptions extends SharedTransformCodegenOptions {
2 changes: 2 additions & 0 deletions packages/compiler-core/src/transform.ts
Original file line number Diff line number Diff line change
@@ -129,6 +129,7 @@ export function createTransformContext(
filename = '',
prefixIdentifiers = false,
hoistStatic = false,
hmr = false,
cacheHandlers = false,
nodeTransforms = [],
directiveTransforms = {},
@@ -155,6 +156,7 @@ export function createTransformContext(
selfName: nameMatch && capitalize(camelize(nameMatch[1])),
prefixIdentifiers,
hoistStatic,
hmr,
cacheHandlers,
nodeTransforms,
directiveTransforms,
9 changes: 8 additions & 1 deletion packages/compiler-core/src/transforms/hoistStatic.ts
Original file line number Diff line number Diff line change
@@ -140,9 +140,16 @@ function walk(
node.codegenNode.type === NodeTypes.VNODE_CALL &&
isArray(node.codegenNode.children)
) {
node.codegenNode.children = context.hoist(
const hoisted = context.hoist(
createArrayExpression(node.codegenNode.children)
)
// #6978, #7138, #7114
// a hoisted children array inside v-for can caused HMR errors since
// it might be mutated when mounting the v-for list
if (context.hmr) {
hoisted.content = `[...${hoisted.content}]`
}
node.codegenNode.children = hoisted
}
}

19 changes: 13 additions & 6 deletions packages/compiler-core/src/transforms/vSlot.ts
Original file line number Diff line number Diff line change
@@ -100,11 +100,12 @@ export const trackVForSlotScopes: NodeTransform = (node, context) => {

export type SlotFnBuilder = (
slotProps: ExpressionNode | undefined,
vForExp: ExpressionNode | undefined,
slotChildren: TemplateChildNode[],
loc: SourceLocation
) => FunctionExpression

const buildClientSlotFn: SlotFnBuilder = (props, children, loc) =>
const buildClientSlotFn: SlotFnBuilder = (props, _vForExp, children, loc) =>
createFunctionExpression(
props,
children,
@@ -149,7 +150,7 @@ export function buildSlots(
slotsProperties.push(
createObjectProperty(
arg || createSimpleExpression('default', true),
buildSlotFn(exp, children, loc)
buildSlotFn(exp, undefined, children, loc)
)
)
}
@@ -201,11 +202,17 @@ export function buildSlots(
hasDynamicSlots = true
}

const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc)
const vFor = findDir(slotElement, 'for')
const slotFunction = buildSlotFn(
slotProps,
vFor?.exp,
slotChildren,
slotLoc
)

// check if this slot is conditional (v-if/v-for)
let vIf: DirectiveNode | undefined
let vElse: DirectiveNode | undefined
let vFor: DirectiveNode | undefined
if ((vIf = findDir(slotElement, 'if'))) {
hasDynamicSlots = true
dynamicSlots.push(
@@ -257,7 +264,7 @@ export function buildSlots(
createCompilerError(ErrorCodes.X_V_ELSE_NO_ADJACENT_IF, vElse.loc)
)
}
} else if ((vFor = findDir(slotElement, 'for'))) {
} else if (vFor) {
hasDynamicSlots = true
const parseResult =
vFor.parseResult ||
@@ -306,7 +313,7 @@ export function buildSlots(
props: ExpressionNode | undefined,
children: TemplateChildNode[]
) => {
const fn = buildSlotFn(props, children, loc)
const fn = buildSlotFn(props, undefined, children, loc)
if (__COMPAT__ && context.compatConfig) {
fn.isNonScopedSlot = true
}
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.3.6",
"version": "3.3.7",
"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.3.6",
"@vue/compiler-core": "3.3.6"
"@vue/shared": "3.3.7",
"@vue/compiler-core": "3.3.7"
}
}
37 changes: 33 additions & 4 deletions packages/compiler-sfc/__tests__/compileScript/resolveType.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { normalize } from 'node:path'
import { Identifier } from '@babel/types'
import { SFCScriptCompileOptions, parse } from '../../src'
import { ScriptCompileContext } from '../../src/script/context'
@@ -478,6 +479,33 @@ describe('resolveType', () => {
expect(deps && [...deps]).toStrictEqual(Object.keys(files))
})

test.runIf(process.platform === 'win32')('relative ts on Windows', () => {
const files = {
'C:\\Test\\foo.ts': 'export type P = { foo: number }',
'C:\\Test\\bar.d.ts':
'type X = { bar: string }; export { X as Y };' +
// verify that we can parse syntax that is only valid in d.ts
'export const baz: boolean'
}
const { props, deps } = resolve(
`
import { P } from './foo'
import { Y as PP } from './bar'
defineProps<P & PP>()
`,
files,
{},
'C:\\Test\\Test.vue'
)
expect(props).toStrictEqual({
foo: ['Number'],
bar: ['String']
})
expect(deps && [...deps].map(normalize)).toStrictEqual(
Object.keys(files).map(normalize)
)
})

// #8244
test('utility type in external file', () => {
const files = {
@@ -898,19 +926,20 @@ describe('resolveType', () => {
function resolve(
code: string,
files: Record<string, string> = {},
options?: Partial<SFCScriptCompileOptions>
options?: Partial<SFCScriptCompileOptions>,
sourceFileName: string = '/Test.vue'
) {
const { descriptor } = parse(`<script setup lang="ts">\n${code}\n</script>`, {
filename: '/Test.vue'
filename: sourceFileName
})
const ctx = new ScriptCompileContext(descriptor, {
id: 'test',
fs: {
fileExists(file) {
return !!files[file]
return !!(files[file] ?? files[normalize(file)])
},
readFile(file) {
return files[file]
return files[file] ?? files[normalize(file)]
}
},
...options
68 changes: 68 additions & 0 deletions packages/compiler-sfc/__tests__/cssVars.spec.ts
Original file line number Diff line number Diff line change
@@ -272,5 +272,73 @@ describe('CSS vars injection', () => {
`export default {\n setup(__props, { expose: __expose }) {\n __expose();\n\n_useCssVars(_ctx => ({\n "xxxxxxxx-background": (_unref(background))\n}))`
)
})

describe('skip codegen in SSR', () => {
test('script setup, inline', () => {
const { content } = compileSFCScript(
`<script setup>
let size = 1
</script>\n` +
`<style>
div {
font-size: v-bind(size);
}
</style>`,
{
inlineTemplate: true,
templateOptions: {
ssr: true
}
}
)
expect(content).not.toMatch(`_useCssVars`)
})

// #6926
test('script, non-inline', () => {
const { content } = compileSFCScript(
`<script setup>
let size = 1
</script>\n` +
`<style>
div {
font-size: v-bind(size);
}
</style>`,
{
inlineTemplate: false,
templateOptions: {
ssr: true
}
}
)
expect(content).not.toMatch(`_useCssVars`)
})

test('normal script', () => {
const { content } = compileSFCScript(
`<script>
export default {
setup() {
return {
size: ref('100px')
}
}
}
</script>\n` +
`<style>
div {
font-size: v-bind(size);
}
</style>`,
{
templateOptions: {
ssr: true
}
}
)
expect(content).not.toMatch(`_useCssVars`)
})
})
})
})
Loading