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.36
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.37
Choose a head ref
  • 16 commits
  • 48 files changed
  • 4 contributors

Commits on May 24, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d4d3319 View commit details
  2. Copy the full SHA
    109751a View commit details

Commits on May 25, 2022

  1. Copy the full SHA
    7487d50 View commit details
  2. Copy the full SHA
    90308e8 View commit details
  3. Copy the full SHA
    ec2856c View commit details
  4. Copy the full SHA
    b50353a View commit details
  5. Copy the full SHA
    2035fa0 View commit details
  6. Copy the full SHA
    3cfe5f9 View commit details

Commits on May 28, 2022

  1. Copy the full SHA
    439377b View commit details

Commits on May 29, 2022

  1. Copy the full SHA
    3538f17 View commit details

Commits on May 31, 2022

  1. Copy the full SHA
    0cf9ae6 View commit details

Commits on Jun 6, 2022

  1. Copy the full SHA
    eb22a62 View commit details
  2. Copy the full SHA
    11e17a1 View commit details
  3. Copy the full SHA
    9734b31 View commit details
  4. Copy the full SHA
    e60244b View commit details
  5. release: v3.2.37

    yyx990803 committed Jun 6, 2022
    Copy the full SHA
    bdffc14 View commit details
Showing with 449 additions and 221 deletions.
  1. +13 −0 CHANGELOG.md
  2. +3 −3 package.json
  3. +2 −2 packages/compiler-core/package.json
  4. +3 −3 packages/compiler-dom/package.json
  5. +1 −1 packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap
  6. +1 −1 packages/compiler-sfc/__tests__/compileScript.spec.ts
  7. +17 −1 packages/compiler-sfc/__tests__/cssVars.spec.ts
  8. +6 −6 packages/compiler-sfc/package.json
  9. +1 −1 packages/compiler-sfc/src/compileScript.ts
  10. +71 −10 packages/compiler-sfc/src/cssVars.ts
  11. +1 −1 packages/compiler-ssr/__tests__/ssrSlotOutlet.spec.ts
  12. +3 −3 packages/compiler-ssr/package.json
  13. +4 −0 packages/compiler-ssr/src/transforms/ssrTransformSlotOutlet.ts
  14. +3 −3 packages/reactivity-transform/package.json
  15. +2 −2 packages/reactivity/package.json
  16. +2 −0 packages/runtime-core/__tests__/apiLifecycle.spec.ts
  17. +0 −33 packages/runtime-core/__tests__/apiSetupContext.spec.ts
  18. +52 −1 packages/runtime-core/__tests__/hydration.spec.ts
  19. +3 −3 packages/runtime-core/package.json
  20. +8 −3 packages/runtime-core/src/component.ts
  21. +4 −1 packages/runtime-core/src/helpers/resolveAssets.ts
  22. +8 −3 packages/runtime-core/src/hydration.ts
  23. +1 −1 packages/runtime-core/src/index.ts
  24. +1 −1 packages/runtime-core/src/rendererTemplateRef.ts
  25. +3 −3 packages/runtime-dom/package.json
  26. +3 −3 packages/runtime-test/package.json
  27. +28 −0 packages/server-renderer/__tests__/ssrSlot.spec.ts
  28. +5 −4 packages/server-renderer/package.json
  29. +10 −5 packages/server-renderer/src/helpers/ssrRenderSlot.ts
  30. +3 −3 packages/sfc-playground/index.html
  31. +3 −3 packages/sfc-playground/package.json
  32. +31 −5 packages/sfc-playground/src/App.vue
  33. +72 −34 packages/sfc-playground/src/Header.vue
  34. +2 −2 packages/sfc-playground/src/icons/Download.vue
  35. +2 −3 packages/sfc-playground/src/icons/GitHub.vue
  36. +1 −1 packages/sfc-playground/src/icons/Moon.vue
  37. +1 −1 packages/sfc-playground/src/icons/Share.vue
  38. +9 −9 packages/sfc-playground/src/icons/Sun.vue
  39. +2 −0 packages/sfc-playground/src/vue-server-renderer-dev-proxy.ts
  40. +17 −14 packages/sfc-playground/vite.config.ts
  41. +1 −1 packages/shared/package.json
  42. +1 −1 packages/size-check/package.json
  43. +1 −1 packages/template-explorer/package.json
  44. +2 −2 packages/vue-compat/package.json
  45. +6 −6 packages/vue/package.json
  46. +31 −31 pnpm-lock.yaml
  47. +5 −3 rollup.config.js
  48. +0 −3 scripts/release.js
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [3.2.37](https://github.com/vuejs/core/compare/v3.2.36...v3.2.37) (2022-06-06)


### Bug Fixes

* **compiler-sfc:** improve css v-bind parsing ([e60244b](https://github.com/vuejs/core/commit/e60244bcdf0b386de1560ff7c205ae0870bab355)), closes [#6022](https://github.com/vuejs/core/issues/6022)
* **runtime-core:** hydrate Static vnode ([#6015](https://github.com/vuejs/core/issues/6015)) ([11e17a1](https://github.com/vuejs/core/commit/11e17a1a29cf3d0b37628241d63ff3e8d8525f95)), closes [#6008](https://github.com/vuejs/core/issues/6008)
* **sfc:** avoid auto name inference leading to unwanted recursion ([9734b31](https://github.com/vuejs/core/commit/9734b31c312244a2b5c5cf83c75d7b34076a0c4b)), closes [#5965](https://github.com/vuejs/core/issues/5965) [#6027](https://github.com/vuejs/core/issues/6027) [#6029](https://github.com/vuejs/core/issues/6029)
* **ssr:** ensure app can be unmounted when created with createSSRApp() ([#5992](https://github.com/vuejs/core/issues/5992)) ([d4d3319](https://github.com/vuejs/core/commit/d4d3319c1be16dc9a046b2c5521096debc205f25)), closes [#5990](https://github.com/vuejs/core/issues/5990)
* **ssr:** hydration for transition wrapper components with empty slot content ([#5995](https://github.com/vuejs/core/issues/5995)) ([eb22a62](https://github.com/vuejs/core/commit/eb22a62798d845a8756b0a73b68afdd874feda59)), closes [#5991](https://github.com/vuejs/core/issues/5991)



## [3.2.36](https://github.com/vuejs/core/compare/v3.2.35...v3.2.36) (2022-05-23)


6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "3.2.36",
"version": "3.2.37",
"packageManager": "pnpm@7.1.0",
"scripts": {
"dev": "node scripts/dev.js",
@@ -20,12 +20,12 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"dev-esm": "node scripts/dev.js -if esm-bundler-runtime",
"dev-compiler": "run-p \"dev template-explorer\" serve",
"dev-sfc": "run-p \"dev compiler-sfc -f esm-browser\" \"dev vue -if esm-bundler-runtime \" serve-sfc-playground",
"dev-sfc": "run-p \"dev compiler-sfc -f esm-browser\" \"dev vue -if esm-bundler-runtime\" \"dev server-renderer -if esm-bundler\" serve-sfc-playground",
"serve-sfc-playground": "vite packages/sfc-playground --host",
"serve": "serve",
"open": "open http://localhost:5000/packages/template-explorer/local.html",
"preinstall": "node ./scripts/preinstall.js",
"prebuild-sfc-playground": "node scripts/build.js compiler reactivity-transform shared -af cjs && node scripts/build.js runtime reactivity shared -af esm-bundler && node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js vue -f esm-browser-runtime && node scripts/build.js compiler-sfc -f esm-browser",
"prebuild-sfc-playground": "node scripts/build.js compiler reactivity-transform shared -af cjs && node scripts/build.js runtime reactivity shared -af esm-bundler && node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js vue -f esm-browser-runtime && node scripts/build.js compiler-sfc server-renderer -f esm-browser",
"build-sfc-playground": "cd packages/sfc-playground && npm run build"
},
"types": "test-dts/index.d.ts",
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.36",
"version": "3.2.37",
"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.36",
"@vue/shared": "3.2.37",
"@babel/parser": "^7.16.4",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
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.36",
"version": "3.2.37",
"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.36",
"@vue/compiler-core": "3.2.36"
"@vue/shared": "3.2.37",
"@vue/compiler-core": "3.2.37"
}
}
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

exports[`SFC analyze <script> bindings auto name inference basic 1`] = `
"export default {
name: 'FooBar',
__name: 'FooBar',
setup(__props, { expose }) {
expose();
const a = 1
2 changes: 1 addition & 1 deletion packages/compiler-sfc/__tests__/compileScript.spec.ts
Original file line number Diff line number Diff line change
@@ -1650,7 +1650,7 @@ describe('SFC analyze <script> bindings', () => {
}
)
expect(content).toMatch(`export default {
name: 'FooBar'`)
__name: 'FooBar'`)
assertCode(content)
})

18 changes: 17 additions & 1 deletion packages/compiler-sfc/__tests__/cssVars.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { compileStyle } from '../src'
import { compileStyle, parse } from '../src'
import { mockId, compileSFCScript, assertCode } from './utils'

describe('CSS vars injection', () => {
@@ -231,5 +231,21 @@ describe('CSS vars injection', () => {
})`)
assertCode(content)
})

// #6022
test('should be able to parse incomplete expressions', () => {
const {
descriptor: { cssVars }
} = parse(
`<script setup>let xxx = 1</script>
<style scoped>
label {
font-weight: v-bind("count.toString(");
font-weight: v-bind(xxx);
}
</style>`
)
expect(cssVars).toMatchObject([`count.toString(`, `xxx`])
})
})
})
12 changes: 6 additions & 6 deletions packages/compiler-sfc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-sfc",
"version": "3.2.36",
"version": "3.2.37",
"description": "@vue/compiler-sfc",
"main": "dist/compiler-sfc.cjs.js",
"module": "dist/compiler-sfc.esm-browser.js",
@@ -33,11 +33,11 @@
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.36",
"@vue/compiler-dom": "3.2.36",
"@vue/compiler-ssr": "3.2.36",
"@vue/reactivity-transform": "3.2.36",
"@vue/shared": "3.2.36",
"@vue/compiler-core": "3.2.37",
"@vue/compiler-dom": "3.2.37",
"@vue/compiler-ssr": "3.2.37",
"@vue/reactivity-transform": "3.2.37",
"@vue/shared": "3.2.37",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7",
"source-map": "^0.6.1",
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
@@ -1463,7 +1463,7 @@ export function compileScript(
if (!hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
const match = filename.match(/([^/\\]+)\.\w+$/)
if (match) {
runtimeOptions += `\n name: '${match[1]}',`
runtimeOptions += `\n __name: '${match[1]}',`
}
}
if (hasInlinedSsrRenderFn) {
81 changes: 71 additions & 10 deletions packages/compiler-sfc/src/cssVars.ts
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@ import { PluginCreator } from 'postcss'
import hash from 'hash-sum'

export const CSS_VARS_HELPER = `useCssVars`
// match v-bind() with max 2-levels of nested parens.
const cssVarRE = /v-bind\s*\(((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*)\)/g

export function genCssVarsFromList(
vars: string[],
@@ -47,22 +45,71 @@ function normalizeExpression(exp: string) {
return exp
}

const vBindRE = /v-bind\s*\(/g

export function parseCssVars(sfc: SFCDescriptor): string[] {
const vars: string[] = []
sfc.styles.forEach(style => {
let match
// ignore v-bind() in comments /* ... */
const content = style.content.replace(/\/\*([\s\S]*?)\*\//g, '')
while ((match = cssVarRE.exec(content))) {
const variable = normalizeExpression(match[1])
if (!vars.includes(variable)) {
vars.push(variable)
while ((match = vBindRE.exec(content))) {
const start = match.index + match[0].length
const end = lexBinding(content, start)
if (end !== null) {
const variable = normalizeExpression(content.slice(start, end))
if (!vars.includes(variable)) {
vars.push(variable)
}
}
}
})
return vars
}

const enum LexerState {
inParens,
inSingleQuoteString,
inDoubleQuoteString
}

function lexBinding(content: string, start: number): number | null {
let state: LexerState = LexerState.inParens
let parenDepth = 0

for (let i = start; i < content.length; i++) {
const char = content.charAt(i)
switch (state) {
case LexerState.inParens:
if (char === `'`) {
state = LexerState.inSingleQuoteString
} else if (char === `"`) {
state = LexerState.inDoubleQuoteString
} else if (char === `(`) {
parenDepth++
} else if (char === `)`) {
if (parenDepth > 0) {
parenDepth--
} else {
return i
}
}
break
case LexerState.inSingleQuoteString:
if (char === `'`) {
state = LexerState.inParens
}
break
case LexerState.inDoubleQuoteString:
if (char === `"`) {
state = LexerState.inParens
}
break
}
}
return null
}

// for compileStyle
export interface CssVarsPluginOptions {
id: string
@@ -75,10 +122,24 @@ export const cssVarsPlugin: PluginCreator<CssVarsPluginOptions> = opts => {
postcssPlugin: 'vue-sfc-vars',
Declaration(decl) {
// rewrite CSS variables
if (cssVarRE.test(decl.value)) {
decl.value = decl.value.replace(cssVarRE, (_, $1) => {
return `var(--${genVarName(id, normalizeExpression($1), isProd)})`
})
const value = decl.value
if (vBindRE.test(value)) {
vBindRE.lastIndex = 0
let transformed = ''
let lastIndex = 0
let match
while ((match = vBindRE.exec(value))) {
const start = match.index + match[0].length
const end = lexBinding(value, start)
if (end !== null) {
const variable = normalizeExpression(value.slice(start, end))
transformed +=
value.slice(lastIndex, match.index) +
`var(--${genVarName(id, variable, isProd)})`
lastIndex = end + 1
}
}
decl.value = transformed + value.slice(lastIndex)
}
}
}
2 changes: 1 addition & 1 deletion packages/compiler-ssr/__tests__/ssrSlotOutlet.spec.ts
Original file line number Diff line number Diff line change
@@ -123,7 +123,7 @@ describe('ssr: <slot>', () => {
"const { ssrRenderSlotInner: _ssrRenderSlotInner } = require(\\"vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
_ssrRenderSlotInner(_ctx.$slots, \\"default\\", {}, null, _push, _parent)
_ssrRenderSlotInner(_ctx.$slots, \\"default\\", {}, null, _push, _parent, null, true)
}"
`)
})
6 changes: 3 additions & 3 deletions packages/compiler-ssr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-ssr",
"version": "3.2.36",
"version": "3.2.37",
"description": "@vue/compiler-ssr",
"main": "dist/compiler-ssr.cjs.js",
"types": "dist/compiler-ssr.d.ts",
@@ -28,7 +28,7 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "3.2.36",
"@vue/compiler-dom": "3.2.36"
"@vue/shared": "3.2.37",
"@vue/compiler-dom": "3.2.37"
}
}
Original file line number Diff line number Diff line change
@@ -50,6 +50,10 @@ export const ssrTransformSlotOutlet: NodeTransform = (node, context) => {
parent.children.filter(c => c.type === NodeTypes.ELEMENT).length === 1
) {
method = SSR_RENDER_SLOT_INNER
if (!(context.scopeId && context.slotted !== false)) {
args.push('null')
}
args.push('true')
}

node.ssrCodegenNode = createCallExpression(context.helper(method), args)
6 changes: 3 additions & 3 deletions packages/reactivity-transform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/reactivity-transform",
"version": "3.2.36",
"version": "3.2.37",
"description": "@vue/reactivity-transform",
"main": "dist/reactivity-transform.cjs.js",
"files": [
@@ -29,8 +29,8 @@
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.36",
"@vue/shared": "3.2.36",
"@vue/compiler-core": "3.2.37",
"@vue/shared": "3.2.37",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7"
},
4 changes: 2 additions & 2 deletions packages/reactivity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/reactivity",
"version": "3.2.36",
"version": "3.2.37",
"description": "@vue/reactivity",
"main": "index.js",
"module": "dist/reactivity.esm-bundler.js",
@@ -36,6 +36,6 @@
},
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
"dependencies": {
"@vue/shared": "3.2.36"
"@vue/shared": "3.2.37"
}
}
2 changes: 2 additions & 0 deletions packages/runtime-core/__tests__/apiLifecycle.spec.ts
Original file line number Diff line number Diff line change
@@ -231,6 +231,7 @@ describe('api: lifecycle hooks', () => {
}

const Mid = {
props: ['count'],
setup(props: any) {
onBeforeMount(() => calls.push('mid onBeforeMount'))
onMounted(() => calls.push('mid onMounted'))
@@ -243,6 +244,7 @@ describe('api: lifecycle hooks', () => {
}

const Child = {
props: ['count'],
setup(props: any) {
onBeforeMount(() => calls.push('child onBeforeMount'))
onMounted(() => calls.push('child onMounted'))
33 changes: 0 additions & 33 deletions packages/runtime-core/__tests__/apiSetupContext.spec.ts
Original file line number Diff line number Diff line change
@@ -75,39 +75,6 @@ describe('api: setup context', () => {
expect(dummy).toBe(1)
})

it('setup props should resolve the correct types from props object', async () => {
const count = ref(0)
let dummy

const Parent = {
render: () => h(Child, { count: count.value })
}

const Child = defineComponent({
props: {
count: Number
},

setup(props) {
watchEffect(() => {
dummy = props.count
})
return () => h('div', props.count)
}
})

const root = nodeOps.createElement('div')
render(h(Parent), root)
expect(serializeInner(root)).toMatch(`<div>0</div>`)
expect(dummy).toBe(0)

// props should be reactive
count.value++
await nextTick()
expect(serializeInner(root)).toMatch(`<div>1</div>`)
expect(dummy).toBe(1)
})

it('context.attrs', async () => {
const toggle = ref(true)

Loading