diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ccae2540a9..6fb79445878 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,26 @@
+## [2.7.11](https://github.com/vuejs/vue/compare/v2.7.10...v2.7.11) (2022-10-11)
+
+
+### Bug Fixes
+
+* **build:** enforce LF line ending in built files ([738f4b3](https://github.com/vuejs/vue/commit/738f4b3c570dc3a1818924a203a9f8e4b1ec90f0)), closes [#12819](https://github.com/vuejs/vue/issues/12819)
+* **compiler-sfc:** export parseComponent for compat with fork-ts-checker-webpack-plugin ([0d6d972](https://github.com/vuejs/vue/commit/0d6d972b32521fd18eb853b1073c0a19859a499a)), closes [#12719](https://github.com/vuejs/vue/issues/12719)
+* **reactivity:** check skip first before checking ref when creating observer ([#12813](https://github.com/vuejs/vue/issues/12813)) ([5d26f81](https://github.com/vuejs/vue/commit/5d26f815c643d41e6ca6f29329593223b981fc24)), closes [#12812](https://github.com/vuejs/vue/issues/12812)
+* **reactivity:** use WeakMap for proxy/raw checks, compat with non-extensible objects ([4a0d88e](https://github.com/vuejs/vue/commit/4a0d88e46e4180edc7f22e36c25df3f8ac5d60d2)), closes [#12799](https://github.com/vuejs/vue/issues/12799) [#12798](https://github.com/vuejs/vue/issues/12798)
+* **setup:** setup hook should be called before beforeCreate ([e1342df](https://github.com/vuejs/vue/commit/e1342df7847a51c75192fec74e94378178e046b0)), closes [#12802](https://github.com/vuejs/vue/issues/12802)
+* **sfc:** prune returned bindings for non-TS as well ([fb13930](https://github.com/vuejs/vue/commit/fb1393009660b38046b1f6dfb532b481cc53b3b7)), closes [#12765](https://github.com/vuejs/vue/issues/12765)
+* **sfc:** remove sfc scoped deep syntax deprecation warnings ([2f335b2](https://github.com/vuejs/vue/commit/2f335b2f9d09b962f40e38740826d444e4fff073))
+* **types:** fix error with options watch ([#12779](https://github.com/vuejs/vue/issues/12779)) ([bc5b92a](https://github.com/vuejs/vue/commit/bc5b92adde147436f2adb25e457f0c967829467f)), closes [#12780](https://github.com/vuejs/vue/issues/12780)
+* **types:** support Ref and function types in tsx ref attribute ([#12759](https://github.com/vuejs/vue/issues/12759)) ([87f69aa](https://github.com/vuejs/vue/commit/87f69aa26f195390b948fbb0ff62cf954b58c82c)), closes [#12758](https://github.com/vuejs/vue/issues/12758)
+* **types:** vue 3 directive type compatibility ([#12792](https://github.com/vuejs/vue/issues/12792)) ([27eed82](https://github.com/vuejs/vue/commit/27eed829ccf9978a63b8cd989ff4c03897276bc2))
+
+
+### Performance Improvements
+
+* improve unsub perf for deps with massive amount of subs ([8880b55](https://github.com/vuejs/vue/commit/8880b55d52f8d873f79ef67436217c8752cddef5)), closes [#12696](https://github.com/vuejs/vue/issues/12696)
+
+
+
## [2.7.10](https://github.com/vuejs/vue/compare/v2.7.9...v2.7.10) (2022-08-23)
diff --git a/README.md b/README.md
index 5eef53d3fa0..bca41a49405 100644
--- a/README.md
+++ b/README.md
@@ -17,9 +17,19 @@ You are looking at the repository for Vue 2. The repo for Vue 3 is [vuejs/core](
Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome [backers](https://github.com/vuejs/core/blob/main/BACKERS.md). If you'd like to join them, please consider [ sponsor Vue's development](https://vuejs.org/sponsor/).
+
+
Special Sponsor
+
+
+
+
+
+
+
+
-
+
diff --git a/dist/vue.runtime.mjs b/dist/vue.runtime.mjs
index 886d9f163ca..83d889271bd 100644
--- a/dist/vue.runtime.mjs
+++ b/dist/vue.runtime.mjs
@@ -1,76 +1,76 @@
-import Vue from './vue.runtime.common.js'
-export default Vue
-
-// this should be kept in sync with src/v3/index.ts
-export const {
- version,
-
- // refs
- ref,
- shallowRef,
- isRef,
- toRef,
- toRefs,
- unref,
- proxyRefs,
- customRef,
- triggerRef,
- computed,
-
- // reactive
- reactive,
- isReactive,
- isReadonly,
- isShallow,
- isProxy,
- shallowReactive,
- markRaw,
- toRaw,
- readonly,
- shallowReadonly,
-
- // watch
- watch,
- watchEffect,
- watchPostEffect,
- watchSyncEffect,
-
- // effectScope
- effectScope,
- onScopeDispose,
- getCurrentScope,
-
- // provide / inject
- provide,
- inject,
-
- // lifecycle
- onBeforeMount,
- onMounted,
- onBeforeUpdate,
- onUpdated,
- onBeforeUnmount,
- onUnmounted,
- onErrorCaptured,
- onActivated,
- onDeactivated,
- onServerPrefetch,
- onRenderTracked,
- onRenderTriggered,
-
- // v2 only
- set,
- del,
-
- // v3 compat
- h,
- getCurrentInstance,
- useSlots,
- useAttrs,
- mergeDefaults,
- nextTick,
- useCssModule,
- useCssVars,
- defineComponent,
- defineAsyncComponent
-} = Vue
+import Vue from './vue.runtime.common.js'
+export default Vue
+
+// this should be kept in sync with src/v3/index.ts
+export const {
+ version,
+
+ // refs
+ ref,
+ shallowRef,
+ isRef,
+ toRef,
+ toRefs,
+ unref,
+ proxyRefs,
+ customRef,
+ triggerRef,
+ computed,
+
+ // reactive
+ reactive,
+ isReactive,
+ isReadonly,
+ isShallow,
+ isProxy,
+ shallowReactive,
+ markRaw,
+ toRaw,
+ readonly,
+ shallowReadonly,
+
+ // watch
+ watch,
+ watchEffect,
+ watchPostEffect,
+ watchSyncEffect,
+
+ // effectScope
+ effectScope,
+ onScopeDispose,
+ getCurrentScope,
+
+ // provide / inject
+ provide,
+ inject,
+
+ // lifecycle
+ onBeforeMount,
+ onMounted,
+ onBeforeUpdate,
+ onUpdated,
+ onBeforeUnmount,
+ onUnmounted,
+ onErrorCaptured,
+ onActivated,
+ onDeactivated,
+ onServerPrefetch,
+ onRenderTracked,
+ onRenderTriggered,
+
+ // v2 only
+ set,
+ del,
+
+ // v3 compat
+ h,
+ getCurrentInstance,
+ useSlots,
+ useAttrs,
+ mergeDefaults,
+ nextTick,
+ useCssModule,
+ useCssVars,
+ defineComponent,
+ defineAsyncComponent
+} = Vue
diff --git a/package.json b/package.json
index e8750ff7385..d2210465745 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "vue",
- "version": "2.7.10",
+ "version": "2.7.11",
"packageManager": "pnpm@7.1.0",
"description": "Reactive, component-oriented view layer for modern web interfaces.",
"main": "dist/vue.runtime.common.js",
@@ -117,15 +117,15 @@
"prettier": "^2.6.2",
"puppeteer": "^14.3.0",
"rimraf": "^3.0.2",
- "rollup": "^2.75.6",
- "rollup-plugin-typescript2": "^0.31.2",
+ "rollup": "^2.79.1",
+ "rollup-plugin-typescript2": "^0.32.0",
"semver": "^7.3.7",
"shelljs": "^0.8.5",
"terser": "^5.14.0",
"todomvc-app-css": "^2.4.2",
"ts-node": "^10.8.1",
"tslib": "^2.4.0",
- "typescript": "^4.7.3",
+ "typescript": "^4.8.4",
"vitest": "^0.12.10",
"yorkie": "^2.0.0"
}
diff --git a/packages/compiler-sfc/package.json b/packages/compiler-sfc/package.json
index 115ae6e775b..89cabf64059 100644
--- a/packages/compiler-sfc/package.json
+++ b/packages/compiler-sfc/package.json
@@ -1,6 +1,6 @@
{
"name": "@vue/compiler-sfc",
- "version": "2.7.10",
+ "version": "2.7.11",
"description": "compiler-sfc for Vue 2",
"main": "dist/compiler-sfc.js",
"types": "dist/compiler-sfc.d.ts",
@@ -13,7 +13,7 @@
"source-map": "^0.6.1"
},
"devDependencies": {
- "@babel/types": "^7.18.4",
+ "@babel/types": "^7.19.4",
"@types/estree": "^0.0.48",
"@types/hash-sum": "^1.0.0",
"@types/lru-cache": "^5.1.1",
diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts
index 094120c38f7..548fc592423 100644
--- a/packages/compiler-sfc/src/compileScript.ts
+++ b/packages/compiler-sfc/src/compileScript.ts
@@ -284,11 +284,9 @@ export function compileScript(
userImportAlias[imported] = local
}
- // template usage check is only needed in non-inline mode, so we can skip
- // the work if inlineTemplate is true.
let isUsedInTemplate = true
- if (isTS && sfc.template && !sfc.template.src && !sfc.template.lang) {
- isUsedInTemplate = isImportUsed(local, sfc)
+ if (sfc.template && !sfc.template.src && !sfc.template.lang) {
+ isUsedInTemplate = isImportUsed(local, sfc, isTS)
}
userImports[local] = {
@@ -782,7 +780,7 @@ export function compileScript(
if (node.trailingComments && node.trailingComments.length > 0) {
const lastCommentNode =
node.trailingComments[node.trailingComments.length - 1]
- end = lastCommentNode.end + startOffset
+ end = lastCommentNode.end! + startOffset
}
// locate the end of whitespace between this statement and the next
while (end <= source.length) {
@@ -1584,14 +1582,18 @@ function extractEventNames(
) {
const typeNode = eventName.typeAnnotation.typeAnnotation
if (typeNode.type === 'TSLiteralType') {
- if (typeNode.literal.type !== 'UnaryExpression') {
+ if (
+ typeNode.literal.type !== 'UnaryExpression' &&
+ typeNode.literal.type !== 'TemplateLiteral'
+ ) {
emits.add(String(typeNode.literal.value))
}
} else if (typeNode.type === 'TSUnionType') {
for (const t of typeNode.types) {
if (
t.type === 'TSLiteralType' &&
- t.literal.type !== 'UnaryExpression'
+ t.literal.type !== 'UnaryExpression' &&
+ t.literal.type !== 'TemplateLiteral'
) {
emits.add(String(t.literal.value))
}
@@ -1782,7 +1784,7 @@ function getObjectOrArrayExpressionKeys(value: Node): string[] {
const templateUsageCheckCache = new LRU(512)
-function resolveTemplateUsageCheckString(sfc: SFCDescriptor) {
+function resolveTemplateUsageCheckString(sfc: SFCDescriptor, isTS: boolean) {
const { content } = sfc.template!
const cached = templateUsageCheckCache.get(content)
if (cached) {
@@ -1809,7 +1811,7 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor) {
code += `,v${capitalize(camelize(baseName))}`
}
if (value) {
- code += `,${processExp(value, baseName)}`
+ code += `,${processExp(value, isTS, baseName)}`
}
}
}
@@ -1817,7 +1819,7 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor) {
chars(text) {
const res = parseText(text)
if (res) {
- code += `,${processExp(res.expression)}`
+ code += `,${processExp(res.expression, isTS)}`
}
}
})
@@ -1829,8 +1831,8 @@ function resolveTemplateUsageCheckString(sfc: SFCDescriptor) {
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/
-function processExp(exp: string, dir?: string): string {
- if (/ as\s+\w|<.*>|:/.test(exp)) {
+function processExp(exp: string, isTS: boolean, dir?: string): string {
+ if (isTS && / as\s+\w|<.*>|:/.test(exp)) {
if (dir === 'slot') {
exp = `(${exp})=>{}`
} else if (dir === 'on') {
@@ -1839,7 +1841,7 @@ function processExp(exp: string, dir?: string): string {
const inMatch = exp.match(forAliasRE)
if (inMatch) {
const [, LHS, RHS] = inMatch
- return processExp(`(${LHS})=>{}`) + processExp(RHS)
+ return processExp(`(${LHS})=>{}`, true) + processExp(RHS, true)
}
}
let ret = ''
@@ -1867,36 +1869,38 @@ function stripTemplateString(str: string): string {
return ''
}
-function isImportUsed(local: string, sfc: SFCDescriptor): boolean {
+function isImportUsed(
+ local: string,
+ sfc: SFCDescriptor,
+ isTS: boolean
+): boolean {
return new RegExp(
// #4274 escape $ since it's a special char in regex
// (and is the only regex special char that is valid in identifiers)
`[^\\w$_]${local.replace(/\$/g, '\\$')}[^\\w$_]`
- ).test(resolveTemplateUsageCheckString(sfc))
+ ).test(resolveTemplateUsageCheckString(sfc, isTS))
}
/**
* Note: this comparison assumes the prev/next script are already identical,
- * and only checks the special case where