Comparing version 2.7.15 to 2.7.16-beta.1
{ | ||
"name": "vue", | ||
"version": "2.7.15", | ||
"version": "2.7.16-beta.1", | ||
"packageManager": "pnpm@8.9.2", | ||
@@ -21,2 +21,3 @@ "description": "Reactive, component-oriented view layer for modern web interfaces.", | ||
".": { | ||
"types": "./types/index.d.ts", | ||
"import": { | ||
@@ -26,6 +27,6 @@ "node": "./dist/vue.runtime.mjs", | ||
}, | ||
"require": "./dist/vue.runtime.common.js", | ||
"types": "./types/index.d.ts" | ||
"require": "./dist/vue.runtime.common.js" | ||
}, | ||
"./compiler-sfc": { | ||
"types": "./compiler-sfc/index.d.ts", | ||
"import": "./compiler-sfc/index.mjs", | ||
@@ -35,3 +36,6 @@ "require": "./compiler-sfc/index.js" | ||
"./dist/*": "./dist/*", | ||
"./types/*": "./types/*", | ||
"./types/*": [ | ||
"./types/*.d.ts", | ||
"./types/*" | ||
], | ||
"./package.json": "./package.json" | ||
@@ -67,6 +71,6 @@ }, | ||
"csstype": "^3.1.0", | ||
"@vue/compiler-sfc": "2.7.15" | ||
"@vue/compiler-sfc": "2.7.16-beta.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/parser": "^7.18.4", | ||
"@babel/parser": "^7.23.5", | ||
"@microsoft/api-extractor": "^7.25.0", | ||
@@ -78,3 +82,3 @@ "@rollup/plugin-alias": "^3.1.9", | ||
"@types/he": "^1.1.2", | ||
"@types/node": "^17.0.41", | ||
"@types/node": "^20.10.3", | ||
"chalk": "^4.1.2", | ||
@@ -84,3 +88,3 @@ "conventional-changelog-cli": "^2.2.2", | ||
"enquirer": "^2.3.6", | ||
"esbuild": "^0.16.0", | ||
"esbuild": "^0.19.8", | ||
"execa": "^4.1.0", | ||
@@ -112,3 +116,3 @@ "he": "^1.2.0", | ||
"typescript": "^4.8.4", | ||
"vitest": "^0.34.6", | ||
"vitest": "^1.0.0", | ||
"yorkie": "^2.0.0" | ||
@@ -115,0 +119,0 @@ }, |
{ | ||
"name": "@vue/compiler-sfc", | ||
"version": "2.7.15", | ||
"version": "2.7.16-beta.1", | ||
"description": "compiler-sfc for Vue 2", | ||
@@ -11,3 +11,3 @@ "main": "dist/compiler-sfc.js", | ||
"dependencies": { | ||
"@babel/parser": "^7.18.4", | ||
"@babel/parser": "^7.23.5", | ||
"postcss": "^8.4.14", | ||
@@ -17,3 +17,3 @@ "source-map": "^0.6.1" | ||
"devDependencies": { | ||
"@babel/types": "^7.19.4", | ||
"@babel/types": "^7.23.5", | ||
"@types/estree": "^0.0.48", | ||
@@ -35,3 +35,6 @@ "@types/hash-sum": "^1.0.0", | ||
"stylus": "^0.58.1" | ||
}, | ||
"optionalDependencies": { | ||
"prettier": "^1.18.2 || ^2.0.0" | ||
} | ||
} |
@@ -1578,3 +1578,3 @@ import MagicString from 'magic-string' | ||
function extractEventNames( | ||
eventName: Identifier | RestElement, | ||
eventName: ArrayPattern | Identifier | ObjectPattern | RestElement, | ||
emits: Set<string> | ||
@@ -1822,2 +1822,4 @@ ) { | ||
} | ||
} else if (name === 'ref') { | ||
code += `,${value}` | ||
} | ||
@@ -1824,0 +1826,0 @@ } |
@@ -45,4 +45,10 @@ import { parse, ParserPlugin } from '@babel/parser' | ||
if (node.type === 'ExportDefaultDeclaration') { | ||
if (node.declaration.type === 'ClassDeclaration') { | ||
s.overwrite(node.start!, node.declaration.id.start!, `class `) | ||
if (node.declaration.type === 'ClassDeclaration' && node.declaration.id) { | ||
let start: number = | ||
node.declaration.decorators && node.declaration.decorators.length > 0 | ||
? node.declaration.decorators[ | ||
node.declaration.decorators.length - 1 | ||
].end! | ||
: node.start! | ||
s.overwrite(start, node.declaration.id.start!, ` class `) | ||
s.append(`\nconst ${as} = ${node.declaration.id.name}`) | ||
@@ -49,0 +55,0 @@ } else { |
@@ -401,2 +401,15 @@ import { BindingTypes } from '../src/types' | ||
test('imported ref as template ref', () => { | ||
const { content } = compile(` | ||
<script setup lang="ts"> | ||
import { aref } from './x' | ||
</script> | ||
<template> | ||
<div ref="aref"></div> | ||
</template> | ||
`) | ||
expect(content).toMatch(`return { aref }`) | ||
assertCode(content) | ||
}) | ||
test('vue interpolations', () => { | ||
@@ -403,0 +416,0 @@ const { content } = compile(` |
@@ -34,12 +34,12 @@ import { prefixIdentifiers } from '../src/prefixIdentifiers' | ||
return _c( | ||
\\"div\\", | ||
{ attrs: { id: \\"app\\" } }, | ||
"div", | ||
{ attrs: { id: "app" } }, | ||
[ | ||
_c(\\"div\\", { style: { color: _vm.color } }, [_vm._v(_vm._s(_vm.foo))]), | ||
_vm._v(\\" \\"), | ||
_c("div", { style: { color: _vm.color } }, [_vm._v(_vm._s(_vm.foo))]), | ||
_vm._v(" "), | ||
_vm._l(_vm.list, function (i) { | ||
return _c(\\"p\\", [_vm._v(_vm._s(i))]) | ||
return _c("p", [_vm._v(_vm._s(i))]) | ||
}), | ||
_vm._v(\\" \\"), | ||
_c(\\"foo\\", { | ||
_vm._v(" "), | ||
_c("foo", { | ||
inlineTemplate: { | ||
@@ -49,3 +49,3 @@ render: function () { | ||
_c = _vm._self._c | ||
return _c(\\"div\\", [_vm._v(_vm._s(_vm.bar))]) | ||
return _c("div", [_vm._v(_vm._s(_vm.bar))]) | ||
}, | ||
@@ -86,6 +86,6 @@ staticRenderFns: [], | ||
return _c( | ||
\\"div\\", | ||
"div", | ||
{ | ||
on: { | ||
click: function (\$event) { | ||
click: function ($event) { | ||
_setup.count++ | ||
@@ -92,0 +92,0 @@ }, |
@@ -193,3 +193,3 @@ import { rewriteDefault } from '../src' | ||
export default class Foo {}*/ | ||
class Bar {} | ||
class Bar {} | ||
const script = Bar" | ||
@@ -210,3 +210,6 @@ `) | ||
expect( | ||
rewriteDefault(`// export default\n@Component\nexport default class Foo {}`, 'script') | ||
rewriteDefault( | ||
`// export default\n@Component\nexport default class Foo {}`, | ||
'script' | ||
) | ||
).toMatchInlineSnapshot(` | ||
@@ -236,3 +239,4 @@ "// export default | ||
rewriteDefault( | ||
`/*\n@Component\nexport default class Foo {}*/\n` + `export default class Bar {}`, | ||
`/*\n@Component\nexport default class Foo {}*/\n` + | ||
`export default class Bar {}`, | ||
'script' | ||
@@ -244,6 +248,68 @@ ) | ||
export default class Foo {}*/ | ||
class Bar {} | ||
class Bar {} | ||
const script = Bar" | ||
`) | ||
}) | ||
// #13060 | ||
test('@Component\nexport default class w/ comments 4', async () => { | ||
expect( | ||
rewriteDefault( | ||
`@Component | ||
export default class App extends Vue { | ||
/* default <- This word means my component is not built correctly */ | ||
@Prop({ type: String, required: true }) | ||
protected someString: string; | ||
}`, | ||
'script' | ||
) | ||
).toMatchInlineSnapshot(` | ||
"@Component | ||
class App extends Vue { | ||
/* default <- This word means my component is not built correctly */ | ||
@Prop({ type: String, required: true }) | ||
protected someString: string; | ||
} | ||
const script = App" | ||
`) | ||
}) | ||
// #12892 | ||
test('@Component\nexport default class w/ comments 5', async () => { | ||
expect( | ||
rewriteDefault( | ||
`@Component({}) | ||
export default class HelloWorld extends Vue { | ||
test = ""; | ||
mounted() { | ||
console.log("mounted!"); | ||
this.test = "Hallo Welt!"; | ||
} | ||
exportieren(): void { | ||
// do nothing | ||
} | ||
defaultWert(): void { | ||
// do nothing | ||
} | ||
}`, | ||
'script', | ||
['typescript', 'decorators-legacy'] | ||
) | ||
).toMatchInlineSnapshot(` | ||
"@Component({}) class HelloWorld extends Vue { | ||
test = ""; | ||
mounted() { | ||
console.log("mounted!"); | ||
this.test = "Hallo Welt!"; | ||
} | ||
exportieren(): void { | ||
// do nothing | ||
} | ||
defaultWert(): void { | ||
// do nothing | ||
} | ||
} | ||
const script = HelloWorld" | ||
`) | ||
}) | ||
}) |
@@ -32,3 +32,3 @@ <p align="center"><a href="https://vuejs.org" target="_blank" rel="noopener noreferrer"><img width="100" src="https://vuejs.org/images/logo.png" alt="Vue logo"></a></p> | ||
<a target="_blank" href="https://vuejs.org/sponsor/"> | ||
<img alt="sponsors" src="https://sponsors.vuejs.org/sponsors.svg?v2"> | ||
<img alt="sponsors" src="https://sponsors.vuejs.org/sponsors.svg?v3"> | ||
</a> | ||
@@ -35,0 +35,0 @@ </p> |
@@ -36,6 +36,11 @@ import { isRegExp, isArray, remove } from 'shared/util' | ||
function pruneCache( | ||
keepAliveInstance: { cache: CacheEntryMap; keys: string[]; _vnode: VNode }, | ||
keepAliveInstance: { | ||
cache: CacheEntryMap | ||
keys: string[] | ||
_vnode: VNode | ||
$vnode: VNode | ||
}, | ||
filter: Function | ||
) { | ||
const { cache, keys, _vnode } = keepAliveInstance | ||
const { cache, keys, _vnode, $vnode } = keepAliveInstance | ||
for (const key in cache) { | ||
@@ -50,2 +55,3 @@ const entry = cache[key] | ||
} | ||
$vnode.componentOptions!.children = undefined | ||
} | ||
@@ -52,0 +58,0 @@ |
@@ -98,15 +98,21 @@ import config from '../config' | ||
} | ||
defineReactive(props, key, value, () => { | ||
if (!isRoot && !isUpdatingChildComponent) { | ||
warn( | ||
`Avoid mutating a prop directly since the value will be ` + | ||
`overwritten whenever the parent component re-renders. ` + | ||
`Instead, use a data or computed property based on the prop's ` + | ||
`value. Prop being mutated: "${key}"`, | ||
vm | ||
) | ||
} | ||
}) | ||
defineReactive( | ||
props, | ||
key, | ||
value, | ||
() => { | ||
if (!isRoot && !isUpdatingChildComponent) { | ||
warn( | ||
`Avoid mutating a prop directly since the value will be ` + | ||
`overwritten whenever the parent component re-renders. ` + | ||
`Instead, use a data or computed property based on the prop's ` + | ||
`value. Prop being mutated: "${key}"`, | ||
vm | ||
) | ||
} | ||
}, | ||
true /* shallow */ | ||
) | ||
} else { | ||
defineReactive(props, key, value) | ||
defineReactive(props, key, value, undefined, true /* shallow */) | ||
} | ||
@@ -113,0 +119,0 @@ // static props are already proxied on the component's prototype |
@@ -134,3 +134,4 @@ import Dep from './dep' | ||
shallow?: boolean, | ||
mock?: boolean | ||
mock?: boolean, | ||
observeEvenIfShallow = false | ||
) { | ||
@@ -154,3 +155,3 @@ const dep = new Dep() | ||
let childOb = !shallow && observe(val, false, mock) | ||
let childOb = shallow ? val && val.__ob__ : observe(val, false, mock) | ||
Object.defineProperty(obj, key, { | ||
@@ -199,3 +200,3 @@ enumerable: true, | ||
} | ||
childOb = !shallow && observe(newVal, false, mock) | ||
childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock) | ||
if (__DEV__) { | ||
@@ -202,0 +203,0 @@ dep.notify({ |
@@ -94,6 +94,4 @@ import { getStyle, normalizeStyleBinding } from 'web/util/style' | ||
cur = newStyle[name] | ||
if (cur !== oldStyle[name]) { | ||
// ie9 setting to null has no effect, must use empty string | ||
setProp(el, name, cur == null ? '' : cur) | ||
} | ||
// ie9 setting to null has no effect, must use empty string | ||
setProp(el, name, cur == null ? '' : cur) | ||
} | ||
@@ -100,0 +98,0 @@ } |
@@ -93,6 +93,14 @@ export const emptyObject: Record<string, any> = Object.freeze({}) | ||
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) | ||
? JSON.stringify(val, null, 2) | ||
? JSON.stringify(val, replacer, 2) | ||
: String(val) | ||
} | ||
function replacer(_key: string, val: any): any { | ||
// avoid circular deps from v3 | ||
if (val && val.__v_isRef) { | ||
return val.value | ||
} | ||
return val | ||
} | ||
/** | ||
@@ -99,0 +107,0 @@ * Convert an input value to a number for persistence. |
@@ -188,4 +188,7 @@ import { isRef, Ref } from './reactivity/ref' | ||
const instance = currentInstance | ||
const call = (fn: Function, type: string, args: any[] | null = null) => | ||
invokeWithErrorHandling(fn, null, args, instance, type) | ||
const call = (fn: Function, type: string, args: any[] | null = null) => { | ||
const res = invokeWithErrorHandling(fn, null, args, instance, type) | ||
if (deep && res && res.__ob__) res.__ob__.dep.depend() | ||
return res | ||
} | ||
@@ -213,2 +216,3 @@ let getter: () => any | ||
} else if (isReactive(s)) { | ||
s.__ob__.dep.depend() | ||
return traverse(s) | ||
@@ -215,0 +219,0 @@ } else if (isFunction(s)) { |
@@ -43,5 +43,3 @@ import { defineReactive } from 'core/observer/index' | ||
export function ref<T extends object>( | ||
value: T | ||
): [T] extends [Ref] ? T : Ref<UnwrapRef<T>> | ||
export function ref<T extends Ref>(value: T): T | ||
export function ref<T>(value: T): Ref<UnwrapRef<T>> | ||
@@ -57,5 +55,4 @@ export function ref<T = any>(): Ref<T | undefined> | ||
export function shallowRef<T extends object>( | ||
value: T | ||
): T extends Ref ? T : ShallowRef<T> | ||
export function shallowRef<T>(value: T | Ref<T>): Ref<T> | ShallowRef<T> | ||
export function shallowRef<T extends Ref>(value: T): T | ||
export function shallowRef<T>(value: T): ShallowRef<T> | ||
@@ -62,0 +59,0 @@ export function shallowRef<T = any>(): ShallowRef<T | undefined> |
@@ -74,1 +74,3 @@ import { Vue } from './vue' | ||
} from './v3-directive' | ||
export * from './built-in-components' |
@@ -234,3 +234,3 @@ declare type ASTModifiers = { | ||
export declare function ref<T extends object>(value: T): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>; | ||
export declare function ref<T extends Ref>(value: T): T; | ||
@@ -304,4 +304,6 @@ export declare function ref<T>(value: T): Ref<UnwrapRef<T>>; | ||
export declare function shallowRef<T extends object>(value: T): T extends Ref ? T : ShallowRef<T>; | ||
export declare function shallowRef<T>(value: T | Ref<T>): Ref<T> | ShallowRef<T>; | ||
export declare function shallowRef<T extends Ref>(value: T): T; | ||
export declare function shallowRef<T>(value: T): ShallowRef<T>; | ||
@@ -308,0 +310,0 @@ |
@@ -25,2 +25,3 @@ import { StyleValue } from './jsx' | ||
| boolean | ||
| number | ||
| null | ||
@@ -41,2 +42,3 @@ | undefined | ||
| boolean | ||
| number | ||
| null | ||
@@ -43,0 +45,0 @@ | undefined |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4510933
228
115459
1
+ Added@vue/compiler-sfc@2.7.16-beta.1(transitive)
+ Addedprettier@2.8.8(transitive)
- Removed@vue/compiler-sfc@2.7.15(transitive)