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.1.3
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.1.4
Choose a head ref
  • 10 commits
  • 28 files changed
  • 3 contributors

Commits on Jul 2, 2021

  1. Copy the full SHA
    2788154 View commit details
  2. Copy the full SHA
    735ada1 View commit details
  3. Copy the full SHA
    12cf9f4 View commit details
  4. Copy the full SHA
    a44d528 View commit details
  5. Copy the full SHA
    438754a View commit details
  6. Copy the full SHA
    e47b1ca View commit details
  7. chore: fix lint script

    yyx990803 committed Jul 2, 2021
    Copy the full SHA
    dd280dd View commit details
  8. Copy the full SHA
    253ca27 View commit details
  9. test: fix test ts target

    yyx990803 committed Jul 2, 2021
    Copy the full SHA
    00bb76b View commit details
  10. release: v3.1.4

    yyx990803 committed Jul 2, 2021
    Copy the full SHA
    348c3b0 View commit details
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,8 @@ module.exports = {
'no-restricted-syntax': [
'error',
'ObjectExpression > SpreadElement',
'ObjectPattern > RestElement'
'ObjectPattern > RestElement',
'AwaitExpression'
]
},
overrides: [
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [3.1.4](https://github.com/vuejs/vue-next/compare/v3.1.3...v3.1.4) (2021-07-02)


### Bug Fixes

* **build:** avoid using async/await syntax ([438754a](https://github.com/vuejs/vue-next/commit/438754a0d1428d10e27d1a290beb4b81da5fdaeb))
* **build:** fix generated code containing unprocessed class field syntax ([2788154](https://github.com/vuejs/vue-next/commit/2788154f7707928f1dd3e4d9bd144f758a8c0478)), closes [#4052](https://github.com/vuejs/vue-next/issues/4052) [vuejs/vue-cli#6562](https://github.com/vuejs/vue-cli/issues/6562)
* **codegen:** ensure valid types in genreated code when using global directives ([a44d528](https://github.com/vuejs/vue-next/commit/a44d528af1227c05dedf610b6ec45504d8e58276)), closes [#4054](https://github.com/vuejs/vue-next/issues/4054)
* **compiler-sfc:** fix parse-only mode when there is no script setup block ([253ca27](https://github.com/vuejs/vue-next/commit/253ca2729d808fc051215876aa4af986e4caa43c))
* **runtime-core:** add useAttrs and useSlots export ([#4053](https://github.com/vuejs/vue-next/issues/4053)) ([735ada1](https://github.com/vuejs/vue-next/commit/735ada1507623b8d36e80b30a4f67a8af4a45c99))
* **runtime-core:** fix instance accessed via $parent chain when using expose() ([#4048](https://github.com/vuejs/vue-next/issues/4048)) ([12cf9f4](https://github.com/vuejs/vue-next/commit/12cf9f4ea148a59fd9002ecf9ea9d365829ce37c))



## [3.1.3](https://github.com/vuejs/vue-next/compare/v3.1.2...v3.1.3) (2021-07-01)


7 changes: 6 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -13,7 +13,12 @@ module.exports = {
__FEATURE_OPTIONS_API__: true,
__FEATURE_SUSPENSE__: true,
__FEATURE_PROD_DEVTOOLS__: false,
__COMPAT__: true
__COMPAT__: true,
'ts-jest': {
tsconfig: {
target: 'esnext'
}
}
},
coverageDirectory: 'coverage',
coverageReporters: ['html', 'lcov', 'text'],
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"private": true,
"version": "3.1.3",
"version": "3.1.4",
"workspaces": [
"packages/*"
],
"scripts": {
"dev": "node scripts/dev.js",
"build": "node scripts/build.js",
"size": "node scripts/build.js vue runtime-dom size-check -p -f global",
"lint": "eslint --ext .ts packages/*/src/**",
"lint": "eslint --ext .ts packages/*/src/**.ts",
"format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
"test": "node scripts/build.js vue -f global -d && jest --runInBand",
"test-dts": "node scripts/build.js shared reactivity runtime-core runtime-dom -dt -f esm-bundler && yarn test-dts-only",
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.1.3",
"version": "3.1.4",
"description": "@vue/compiler-core",
"main": "index.js",
"module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/shared": "3.1.4",
"@babel/parser": "^7.12.0",
"@babel/types": "^7.12.0",
"estree-walker": "^2.0.1",
13 changes: 6 additions & 7 deletions packages/compiler-core/src/codegen.ts
Original file line number Diff line number Diff line change
@@ -68,10 +68,7 @@ export interface CodegenResult {
}

export interface CodegenContext
extends Omit<
Required<CodegenOptions>,
'bindingMetadata' | 'inline' | 'isTS'
> {
extends Omit<Required<CodegenOptions>, 'bindingMetadata' | 'inline'> {
source: string
code: string
line: number
@@ -98,7 +95,8 @@ function createCodegenContext(
optimizeImports = false,
runtimeGlobalName = `Vue`,
runtimeModuleName = `vue`,
ssr = false
ssr = false,
isTS = false
}: CodegenOptions
): CodegenContext {
const context: CodegenContext = {
@@ -111,6 +109,7 @@ function createCodegenContext(
runtimeGlobalName,
runtimeModuleName,
ssr,
isTS,
source: ast.loc.source,
code: ``,
column: 1,
@@ -466,7 +465,7 @@ function genModulePreamble(
function genAssets(
assets: string[],
type: 'component' | 'directive' | 'filter',
{ helper, push, newline }: CodegenContext
{ helper, push, newline, isTS }: CodegenContext
) {
const resolver = helper(
__COMPAT__ && type === 'filter'
@@ -485,7 +484,7 @@ function genAssets(
push(
`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${
maybeSelfReference ? `, true` : ``
})`
})${isTS ? `!` : ``}`
)
if (i < assets.length - 1) {
newline()
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.1.3",
"version": "3.1.4",
"description": "@vue/compiler-dom",
"main": "index.js",
"module": "dist/compiler-dom.esm-bundler.js",
@@ -37,7 +37,7 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-dom#readme",
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/compiler-core": "3.1.3"
"@vue/shared": "3.1.4",
"@vue/compiler-core": "3.1.4"
}
}
10 changes: 10 additions & 0 deletions packages/compiler-sfc/__tests__/compileScriptParseOnlyMode.spec.ts
Original file line number Diff line number Diff line change
@@ -74,4 +74,14 @@ describe('compileScript parseOnly mode', () => {
const { ranges } = compile(`<script setup lang="ts">${src}</script>`)
expect(getRange(src, ranges!.emitsTypeArg!)).toBe(`{ (e: 'x'): void }`)
})

test('no script setup block', () => {
const src = `import { x } from './x'`
const { ranges } = compile(`<script>${src}</script>`)
expect(getRange(src, ranges!.scriptBindings[0])).toBe(`x`)
})

test('no script block', () => {
expect(() => compile(`<style>hello</style>`)).not.toThrow()
})
})
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.1.3",
"version": "3.1.4",
"description": "@vue/compiler-sfc",
"main": "dist/compiler-sfc.cjs.js",
"types": "dist/compiler-sfc.d.ts",
@@ -31,16 +31,16 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme",
"peerDependencies": {
"vue": "3.1.3"
"vue": "3.1.4"
},
"dependencies": {
"@babel/parser": "^7.13.9",
"@babel/types": "^7.13.0",
"@types/estree": "^0.0.48",
"@vue/compiler-core": "3.1.3",
"@vue/compiler-dom": "3.1.3",
"@vue/compiler-ssr": "3.1.3",
"@vue/shared": "3.1.3",
"@vue/compiler-core": "3.1.4",
"@vue/compiler-dom": "3.1.4",
"@vue/compiler-ssr": "3.1.4",
"@vue/shared": "3.1.4",
"consolidate": "^0.16.0",
"estree-walker": "^2.0.1",
"hash-sum": "^2.0.0",
9 changes: 7 additions & 2 deletions packages/compiler-sfc/src/compileScript.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import MagicString from 'magic-string'
import { BindingMetadata, BindingTypes, UNREF } from '@vue/compiler-core'
import {
BindingMetadata,
BindingTypes,
locStub,
UNREF
} from '@vue/compiler-core'
import {
ScriptSetupTextRanges,
SFCDescriptor,
@@ -126,7 +131,7 @@ export function compileScript(
type: 'script',
content: '',
attrs: {},
loc: null as any
loc: locStub
}
}

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.1.3",
"version": "3.1.4",
"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/vue-next/tree/master/packages/compiler-ssr#readme",
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/compiler-dom": "3.1.3"
"@vue/shared": "3.1.4",
"@vue/compiler-dom": "3.1.4"
}
}
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.1.3",
"version": "3.1.4",
"description": "@vue/reactivity",
"main": "index.js",
"module": "dist/reactivity.esm-bundler.js",
@@ -36,6 +36,6 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/reactivity#readme",
"dependencies": {
"@vue/shared": "3.1.3"
"@vue/shared": "3.1.4"
}
}
11 changes: 10 additions & 1 deletion packages/runtime-core/__tests__/apiExpose.spec.ts
Original file line number Diff line number Diff line change
@@ -171,13 +171,20 @@ describe('api: expose', () => {
})

test('expose should allow access to built-in instance properties', () => {
const GrandChild = defineComponent({
render() {
return h('div')
}
})

const grandChildRef = ref()
const Child = defineComponent({
render() {
return h('div')
},
setup(_, { expose }) {
expose()
return {}
return () => h(GrandChild, { ref: grandChildRef })
}
})

@@ -190,5 +197,7 @@ describe('api: expose', () => {
const root = nodeOps.createElement('div')
render(h(Parent), root)
expect(childRef.value.$el.tag).toBe('div')
expect(grandChildRef.value.$parent).toBe(childRef.value)
expect(grandChildRef.value.$parent.$parent).toBe(grandChildRef.value.$root)
})
})
6 changes: 3 additions & 3 deletions packages/runtime-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-core",
"version": "3.1.3",
"version": "3.1.4",
"description": "@vue/runtime-core",
"main": "index.js",
"module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-core#readme",
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/reactivity": "3.1.3"
"@vue/shared": "3.1.4",
"@vue/reactivity": "3.1.4"
}
}
24 changes: 14 additions & 10 deletions packages/runtime-core/src/apiSetupHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isPromise } from '../../shared/src'
import {
getCurrentInstance,
SetupContext,
@@ -232,19 +233,22 @@ export function mergeDefaults(
* Runtime helper for storing and resuming current instance context in
* async setup().
*/
export async function withAsyncContext<T>(
awaitable: T | Promise<T>
): Promise<T> {
export function withAsyncContext<T>(awaitable: T | Promise<T>): Promise<T> {
const ctx = getCurrentInstance()
setCurrentInstance(null) // unset after storing instance
if (__DEV__ && !ctx) {
warn(`withAsyncContext() called when there is no active context instance.`)
}
let res: T
try {
res = await awaitable
} finally {
setCurrentInstance(ctx)
}
return res
return isPromise<T>(awaitable)
? awaitable.then(
res => {
setCurrentInstance(ctx)
return res
},
err => {
setCurrentInstance(ctx)
throw err
}
)
: (awaitable as any)
}
3 changes: 2 additions & 1 deletion packages/runtime-core/src/componentPublicInstance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
ComponentInternalInstance,
Data,
getExposeProxy,
isStatefulComponent
} from './component'
import { nextTick, queueJob } from './scheduler'
@@ -217,7 +218,7 @@ const getPublicInstance = (
i: ComponentInternalInstance | null
): ComponentPublicInstance | ComponentInternalInstance['exposed'] | null => {
if (!i) return null
if (isStatefulComponent(i)) return i.exposed ? i.exposed : i.proxy
if (isStatefulComponent(i)) return getExposeProxy(i) || i.proxy
return getPublicInstance(i.parent)
}

4 changes: 3 additions & 1 deletion packages/runtime-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -58,7 +58,9 @@ export {
withAsyncContext,
// deprecated
defineEmit,
useContext
useContext,
useAttrs,
useSlots
} from './apiSetupHelpers'

// Advanced API ----------------------------------------------------------------
6 changes: 3 additions & 3 deletions packages/runtime-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-dom",
"version": "3.1.3",
"version": "3.1.4",
"description": "@vue/runtime-dom",
"main": "index.js",
"module": "dist/runtime-dom.esm-bundler.js",
@@ -35,8 +35,8 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-dom#readme",
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/runtime-core": "3.1.3",
"@vue/shared": "3.1.4",
"@vue/runtime-core": "3.1.4",
"csstype": "^2.6.8"
}
}
6 changes: 3 additions & 3 deletions packages/runtime-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/runtime-test",
"version": "3.1.3",
"version": "3.1.4",
"description": "@vue/runtime-test",
"private": true,
"main": "index.js",
@@ -25,7 +25,7 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-test#readme",
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/runtime-core": "3.1.3"
"@vue/shared": "3.1.4",
"@vue/runtime-core": "3.1.4"
}
}
8 changes: 4 additions & 4 deletions packages/server-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/server-renderer",
"version": "3.1.3",
"version": "3.1.4",
"description": "@vue/server-renderer",
"main": "index.js",
"types": "dist/server-renderer.d.ts",
@@ -28,10 +28,10 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/server-renderer#readme",
"peerDependencies": {
"vue": "3.1.3"
"vue": "3.1.4"
},
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/compiler-ssr": "3.1.3"
"@vue/shared": "3.1.4",
"@vue/compiler-ssr": "3.1.4"
}
}
2 changes: 1 addition & 1 deletion packages/sfc-playground/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/sfc-playground",
"version": "3.1.3",
"version": "3.1.4",
"private": true,
"scripts": {
"dev": "vite",
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/shared",
"version": "3.1.3",
"version": "3.1.4",
"description": "internal utils shared across @vue packages",
"main": "index.js",
"module": "dist/shared.esm-bundler.js",
2 changes: 1 addition & 1 deletion packages/size-check/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/size-check",
"version": "3.1.3",
"version": "3.1.4",
"private": true,
"buildOptions": {
"name": "Vue",
2 changes: 1 addition & 1 deletion packages/template-explorer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/template-explorer",
"version": "3.1.3",
"version": "3.1.4",
"private": true,
"buildOptions": {
"formats": [
4 changes: 2 additions & 2 deletions packages/vue-compat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue/compat",
"version": "3.1.3",
"version": "3.1.4",
"description": "Vue 3 compatibility build for Vue 2",
"main": "index.js",
"module": "dist/vue.runtime.esm-bundler.js",
@@ -38,6 +38,6 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/vue-compat#readme",
"peerDependencies": {
"vue": "3.1.3"
"vue": "3.1.4"
}
}
8 changes: 4 additions & 4 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue",
"version": "3.1.3",
"version": "3.1.4",
"description": "The progressive JavaScript framework for buiding modern web UI.",
"main": "index.js",
"module": "dist/vue.runtime.esm-bundler.js",
@@ -37,9 +37,9 @@
},
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/vue#readme",
"dependencies": {
"@vue/shared": "3.1.3",
"@vue/compiler-dom": "3.1.3",
"@vue/runtime-dom": "3.1.3"
"@vue/shared": "3.1.4",
"@vue/compiler-dom": "3.1.4",
"@vue/runtime-dom": "3.1.4"
},
"devDependencies": {
"lodash": "^4.17.15",
12 changes: 12 additions & 0 deletions test-dts/setupHelpers.test-d.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ import {
defineEmit,
defineEmits,
useContext,
useAttrs,
useSlots,
withDefaults,
Slots,
describe
@@ -134,3 +136,13 @@ describe('useContext', () => {
emit('foo')
emit('bar')
})

describe('useAttrs', () => {
const attrs = useAttrs()
expectType<Record<string, unknown>>(attrs)
})

describe('useSlots', () => {
const slots = useSlots()
expectType<Slots>(slots)
})
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@
"baseUrl": ".",
"outDir": "dist",
"sourceMap": false,
"target": "esnext",
"target": "es2016",
"useDefineForClassFields": false,
"module": "esnext",
"moduleResolution": "node",
"allowJs": false,