chore: run updated prettier
This commit is contained in:
parent
69344ff1ae
commit
47f488350c
@ -61,11 +61,7 @@ describe('compiler: codegen', () => {
|
|||||||
})
|
})
|
||||||
const { code } = generate(root, { mode: 'module' })
|
const { code } = generate(root, { mode: 'module' })
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`import { ${helperNameMap[CREATE_VNODE]} as _${
|
`import { ${helperNameMap[CREATE_VNODE]} as _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]} as _${helperNameMap[RESOLVE_DIRECTIVE]} } from "vue"`
|
||||||
helperNameMap[CREATE_VNODE]
|
|
||||||
}, ${helperNameMap[RESOLVE_DIRECTIVE]} as _${
|
|
||||||
helperNameMap[RESOLVE_DIRECTIVE]
|
|
||||||
} } from "vue"`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatchSnapshot()
|
expect(code).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
@ -76,16 +72,10 @@ describe('compiler: codegen', () => {
|
|||||||
})
|
})
|
||||||
const { code } = generate(root, { mode: 'module', optimizeImports: true })
|
const { code } = generate(root, { mode: 'module', optimizeImports: true })
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`import { ${helperNameMap[CREATE_VNODE]}, ${
|
`import { ${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]} } from "vue"`
|
||||||
helperNameMap[RESOLVE_DIRECTIVE]
|
|
||||||
} } from "vue"`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const _${helperNameMap[CREATE_VNODE]} = ${
|
`const _${helperNameMap[CREATE_VNODE]} = ${helperNameMap[CREATE_VNODE]}, _${helperNameMap[RESOLVE_DIRECTIVE]} = ${helperNameMap[RESOLVE_DIRECTIVE]}`
|
||||||
helperNameMap[CREATE_VNODE]
|
|
||||||
}, _${helperNameMap[RESOLVE_DIRECTIVE]} = ${
|
|
||||||
helperNameMap[RESOLVE_DIRECTIVE]
|
|
||||||
}`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatchSnapshot()
|
expect(code).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
@ -97,11 +87,7 @@ describe('compiler: codegen', () => {
|
|||||||
const { code } = generate(root, { mode: 'function' })
|
const { code } = generate(root, { mode: 'function' })
|
||||||
expect(code).toMatch(`const _Vue = Vue`)
|
expect(code).toMatch(`const _Vue = Vue`)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const { ${helperNameMap[CREATE_VNODE]}: _${
|
`const { ${helperNameMap[CREATE_VNODE]}: _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${helperNameMap[RESOLVE_DIRECTIVE]} } = _Vue`
|
||||||
helperNameMap[CREATE_VNODE]
|
|
||||||
}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${
|
|
||||||
helperNameMap[RESOLVE_DIRECTIVE]
|
|
||||||
} } = _Vue`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatchSnapshot()
|
expect(code).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
@ -116,11 +102,7 @@ describe('compiler: codegen', () => {
|
|||||||
})
|
})
|
||||||
expect(code).not.toMatch(`const _Vue = Vue`)
|
expect(code).not.toMatch(`const _Vue = Vue`)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const { ${helperNameMap[CREATE_VNODE]}: _${
|
`const { ${helperNameMap[CREATE_VNODE]}: _${helperNameMap[CREATE_VNODE]}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${helperNameMap[RESOLVE_DIRECTIVE]} } = Vue`
|
||||||
helperNameMap[CREATE_VNODE]
|
|
||||||
}, ${helperNameMap[RESOLVE_DIRECTIVE]}: _${
|
|
||||||
helperNameMap[RESOLVE_DIRECTIVE]
|
|
||||||
} } = Vue`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatchSnapshot()
|
expect(code).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
@ -136,30 +118,20 @@ describe('compiler: codegen', () => {
|
|||||||
`const _component_Foo = _${helperNameMap[RESOLVE_COMPONENT]}("Foo")\n`
|
`const _component_Foo = _${helperNameMap[RESOLVE_COMPONENT]}("Foo")\n`
|
||||||
)
|
)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const _component_bar_baz = _${
|
`const _component_bar_baz = _${helperNameMap[RESOLVE_COMPONENT]}("bar-baz")\n`
|
||||||
helperNameMap[RESOLVE_COMPONENT]
|
|
||||||
}("bar-baz")\n`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const _component_barbaz = _${
|
`const _component_barbaz = _${helperNameMap[RESOLVE_COMPONENT]}("barbaz")\n`
|
||||||
helperNameMap[RESOLVE_COMPONENT]
|
|
||||||
}("barbaz")\n`
|
|
||||||
)
|
)
|
||||||
// implicit self reference from SFC filename
|
// implicit self reference from SFC filename
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const _component_Qux = _${
|
`const _component_Qux = _${helperNameMap[RESOLVE_COMPONENT]}("Qux", true)\n`
|
||||||
helperNameMap[RESOLVE_COMPONENT]
|
|
||||||
}("Qux", true)\n`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const _directive_my_dir_0 = _${
|
`const _directive_my_dir_0 = _${helperNameMap[RESOLVE_DIRECTIVE]}("my_dir_0")\n`
|
||||||
helperNameMap[RESOLVE_DIRECTIVE]
|
|
||||||
}("my_dir_0")\n`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`const _directive_my_dir_1 = _${
|
`const _directive_my_dir_1 = _${helperNameMap[RESOLVE_DIRECTIVE]}("my_dir_1")\n`
|
||||||
helperNameMap[RESOLVE_DIRECTIVE]
|
|
||||||
}("my_dir_1")\n`
|
|
||||||
)
|
)
|
||||||
expect(code).toMatch(`let _temp0, _temp1, _temp2`)
|
expect(code).toMatch(`let _temp0, _temp1, _temp2`)
|
||||||
expect(code).toMatchSnapshot()
|
expect(code).toMatchSnapshot()
|
||||||
|
@ -2871,7 +2871,7 @@ foo
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(patterns) as (keyof (typeof patterns))[]) {
|
for (const key of Object.keys(patterns) as (keyof typeof patterns)[]) {
|
||||||
describe(key, () => {
|
describe(key, () => {
|
||||||
for (const { code, errors, options } of patterns[key]) {
|
for (const { code, errors, options } of patterns[key]) {
|
||||||
test(
|
test(
|
||||||
|
@ -355,8 +355,9 @@ describe('compiler: hoistStatic transform', () => {
|
|||||||
},
|
},
|
||||||
hoistedChildrenArrayMatcher(2)
|
hoistedChildrenArrayMatcher(2)
|
||||||
])
|
])
|
||||||
const forBlockCodegen = ((root.children[0] as ElementNode)
|
const forBlockCodegen = (
|
||||||
.children[0] as ForNode).codegenNode
|
(root.children[0] as ElementNode).children[0] as ForNode
|
||||||
|
).codegenNode
|
||||||
expect(forBlockCodegen).toMatchObject({
|
expect(forBlockCodegen).toMatchObject({
|
||||||
type: NodeTypes.VNODE_CALL,
|
type: NodeTypes.VNODE_CALL,
|
||||||
tag: FRAGMENT,
|
tag: FRAGMENT,
|
||||||
|
@ -290,8 +290,8 @@ describe('compiler: transform v-model', () => {
|
|||||||
test('with dynamic argument', () => {
|
test('with dynamic argument', () => {
|
||||||
const root = parseWithVModel('<input v-model:[value]="model" />')
|
const root = parseWithVModel('<input v-model:[value]="model" />')
|
||||||
const node = root.children[0] as ElementNode
|
const node = root.children[0] as ElementNode
|
||||||
const props = ((node.codegenNode as VNodeCall)
|
const props = (node.codegenNode as VNodeCall)
|
||||||
.props as unknown) as CallExpression
|
.props as unknown as CallExpression
|
||||||
|
|
||||||
expect(props).toMatchObject({
|
expect(props).toMatchObject({
|
||||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||||
@ -344,8 +344,8 @@ describe('compiler: transform v-model', () => {
|
|||||||
prefixIdentifiers: true
|
prefixIdentifiers: true
|
||||||
})
|
})
|
||||||
const node = root.children[0] as ElementNode
|
const node = root.children[0] as ElementNode
|
||||||
const props = ((node.codegenNode as VNodeCall)
|
const props = (node.codegenNode as VNodeCall)
|
||||||
.props as unknown) as CallExpression
|
.props as unknown as CallExpression
|
||||||
|
|
||||||
expect(props).toMatchObject({
|
expect(props).toMatchObject({
|
||||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||||
@ -417,8 +417,9 @@ describe('compiler: transform v-model', () => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
expect(root.cached).toBe(0)
|
expect(root.cached).toBe(0)
|
||||||
const codegen = ((root.children[0] as ForNode)
|
const codegen = (
|
||||||
.children[0] as PlainElementNode).codegenNode as VNodeCall
|
(root.children[0] as ForNode).children[0] as PlainElementNode
|
||||||
|
).codegenNode as VNodeCall
|
||||||
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
|
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
|
||||||
expect(
|
expect(
|
||||||
(codegen.props as ObjectExpression).properties[1].value.type
|
(codegen.props as ObjectExpression).properties[1].value.type
|
||||||
@ -426,13 +427,10 @@ describe('compiler: transform v-model', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should not cache update handler if it inside v-once', () => {
|
test('should not cache update handler if it inside v-once', () => {
|
||||||
const root = parseWithVModel(
|
const root = parseWithVModel('<div v-once><input v-model="foo" /></div>', {
|
||||||
'<div v-once><input v-model="foo" /></div>',
|
|
||||||
{
|
|
||||||
prefixIdentifiers: true,
|
prefixIdentifiers: true,
|
||||||
cacheHandlers: true
|
cacheHandlers: true
|
||||||
}
|
})
|
||||||
)
|
|
||||||
expect(root.cached).not.toBe(2)
|
expect(root.cached).not.toBe(2)
|
||||||
expect(root.cached).toBe(1)
|
expect(root.cached).toBe(1)
|
||||||
})
|
})
|
||||||
@ -444,8 +442,9 @@ describe('compiler: transform v-model', () => {
|
|||||||
prefixIdentifiers: true
|
prefixIdentifiers: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
const codegen = ((root.children[0] as ComponentNode)
|
const codegen = (
|
||||||
.children[0] as PlainElementNode).codegenNode as VNodeCall
|
(root.children[0] as ComponentNode).children[0] as PlainElementNode
|
||||||
|
).codegenNode as VNodeCall
|
||||||
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
|
expect(codegen.dynamicProps).toBe(`["modelValue", "onUpdate:modelValue"]`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -531,10 +531,13 @@ describe('compiler: transform v-on', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should not be cached inside v-once', () => {
|
test('should not be cached inside v-once', () => {
|
||||||
const { root } = parseWithVOn(`<div v-once><div v-on:click="foo"/></div>`, {
|
const { root } = parseWithVOn(
|
||||||
|
`<div v-once><div v-on:click="foo"/></div>`,
|
||||||
|
{
|
||||||
prefixIdentifiers: true,
|
prefixIdentifiers: true,
|
||||||
cacheHandlers: true
|
cacheHandlers: true
|
||||||
})
|
}
|
||||||
|
)
|
||||||
expect(root.cached).not.toBe(2)
|
expect(root.cached).not.toBe(2)
|
||||||
expect(root.cached).toBe(1)
|
expect(root.cached).toBe(1)
|
||||||
})
|
})
|
||||||
|
@ -237,7 +237,8 @@ export interface CompoundExpressionNode extends Node {
|
|||||||
| InterpolationNode
|
| InterpolationNode
|
||||||
| TextNode
|
| TextNode
|
||||||
| string
|
| string
|
||||||
| symbol)[]
|
| symbol
|
||||||
|
)[]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* an expression parsed as the params of a function will track
|
* an expression parsed as the params of a function will track
|
||||||
@ -328,7 +329,8 @@ export interface CallExpression extends Node {
|
|||||||
| JSChildNode
|
| JSChildNode
|
||||||
| SSRCodegenNode
|
| SSRCodegenNode
|
||||||
| TemplateChildNode
|
| TemplateChildNode
|
||||||
| TemplateChildNode[])[]
|
| TemplateChildNode[]
|
||||||
|
)[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ObjectExpression extends Node {
|
export interface ObjectExpression extends Node {
|
||||||
|
@ -83,9 +83,8 @@ export function baseCompile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ast = isString(template) ? baseParse(template, options) : template
|
const ast = isString(template) ? baseParse(template, options) : template
|
||||||
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(
|
const [nodeTransforms, directiveTransforms] =
|
||||||
prefixIdentifiers
|
getBaseTransformPreset(prefixIdentifiers)
|
||||||
)
|
|
||||||
transform(
|
transform(
|
||||||
ast,
|
ast,
|
||||||
extend({}, options, {
|
extend({}, options, {
|
||||||
|
@ -774,7 +774,8 @@ function parseAttribute(
|
|||||||
const loc = getSelection(context, start)
|
const loc = getSelection(context, start)
|
||||||
|
|
||||||
if (!context.inVPre && /^(v-|:|\.|@|#)/.test(name)) {
|
if (!context.inVPre && /^(v-|:|\.|@|#)/.test(name)) {
|
||||||
const match = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
|
const match =
|
||||||
|
/(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
|
||||||
name
|
name
|
||||||
)!
|
)!
|
||||||
|
|
||||||
|
@ -221,11 +221,13 @@ export const transformFor = createStructuralDirectiveTransform(
|
|||||||
createSimpleExpression(String(context.cached++))
|
createSimpleExpression(String(context.cached++))
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
renderExp.arguments.push(createFunctionExpression(
|
renderExp.arguments.push(
|
||||||
|
createFunctionExpression(
|
||||||
createForLoopParams(forNode.parseResult),
|
createForLoopParams(forNode.parseResult),
|
||||||
childBlock,
|
childBlock,
|
||||||
true /* force newline */
|
true /* force newline */
|
||||||
) as ForIteratorExpression)
|
) as ForIteratorExpression
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -343,9 +345,7 @@ export function parseForExpression(
|
|||||||
validateBrowserExpression(result.source as SimpleExpressionNode, context)
|
validateBrowserExpression(result.source as SimpleExpressionNode, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
let valueContent = LHS.trim()
|
let valueContent = LHS.trim().replace(stripParensRE, '').trim()
|
||||||
.replace(stripParensRE, '')
|
|
||||||
.trim()
|
|
||||||
const trimmedOffset = LHS.indexOf(valueContent)
|
const trimmedOffset = LHS.indexOf(valueContent)
|
||||||
|
|
||||||
const iteratorMatch = valueContent.match(forIteratorRE)
|
const iteratorMatch = valueContent.match(forIteratorRE)
|
||||||
|
@ -319,8 +319,8 @@ function isSameKey(
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
exp.type !== NodeTypes.SIMPLE_EXPRESSION ||
|
exp.type !== NodeTypes.SIMPLE_EXPRESSION ||
|
||||||
(exp.isStatic !== (branchExp as SimpleExpressionNode).isStatic ||
|
exp.isStatic !== (branchExp as SimpleExpressionNode).isStatic ||
|
||||||
exp.content !== (branchExp as SimpleExpressionNode).content)
|
exp.content !== (branchExp as SimpleExpressionNode).content
|
||||||
) {
|
) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,8 @@ const prohibitedKeywordRE = new RegExp(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// strip strings in expressions
|
// strip strings in expressions
|
||||||
const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
|
const stripStringRE =
|
||||||
|
/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a non-prefixed expression.
|
* Validate a non-prefixed expression.
|
||||||
@ -51,9 +52,7 @@ export function validateBrowserExpression(
|
|||||||
.replace(stripStringRE, '')
|
.replace(stripStringRE, '')
|
||||||
.match(prohibitedKeywordRE)
|
.match(prohibitedKeywordRE)
|
||||||
if (keywordMatch) {
|
if (keywordMatch) {
|
||||||
message = `avoid using JavaScript keyword as property name: "${
|
message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`
|
||||||
keywordMatch[0]
|
|
||||||
}"`
|
|
||||||
}
|
}
|
||||||
context.onError(
|
context.onError(
|
||||||
createCompilerError(
|
createCompilerError(
|
||||||
|
@ -27,8 +27,10 @@ function parseWithVOn(template: string, options: CompilerOptions = {}) {
|
|||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
root: ast,
|
root: ast,
|
||||||
props: (((ast.children[0] as ElementNode).codegenNode as VNodeCall)
|
props: (
|
||||||
.props as ObjectExpression).properties
|
((ast.children[0] as ElementNode).codegenNode as VNodeCall)
|
||||||
|
.props as ObjectExpression
|
||||||
|
).properties
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,11 +112,8 @@ export const transformOn: DirectiveTransform = (dir, node, context) => {
|
|||||||
if (!modifiers.length) return baseResult
|
if (!modifiers.length) return baseResult
|
||||||
|
|
||||||
let { key, value: handlerExp } = baseResult.props[0]
|
let { key, value: handlerExp } = baseResult.props[0]
|
||||||
const {
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } =
|
||||||
keyModifiers,
|
resolveModifiers(key, modifiers, context, dir.loc)
|
||||||
nonKeyModifiers,
|
|
||||||
eventOptionModifiers
|
|
||||||
} = resolveModifiers(key, modifiers, context, dir.loc)
|
|
||||||
|
|
||||||
// normalize click.right and click.middle since they don't actually fire
|
// normalize click.right and click.middle since they don't actually fire
|
||||||
if (nonKeyModifiers.includes('right')) {
|
if (nonKeyModifiers.includes('right')) {
|
||||||
|
@ -678,7 +678,9 @@ export function compileScript(
|
|||||||
.map(key => {
|
.map(key => {
|
||||||
let defaultString: string | undefined
|
let defaultString: string | undefined
|
||||||
if (hasStaticDefaults) {
|
if (hasStaticDefaults) {
|
||||||
const prop = (propsRuntimeDefaults as ObjectExpression).properties.find(
|
const prop = (
|
||||||
|
propsRuntimeDefaults as ObjectExpression
|
||||||
|
).properties.find(
|
||||||
(node: any) => node.key.name === key
|
(node: any) => node.key.name === key
|
||||||
) as ObjectProperty
|
) as ObjectProperty
|
||||||
if (prop) {
|
if (prop) {
|
||||||
@ -776,9 +778,7 @@ export function compileScript(
|
|||||||
// rewrite to `import { x as __default__ } from './x'` and
|
// rewrite to `import { x as __default__ } from './x'` and
|
||||||
// add to top
|
// add to top
|
||||||
s.prepend(
|
s.prepend(
|
||||||
`import { ${
|
`import { ${defaultSpecifier.local.name} as ${defaultTempVar} } from '${node.source.value}'\n`
|
||||||
defaultSpecifier.local.name
|
|
||||||
} as ${defaultTempVar} } from '${node.source.value}'\n`
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// export { x as default }
|
// export { x as default }
|
||||||
@ -1376,11 +1376,11 @@ export function compileScript(
|
|||||||
...scriptSetup,
|
...scriptSetup,
|
||||||
bindings: bindingMetadata,
|
bindings: bindingMetadata,
|
||||||
content: s.toString(),
|
content: s.toString(),
|
||||||
map: (s.generateMap({
|
map: s.generateMap({
|
||||||
source: filename,
|
source: filename,
|
||||||
hires: true,
|
hires: true,
|
||||||
includeContent: true
|
includeContent: true
|
||||||
}) as unknown) as RawSourceMap,
|
}) as unknown as RawSourceMap,
|
||||||
scriptAst,
|
scriptAst,
|
||||||
scriptSetupAst
|
scriptSetupAst
|
||||||
}
|
}
|
||||||
@ -1651,9 +1651,9 @@ function inferRuntimeType(
|
|||||||
case 'TSUnionType':
|
case 'TSUnionType':
|
||||||
return [
|
return [
|
||||||
...new Set(
|
...new Set(
|
||||||
[].concat(node.types.map(t =>
|
[].concat(
|
||||||
inferRuntimeType(t, declaredTypes)
|
node.types.map(t => inferRuntimeType(t, declaredTypes)) as any
|
||||||
) as any)
|
)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
case 'TSIntersectionType':
|
case 'TSIntersectionType':
|
||||||
|
@ -79,9 +79,10 @@ export function compileStyle(
|
|||||||
export function compileStyleAsync(
|
export function compileStyleAsync(
|
||||||
options: SFCAsyncStyleCompileOptions
|
options: SFCAsyncStyleCompileOptions
|
||||||
): Promise<SFCStyleCompileResults> {
|
): Promise<SFCStyleCompileResults> {
|
||||||
return doCompileStyle({ ...options, isAsync: true }) as Promise<
|
return doCompileStyle({
|
||||||
SFCStyleCompileResults
|
...options,
|
||||||
>
|
isAsync: true
|
||||||
|
}) as Promise<SFCStyleCompileResults>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doCompileStyle(
|
export function doCompileStyle(
|
||||||
|
@ -140,14 +140,10 @@ export function compileTemplate(
|
|||||||
code: `export default function render() {}`,
|
code: `export default function render() {}`,
|
||||||
source: options.source,
|
source: options.source,
|
||||||
tips: [
|
tips: [
|
||||||
`Component ${
|
`Component ${options.filename} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
|
||||||
options.filename
|
|
||||||
} uses lang ${preprocessLang} for template. Please install the language preprocessor.`
|
|
||||||
],
|
],
|
||||||
errors: [
|
errors: [
|
||||||
`Component ${
|
`Component ${options.filename} uses lang ${preprocessLang} for template, however it is not installed.`
|
||||||
options.filename
|
|
||||||
} uses lang ${preprocessLang} for template, however it is not installed.`
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -12,7 +12,8 @@ import { PluginCreator } from 'postcss'
|
|||||||
import hash from 'hash-sum'
|
import hash from 'hash-sum'
|
||||||
|
|
||||||
export const CSS_VARS_HELPER = `useCssVars`
|
export const CSS_VARS_HELPER = `useCssVars`
|
||||||
export const cssVarRE = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g
|
export const cssVarRE =
|
||||||
|
/\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g
|
||||||
|
|
||||||
export function genCssVarsFromList(
|
export function genCssVarsFromList(
|
||||||
vars: string[],
|
vars: string[],
|
||||||
|
@ -3,7 +3,8 @@ import MagicString from 'magic-string'
|
|||||||
|
|
||||||
const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/
|
const defaultExportRE = /((?:^|\n|;)\s*)export(\s*)default/
|
||||||
const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)as(\s*)default/s
|
const namedDefaultExportRE = /((?:^|\n|;)\s*)export(.+)as(\s*)default/s
|
||||||
const exportDefaultClassRE = /((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/
|
const exportDefaultClassRE =
|
||||||
|
/((?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility for rewriting `export default` in a script block into a variable
|
* Utility for rewriting `export default` in a script block into a variable
|
||||||
|
@ -71,9 +71,10 @@ describe('ssr: element', () => {
|
|||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("multiple _ssrInterpolate at parent and child import dependency once", () => {
|
test('multiple _ssrInterpolate at parent and child import dependency once', () => {
|
||||||
expect( compile(`<div>{{ hello }}<textarea v-bind="a"></textarea></div>`).code)
|
expect(
|
||||||
.toMatchInlineSnapshot(`
|
compile(`<div>{{ hello }}<textarea v-bind="a"></textarea></div>`).code
|
||||||
|
).toMatchInlineSnapshot(`
|
||||||
"const { ssrRenderAttrs: _ssrRenderAttrs, ssrInterpolate: _ssrInterpolate } = require(\\"@vue/server-renderer\\")
|
"const { ssrRenderAttrs: _ssrRenderAttrs, ssrInterpolate: _ssrInterpolate } = require(\\"@vue/server-renderer\\")
|
||||||
|
|
||||||
return function ssrRender(_ctx, _push, _parent, _attrs) {
|
return function ssrRender(_ctx, _push, _parent, _attrs) {
|
||||||
@ -89,8 +90,8 @@ describe('ssr: element', () => {
|
|||||||
_ssrInterpolate((\\"value\\" in _temp0) ? _temp0.value : \\"\\")
|
_ssrInterpolate((\\"value\\" in _temp0) ? _temp0.value : \\"\\")
|
||||||
}</textarea></div>\`)
|
}</textarea></div>\`)
|
||||||
}"
|
}"
|
||||||
`);
|
`)
|
||||||
});
|
})
|
||||||
|
|
||||||
test('should pass tag to custom elements w/ dynamic v-bind', () => {
|
test('should pass tag to custom elements w/ dynamic v-bind', () => {
|
||||||
expect(
|
expect(
|
||||||
|
@ -56,10 +56,9 @@ export function ssrCodegenTransform(ast: RootNode, options: CompilerOptions) {
|
|||||||
|
|
||||||
// Finalize helpers.
|
// Finalize helpers.
|
||||||
// We need to separate helpers imported from 'vue' vs. '@vue/server-renderer'
|
// We need to separate helpers imported from 'vue' vs. '@vue/server-renderer'
|
||||||
ast.ssrHelpers = Array.from(new Set([
|
ast.ssrHelpers = Array.from(
|
||||||
...ast.helpers.filter(h => h in ssrHelpers),
|
new Set([...ast.helpers.filter(h => h in ssrHelpers), ...context.helpers])
|
||||||
...context.helpers
|
)
|
||||||
]))
|
|
||||||
|
|
||||||
ast.helpers = ast.helpers.filter(h => !(h in ssrHelpers))
|
ast.helpers = ast.helpers.filter(h => !(h in ssrHelpers))
|
||||||
}
|
}
|
||||||
|
@ -225,9 +225,8 @@ export function ssrProcessComponent(
|
|||||||
|
|
||||||
export const rawOptionsMap = new WeakMap<RootNode, CompilerOptions>()
|
export const rawOptionsMap = new WeakMap<RootNode, CompilerOptions>()
|
||||||
|
|
||||||
const [baseNodeTransforms, baseDirectiveTransforms] = getBaseTransformPreset(
|
const [baseNodeTransforms, baseDirectiveTransforms] =
|
||||||
true
|
getBaseTransformPreset(true)
|
||||||
)
|
|
||||||
const vnodeNodeTransforms = [...baseNodeTransforms, ...DOMNodeTransforms]
|
const vnodeNodeTransforms = [...baseNodeTransforms, ...DOMNodeTransforms]
|
||||||
const vnodeDirectiveTransforms = {
|
const vnodeDirectiveTransforms = {
|
||||||
...baseDirectiveTransforms,
|
...baseDirectiveTransforms,
|
||||||
|
4
packages/global.d.ts
vendored
4
packages/global.d.ts
vendored
@ -24,9 +24,7 @@ declare namespace jest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.vue' {
|
declare module '*.vue' {}
|
||||||
|
|
||||||
}
|
|
||||||
declare module '*?raw' {
|
declare module '*?raw' {
|
||||||
const content: string
|
const content: string
|
||||||
export default content
|
export default content
|
||||||
|
@ -422,7 +422,7 @@ describe('reactivity/collections', () => {
|
|||||||
const proxy = reactive(raw)
|
const proxy = reactive(raw)
|
||||||
const thisArg = {}
|
const thisArg = {}
|
||||||
let count = 0
|
let count = 0
|
||||||
proxy.forEach(function(this: {}, value, _, set) {
|
proxy.forEach(function (this: {}, value, _, set) {
|
||||||
++count
|
++count
|
||||||
expect(this).toBe(thisArg)
|
expect(this).toBe(thisArg)
|
||||||
expect(value).toBe('value')
|
expect(value).toBe('value')
|
||||||
|
@ -178,7 +178,10 @@ describe('reactivity/readonly', () => {
|
|||||||
test('should make nested values readonly', () => {
|
test('should make nested values readonly', () => {
|
||||||
const key1 = {}
|
const key1 = {}
|
||||||
const key2 = {}
|
const key2 = {}
|
||||||
const original = new Collection([[key1, {}], [key2, {}]])
|
const original = new Collection([
|
||||||
|
[key1, {}],
|
||||||
|
[key2, {}]
|
||||||
|
])
|
||||||
const wrapped = readonly(original)
|
const wrapped = readonly(original)
|
||||||
expect(wrapped).not.toBe(original)
|
expect(wrapped).not.toBe(original)
|
||||||
expect(isProxy(wrapped)).toBe(true)
|
expect(isProxy(wrapped)).toBe(true)
|
||||||
@ -228,7 +231,10 @@ describe('reactivity/readonly', () => {
|
|||||||
test('should retrieve readonly values on iteration', () => {
|
test('should retrieve readonly values on iteration', () => {
|
||||||
const key1 = {}
|
const key1 = {}
|
||||||
const key2 = {}
|
const key2 = {}
|
||||||
const original = new Map([[key1, {}], [key2, {}]])
|
const original = new Map([
|
||||||
|
[key1, {}],
|
||||||
|
[key2, {}]
|
||||||
|
])
|
||||||
const wrapped: any = readonly(original)
|
const wrapped: any = readonly(original)
|
||||||
expect(wrapped.size).toBe(2)
|
expect(wrapped.size).toBe(2)
|
||||||
for (const [key, value] of wrapped) {
|
for (const [key, value] of wrapped) {
|
||||||
@ -246,7 +252,12 @@ describe('reactivity/readonly', () => {
|
|||||||
test('should retrieve reactive + readonly values on iteration', () => {
|
test('should retrieve reactive + readonly values on iteration', () => {
|
||||||
const key1 = {}
|
const key1 = {}
|
||||||
const key2 = {}
|
const key2 = {}
|
||||||
const original = reactive(new Map([[key1, {}], [key2, {}]]))
|
const original = reactive(
|
||||||
|
new Map([
|
||||||
|
[key1, {}],
|
||||||
|
[key2, {}]
|
||||||
|
])
|
||||||
|
)
|
||||||
const wrapped: any = readonly(original)
|
const wrapped: any = readonly(original)
|
||||||
expect(wrapped.size).toBe(2)
|
expect(wrapped.size).toBe(2)
|
||||||
for (const [key, value] of wrapped) {
|
for (const [key, value] of wrapped) {
|
||||||
|
@ -49,7 +49,7 @@ function createArrayInstrumentations() {
|
|||||||
// instrument identity-sensitive Array methods to account for possible reactive
|
// instrument identity-sensitive Array methods to account for possible reactive
|
||||||
// values
|
// values
|
||||||
;(['includes', 'indexOf', 'lastIndexOf'] as const).forEach(key => {
|
;(['includes', 'indexOf', 'lastIndexOf'] as const).forEach(key => {
|
||||||
instrumentations[key] = function(this: unknown[], ...args: unknown[]) {
|
instrumentations[key] = function (this: unknown[], ...args: unknown[]) {
|
||||||
const arr = toRaw(this) as any
|
const arr = toRaw(this) as any
|
||||||
for (let i = 0, l = this.length; i < l; i++) {
|
for (let i = 0, l = this.length; i < l; i++) {
|
||||||
track(arr, TrackOpTypes.GET, i + '')
|
track(arr, TrackOpTypes.GET, i + '')
|
||||||
@ -67,7 +67,7 @@ function createArrayInstrumentations() {
|
|||||||
// instrument length-altering mutation methods to avoid length being tracked
|
// instrument length-altering mutation methods to avoid length being tracked
|
||||||
// which leads to infinite loops in some cases (#2137)
|
// which leads to infinite loops in some cases (#2137)
|
||||||
;(['push', 'pop', 'shift', 'unshift', 'splice'] as const).forEach(key => {
|
;(['push', 'pop', 'shift', 'unshift', 'splice'] as const).forEach(key => {
|
||||||
instrumentations[key] = function(this: unknown[], ...args: unknown[]) {
|
instrumentations[key] = function (this: unknown[], ...args: unknown[]) {
|
||||||
pauseTracking()
|
pauseTracking()
|
||||||
const res = (toRaw(this) as any)[key].apply(this, args)
|
const res = (toRaw(this) as any)[key].apply(this, args)
|
||||||
resetTracking()
|
resetTracking()
|
||||||
|
@ -184,7 +184,7 @@ function createIterableMethod(
|
|||||||
isReadonly: boolean,
|
isReadonly: boolean,
|
||||||
isShallow: boolean
|
isShallow: boolean
|
||||||
) {
|
) {
|
||||||
return function(
|
return function (
|
||||||
this: IterableCollections,
|
this: IterableCollections,
|
||||||
...args: unknown[]
|
...args: unknown[]
|
||||||
): Iterable & Iterator {
|
): Iterable & Iterator {
|
||||||
@ -224,7 +224,7 @@ function createIterableMethod(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createReadonlyMethod(type: TriggerOpTypes): Function {
|
function createReadonlyMethod(type: TriggerOpTypes): Function {
|
||||||
return function(this: CollectionTypes, ...args: unknown[]) {
|
return function (this: CollectionTypes, ...args: unknown[]) {
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
const key = args[0] ? `on key "${args[0]}" ` : ``
|
const key = args[0] ? `on key "${args[0]}" ` : ``
|
||||||
console.warn(
|
console.warn(
|
||||||
@ -242,7 +242,7 @@ function createInstrumentations() {
|
|||||||
return get(this, key)
|
return get(this, key)
|
||||||
},
|
},
|
||||||
get size() {
|
get size() {
|
||||||
return size((this as unknown) as IterableCollections)
|
return size(this as unknown as IterableCollections)
|
||||||
},
|
},
|
||||||
has,
|
has,
|
||||||
add,
|
add,
|
||||||
@ -257,7 +257,7 @@ function createInstrumentations() {
|
|||||||
return get(this, key, false, true)
|
return get(this, key, false, true)
|
||||||
},
|
},
|
||||||
get size() {
|
get size() {
|
||||||
return size((this as unknown) as IterableCollections)
|
return size(this as unknown as IterableCollections)
|
||||||
},
|
},
|
||||||
has,
|
has,
|
||||||
add,
|
add,
|
||||||
@ -272,7 +272,7 @@ function createInstrumentations() {
|
|||||||
return get(this, key, true)
|
return get(this, key, true)
|
||||||
},
|
},
|
||||||
get size() {
|
get size() {
|
||||||
return size((this as unknown) as IterableCollections, true)
|
return size(this as unknown as IterableCollections, true)
|
||||||
},
|
},
|
||||||
has(this: MapTypes, key: unknown) {
|
has(this: MapTypes, key: unknown) {
|
||||||
return has.call(this, key, true)
|
return has.call(this, key, true)
|
||||||
@ -289,7 +289,7 @@ function createInstrumentations() {
|
|||||||
return get(this, key, true, true)
|
return get(this, key, true, true)
|
||||||
},
|
},
|
||||||
get size() {
|
get size() {
|
||||||
return size((this as unknown) as IterableCollections, true)
|
return size(this as unknown as IterableCollections, true)
|
||||||
},
|
},
|
||||||
has(this: MapTypes, key: unknown) {
|
has(this: MapTypes, key: unknown) {
|
||||||
return has.call(this, key, true)
|
return has.call(this, key, true)
|
||||||
@ -384,11 +384,10 @@ export const readonlyCollectionHandlers: ProxyHandler<CollectionTypes> = {
|
|||||||
get: /*#__PURE__*/ createInstrumentationGetter(true, false)
|
get: /*#__PURE__*/ createInstrumentationGetter(true, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const shallowReadonlyCollectionHandlers: ProxyHandler<
|
export const shallowReadonlyCollectionHandlers: ProxyHandler<CollectionTypes> =
|
||||||
CollectionTypes
|
{
|
||||||
> = {
|
|
||||||
get: /*#__PURE__*/ createInstrumentationGetter(true, true)
|
get: /*#__PURE__*/ createInstrumentationGetter(true, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIdentityKeys(
|
function checkIdentityKeys(
|
||||||
target: CollectionTypes,
|
target: CollectionTypes,
|
||||||
|
@ -37,7 +37,7 @@ class ComputedRefImpl<T> {
|
|||||||
private _dirty = true
|
private _dirty = true
|
||||||
public readonly effect: ReactiveEffect<T>
|
public readonly effect: ReactiveEffect<T>
|
||||||
|
|
||||||
public readonly __v_isRef = true;
|
public readonly __v_isRef = true
|
||||||
public readonly [ReactiveFlags.IS_READONLY]: boolean
|
public readonly [ReactiveFlags.IS_READONLY]: boolean
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -259,7 +259,9 @@ export type ShallowUnwrapRef<T> = {
|
|||||||
[K in keyof T]: T[K] extends Ref<infer V>
|
[K in keyof T]: T[K] extends Ref<infer V>
|
||||||
? V
|
? V
|
||||||
: T[K] extends Ref<infer V> | undefined // if `V` is `unknown` that means it does not extend `Ref` and is undefined
|
: T[K] extends Ref<infer V> | undefined // if `V` is `unknown` that means it does not extend `Ref` and is undefined
|
||||||
? unknown extends V ? undefined : V | undefined
|
? unknown extends V
|
||||||
|
? undefined
|
||||||
|
: V | undefined
|
||||||
: T[K]
|
: T[K]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +278,9 @@ type UnwrapRefSimple<T> = T extends
|
|||||||
? T
|
? T
|
||||||
: T extends Array<any>
|
: T extends Array<any>
|
||||||
? { [K in keyof T]: UnwrapRefSimple<T[K]> }
|
? { [K in keyof T]: UnwrapRefSimple<T[K]> }
|
||||||
: T extends object ? UnwrappedObject<T> : T
|
: T extends object
|
||||||
|
? UnwrappedObject<T>
|
||||||
|
: T
|
||||||
|
|
||||||
// Extract all known symbols from an object
|
// Extract all known symbols from an object
|
||||||
// when unwrapping Object the symbols are not `in keyof`, this should cover all the
|
// when unwrapping Object the symbols are not `in keyof`, this should cover all the
|
||||||
|
@ -123,7 +123,8 @@ describe('SFC <script setup> helpers', () => {
|
|||||||
|
|
||||||
beforeInstance = getCurrentInstance()
|
beforeInstance = getCurrentInstance()
|
||||||
|
|
||||||
const msg = (([__temp, __restore] = withAsyncContext(
|
const msg =
|
||||||
|
(([__temp, __restore] = withAsyncContext(
|
||||||
() =>
|
() =>
|
||||||
new Promise(r => {
|
new Promise(r => {
|
||||||
resolve = r
|
resolve = r
|
||||||
@ -141,7 +142,10 @@ describe('SFC <script setup> helpers', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const root = nodeOps.createElement('div')
|
const root = nodeOps.createElement('div')
|
||||||
render(h(() => h(Suspense, () => h(Comp))), root)
|
render(
|
||||||
|
h(() => h(Suspense, () => h(Comp))),
|
||||||
|
root
|
||||||
|
)
|
||||||
|
|
||||||
expect(spy).not.toHaveBeenCalled()
|
expect(spy).not.toHaveBeenCalled()
|
||||||
resolve!('hello')
|
resolve!('hello')
|
||||||
@ -186,7 +190,10 @@ describe('SFC <script setup> helpers', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const root = nodeOps.createElement('div')
|
const root = nodeOps.createElement('div')
|
||||||
render(h(() => h(Suspense, () => h(Comp))), root)
|
render(
|
||||||
|
h(() => h(Suspense, () => h(Comp))),
|
||||||
|
root
|
||||||
|
)
|
||||||
|
|
||||||
expect(spy).not.toHaveBeenCalled()
|
expect(spy).not.toHaveBeenCalled()
|
||||||
reject!()
|
reject!()
|
||||||
@ -242,7 +249,10 @@ describe('SFC <script setup> helpers', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const root = nodeOps.createElement('div')
|
const root = nodeOps.createElement('div')
|
||||||
render(h(() => h(Suspense, () => h(Comp))), root)
|
render(
|
||||||
|
h(() => h(Suspense, () => h(Comp))),
|
||||||
|
root
|
||||||
|
)
|
||||||
|
|
||||||
await ready
|
await ready
|
||||||
expect(inBandInstance).toBe(beforeInstance)
|
expect(inBandInstance).toBe(beforeInstance)
|
||||||
|
@ -115,8 +115,8 @@ describe('api: template refs', () => {
|
|||||||
const fn = jest.fn()
|
const fn = jest.fn()
|
||||||
const toggle = ref(true)
|
const toggle = ref(true)
|
||||||
|
|
||||||
const Comp = defineComponent(() => () =>
|
const Comp = defineComponent(
|
||||||
toggle.value ? h('div', { ref: fn }) : null
|
() => () => toggle.value ? h('div', { ref: fn }) : null
|
||||||
)
|
)
|
||||||
render(h(Comp), root)
|
render(h(Comp), root)
|
||||||
expect(fn.mock.calls[0][0]).toBe(root.children[0])
|
expect(fn.mock.calls[0][0]).toBe(root.children[0])
|
||||||
|
@ -168,7 +168,10 @@ describe('api: watch', () => {
|
|||||||
state.count++
|
state.count++
|
||||||
count.value++
|
count.value++
|
||||||
await nextTick()
|
await nextTick()
|
||||||
expect(dummy).toMatchObject([[2, 2, 3], [1, 1, 2]])
|
expect(dummy).toMatchObject([
|
||||||
|
[2, 2, 3],
|
||||||
|
[1, 1, 2]
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('watching multiple sources: readonly array', async () => {
|
it('watching multiple sources: readonly array', async () => {
|
||||||
@ -188,7 +191,10 @@ describe('api: watch', () => {
|
|||||||
state.count++
|
state.count++
|
||||||
status.value = true
|
status.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
expect(dummy).toMatchObject([[2, true], [1, false]])
|
expect(dummy).toMatchObject([
|
||||||
|
[2, true],
|
||||||
|
[1, false]
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('watching multiple sources: reactive object (with automatic deep: true)', async () => {
|
it('watching multiple sources: reactive object (with automatic deep: true)', async () => {
|
||||||
@ -568,7 +574,10 @@ describe('api: watch', () => {
|
|||||||
count: ref(0)
|
count: ref(0)
|
||||||
},
|
},
|
||||||
array: [1, 2, 3],
|
array: [1, 2, 3],
|
||||||
map: new Map([['a', 1], ['b', 2]]),
|
map: new Map([
|
||||||
|
['a', 1],
|
||||||
|
['b', 2]
|
||||||
|
]),
|
||||||
set: new Set([1, 2, 3])
|
set: new Set([1, 2, 3])
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -868,7 +877,10 @@ describe('api: watch', () => {
|
|||||||
mounted() {
|
mounted() {
|
||||||
// this call runs while Comp is currentInstance, but
|
// this call runs while Comp is currentInstance, but
|
||||||
// the effect for this `$watch` should nontheless be registered with Child
|
// the effect for this `$watch` should nontheless be registered with Child
|
||||||
this.comp!.$watch(() => this.show, () => void 0)
|
this.comp!.$watch(
|
||||||
|
() => this.show,
|
||||||
|
() => void 0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -895,7 +907,7 @@ describe('api: watch', () => {
|
|||||||
render() {},
|
render() {},
|
||||||
created(this: any) {
|
created(this: any) {
|
||||||
instance = this
|
instance = this
|
||||||
this.$watch(source, function() {})
|
this.$watch(source, function () {})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ describe('component: proxy', () => {
|
|||||||
expect(() => (instanceProxy.$data = {})).toThrow(TypeError)
|
expect(() => (instanceProxy.$data = {})).toThrow(TypeError)
|
||||||
expect(`Attempting to mutate public property "$data"`).toHaveBeenWarned()
|
expect(`Attempting to mutate public property "$data"`).toHaveBeenWarned()
|
||||||
|
|
||||||
const nextTickThis = await instanceProxy.$nextTick(function(this: any) {
|
const nextTickThis = await instanceProxy.$nextTick(function (this: any) {
|
||||||
return this
|
return this
|
||||||
})
|
})
|
||||||
expect(nextTickThis).toBe(instanceProxy)
|
expect(nextTickThis).toBe(instanceProxy)
|
||||||
|
@ -258,9 +258,8 @@ describe('BaseTransition', () => {
|
|||||||
) {
|
) {
|
||||||
const toggle = ref(true)
|
const toggle = ref(true)
|
||||||
const { props, cbs } = mockProps({ mode })
|
const { props, cbs } = mockProps({ mode })
|
||||||
const root = mount(
|
const root = mount(props, () =>
|
||||||
props,
|
toggle.value ? trueBranch() : falseBranch()
|
||||||
() => (toggle.value ? trueBranch() : falseBranch())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// without appear: true, enter hooks should not be called on mount
|
// without appear: true, enter hooks should not be called on mount
|
||||||
@ -348,9 +347,8 @@ describe('BaseTransition', () => {
|
|||||||
}: ToggleOptions) {
|
}: ToggleOptions) {
|
||||||
const toggle = ref(false)
|
const toggle = ref(false)
|
||||||
const { props, cbs } = mockProps()
|
const { props, cbs } = mockProps()
|
||||||
const root = mount(
|
const root = mount(props, () =>
|
||||||
props,
|
toggle.value ? trueBranch() : falseBranch()
|
||||||
() => (toggle.value ? trueBranch() : falseBranch())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// start enter
|
// start enter
|
||||||
|
@ -841,10 +841,8 @@ describe('KeepAlive', () => {
|
|||||||
const instanceRef = ref<any>(null)
|
const instanceRef = ref<any>(null)
|
||||||
const App = {
|
const App = {
|
||||||
render: () => {
|
render: () => {
|
||||||
return h(
|
return h(KeepAlive, { include: 'Foo' }, () =>
|
||||||
KeepAlive,
|
toggle.value ? h(AsyncComp, { ref: instanceRef }) : null
|
||||||
{ include: 'Foo' },
|
|
||||||
() => (toggle.value ? h(AsyncComp, { ref: instanceRef }) : null)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,10 @@ describe('renderer: teleport', () => {
|
|||||||
const root = nodeOps.createElement('div')
|
const root = nodeOps.createElement('div')
|
||||||
const children = ref([h('div', 'teleported')])
|
const children = ref([h('div', 'teleported')])
|
||||||
|
|
||||||
render(h(() => h(Teleport, { to: target }, children.value)), root)
|
render(
|
||||||
|
h(() => h(Teleport, { to: target }, children.value)),
|
||||||
|
root
|
||||||
|
)
|
||||||
expect(serializeInner(target)).toMatchInlineSnapshot(
|
expect(serializeInner(target)).toMatchInlineSnapshot(
|
||||||
`"<div>teleported</div>"`
|
`"<div>teleported</div>"`
|
||||||
)
|
)
|
||||||
|
@ -42,7 +42,10 @@ describe('createSlot', () => {
|
|||||||
it('should add each slot to the record when given slot is an array', () => {
|
it('should add each slot to the record when given slot is an array', () => {
|
||||||
const dynamicSlot = [
|
const dynamicSlot = [
|
||||||
{ name: 'descriptor', fn: slot },
|
{ name: 'descriptor', fn: slot },
|
||||||
[{ name: 'descriptor2', fn: slot }, { name: 'descriptor3', fn: slot }]
|
[
|
||||||
|
{ name: 'descriptor2', fn: slot },
|
||||||
|
{ name: 'descriptor3', fn: slot }
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
const actual = createSlots(record, dynamicSlot)
|
const actual = createSlots(record, dynamicSlot)
|
||||||
|
@ -38,7 +38,7 @@ describe('renderList', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should render an item for entry in an iterable', () => {
|
it('should render an item for entry in an iterable', () => {
|
||||||
const iterable = function*() {
|
const iterable = function* () {
|
||||||
yield 1
|
yield 1
|
||||||
yield 2
|
yield 2
|
||||||
yield 3
|
yield 3
|
||||||
|
@ -759,9 +759,11 @@ describe('SSR hydration', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
(app.mount(svgContainer).$.subTree as VNode<Node, Element> & {
|
(
|
||||||
|
app.mount(svgContainer).$.subTree as VNode<Node, Element> & {
|
||||||
el: Element
|
el: Element
|
||||||
}).el instanceof SVGElement
|
}
|
||||||
|
).el instanceof SVGElement
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -321,21 +321,28 @@ describe('renderer: keyed children', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let n = 0; n < samples; ++n) {
|
for (let n = 0; n < samples; ++n) {
|
||||||
render(h('span', arr.map(n => spanNumWithOpacity(n, '1'))), root)
|
render(
|
||||||
|
h(
|
||||||
|
'span',
|
||||||
|
arr.map(n => spanNumWithOpacity(n, '1'))
|
||||||
|
),
|
||||||
|
root
|
||||||
|
)
|
||||||
elm = root.children[0] as TestElement
|
elm = root.children[0] as TestElement
|
||||||
|
|
||||||
for (let i = 0; i < elms; ++i) {
|
for (let i = 0; i < elms; ++i) {
|
||||||
expect(serializeInner(elm.children[i] as TestElement)).toBe(
|
expect(serializeInner(elm.children[i] as TestElement)).toBe(
|
||||||
i.toString()
|
i.toString()
|
||||||
)
|
)
|
||||||
opacities[i] = Math.random()
|
opacities[i] = Math.random().toFixed(5).toString()
|
||||||
.toFixed(5)
|
|
||||||
.toString()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const shufArr = shuffle(arr.slice(0))
|
const shufArr = shuffle(arr.slice(0))
|
||||||
render(
|
render(
|
||||||
h('span', arr.map(n => spanNumWithOpacity(shufArr[n], opacities[n]))),
|
h(
|
||||||
|
'span',
|
||||||
|
arr.map(n => spanNumWithOpacity(shufArr[n], opacities[n]))
|
||||||
|
),
|
||||||
root
|
root
|
||||||
)
|
)
|
||||||
elm = root.children[0] as TestElement
|
elm = root.children[0] as TestElement
|
||||||
|
@ -217,7 +217,10 @@ describe('renderer: component', () => {
|
|||||||
const Child = {
|
const Child = {
|
||||||
props: ['value'],
|
props: ['value'],
|
||||||
setup(props: any, { emit }: SetupContext) {
|
setup(props: any, { emit }: SetupContext) {
|
||||||
watch(() => props.value, (val: number) => emit('update', val))
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
(val: number) => emit('update', val)
|
||||||
|
)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
return h('div', props.value)
|
return h('div', props.value)
|
||||||
|
@ -417,7 +417,8 @@ describe('renderer: optimized mode', () => {
|
|||||||
const Comp = defineComponent({
|
const Comp = defineComponent({
|
||||||
setup(_props, { slots }) {
|
setup(_props, { slots }) {
|
||||||
return () => {
|
return () => {
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
(block = createBlock('div', null, {
|
(block = createBlock('div', null, {
|
||||||
default: withCtx(() => [renderSlot(slots, 'default')]),
|
default: withCtx(() => [renderSlot(slots, 'default')]),
|
||||||
_: SlotFlags.FORWARDED
|
_: SlotFlags.FORWARDED
|
||||||
@ -449,8 +450,9 @@ describe('renderer: optimized mode', () => {
|
|||||||
expect(block!.dynamicChildren![0].type).toBe(Fragment)
|
expect(block!.dynamicChildren![0].type).toBe(Fragment)
|
||||||
expect(block!.dynamicChildren![0].dynamicChildren!.length).toBe(1)
|
expect(block!.dynamicChildren![0].dynamicChildren!.length).toBe(1)
|
||||||
expect(
|
expect(
|
||||||
serialize(block!.dynamicChildren![0].dynamicChildren![0]
|
serialize(
|
||||||
.el as TestElement)
|
block!.dynamicChildren![0].dynamicChildren![0].el as TestElement
|
||||||
|
)
|
||||||
).toBe('<p>0</p>')
|
).toBe('<p>0</p>')
|
||||||
|
|
||||||
foo.value++
|
foo.value++
|
||||||
|
@ -226,7 +226,7 @@ describe('backwards compat with <=3.0.7', () => {
|
|||||||
test('should work on slots', () => {
|
test('should work on slots', () => {
|
||||||
const Child = {
|
const Child = {
|
||||||
__scopeId: 'child',
|
__scopeId: 'child',
|
||||||
render: withChildId(function(this: any) {
|
render: withChildId(function (this: any) {
|
||||||
return h('div', renderSlot(this.$slots, 'default'))
|
return h('div', renderSlot(this.$slots, 'default'))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -411,9 +411,9 @@ describe('vnode', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('handlers', () => {
|
test('handlers', () => {
|
||||||
let clickHandler1 = function() {}
|
let clickHandler1 = function () {}
|
||||||
let clickHandler2 = function() {}
|
let clickHandler2 = function () {}
|
||||||
let focusHandler2 = function() {}
|
let focusHandler2 = function () {}
|
||||||
|
|
||||||
let props1: Data = { onClick: clickHandler1 }
|
let props1: Data = { onClick: clickHandler1 }
|
||||||
let props2: Data = { onClick: clickHandler2, onFocus: focusHandler2 }
|
let props2: Data = { onClick: clickHandler2, onFocus: focusHandler2 }
|
||||||
@ -439,7 +439,8 @@ describe('vnode', () => {
|
|||||||
test('with patchFlags', () => {
|
test('with patchFlags', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1
|
let vnode1
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
hoist,
|
hoist,
|
||||||
(vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT))
|
(vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT))
|
||||||
@ -449,7 +450,8 @@ describe('vnode', () => {
|
|||||||
|
|
||||||
test('should not track vnodes with only HYDRATE_EVENTS flag', () => {
|
test('should not track vnodes with only HYDRATE_EVENTS flag', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
hoist,
|
hoist,
|
||||||
createVNode('div', null, 'text', PatchFlags.HYDRATE_EVENTS)
|
createVNode('div', null, 'text', PatchFlags.HYDRATE_EVENTS)
|
||||||
@ -460,11 +462,13 @@ describe('vnode', () => {
|
|||||||
test('many times call openBlock', () => {
|
test('many times call openBlock', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1, vnode2, vnode3
|
let vnode1, vnode2, vnode3
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
hoist,
|
hoist,
|
||||||
(vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT)),
|
(vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT)),
|
||||||
(vnode2 = (openBlock(),
|
(vnode2 =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
hoist,
|
hoist,
|
||||||
(vnode3 = createVNode('div', null, 'text', PatchFlags.TEXT))
|
(vnode3 = createVNode('div', null, 'text', PatchFlags.TEXT))
|
||||||
@ -477,7 +481,8 @@ describe('vnode', () => {
|
|||||||
test('with stateful component', () => {
|
test('with stateful component', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1
|
let vnode1
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
hoist,
|
hoist,
|
||||||
(vnode1 = createVNode({}, null, 'text'))
|
(vnode1 = createVNode({}, null, 'text'))
|
||||||
@ -488,7 +493,8 @@ describe('vnode', () => {
|
|||||||
test('with functional component', () => {
|
test('with functional component', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1
|
let vnode1
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
hoist,
|
hoist,
|
||||||
(vnode1 = createVNode(() => {}, null, 'text'))
|
(vnode1 = createVNode(() => {}, null, 'text'))
|
||||||
@ -499,7 +505,8 @@ describe('vnode', () => {
|
|||||||
test('with suspense', () => {
|
test('with suspense', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1
|
let vnode1
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
hoist,
|
hoist,
|
||||||
(vnode1 = createVNode(() => {}, null, 'text'))
|
(vnode1 = createVNode(() => {}, null, 'text'))
|
||||||
@ -516,7 +523,8 @@ describe('vnode', () => {
|
|||||||
test('element block should track normalized slot children', () => {
|
test('element block should track normalized slot children', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1: any
|
let vnode1: any
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, {
|
createBlock('div', null, {
|
||||||
default: () => {
|
default: () => {
|
||||||
return [
|
return [
|
||||||
@ -531,12 +539,14 @@ describe('vnode', () => {
|
|||||||
test('openBlock w/ disableTracking: true', () => {
|
test('openBlock w/ disableTracking: true', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1
|
let vnode1
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
// a v-for fragment block generated by the compiler
|
// a v-for fragment block generated by the compiler
|
||||||
// disables tracking because it always diffs its
|
// disables tracking because it always diffs its
|
||||||
// children.
|
// children.
|
||||||
(vnode1 = (openBlock(true),
|
(vnode1 =
|
||||||
|
(openBlock(true),
|
||||||
createBlock(Fragment, null, [
|
createBlock(Fragment, null, [
|
||||||
hoist,
|
hoist,
|
||||||
/*vnode2*/ createVNode(() => {}, null, 'text')
|
/*vnode2*/ createVNode(() => {}, null, 'text')
|
||||||
@ -549,9 +559,11 @@ describe('vnode', () => {
|
|||||||
test('openBlock without disableTracking: true', () => {
|
test('openBlock without disableTracking: true', () => {
|
||||||
const hoist = createVNode('div')
|
const hoist = createVNode('div')
|
||||||
let vnode1, vnode2
|
let vnode1, vnode2
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
(vnode1 = (openBlock(),
|
(vnode1 =
|
||||||
|
(openBlock(),
|
||||||
createBlock(Fragment, null, [
|
createBlock(Fragment, null, [
|
||||||
hoist,
|
hoist,
|
||||||
(vnode2 = createVNode(() => {}, null, 'text'))
|
(vnode2 = createVNode(() => {}, null, 'text'))
|
||||||
@ -563,7 +575,8 @@ describe('vnode', () => {
|
|||||||
|
|
||||||
test('should not track openBlock() when tracking is disabled', () => {
|
test('should not track openBlock() when tracking is disabled', () => {
|
||||||
let vnode1
|
let vnode1
|
||||||
const vnode = (openBlock(),
|
const vnode =
|
||||||
|
(openBlock(),
|
||||||
createBlock('div', null, [
|
createBlock('div', null, [
|
||||||
setBlockTracking(-1),
|
setBlockTracking(-1),
|
||||||
(vnode1 = (openBlock(), createBlock('div'))),
|
(vnode1 = (openBlock(), createBlock('div'))),
|
||||||
|
@ -71,7 +71,8 @@ export function defineAsyncComponent<
|
|||||||
let thisRequest: Promise<ConcreteComponent>
|
let thisRequest: Promise<ConcreteComponent>
|
||||||
return (
|
return (
|
||||||
pendingRequest ||
|
pendingRequest ||
|
||||||
(thisRequest = pendingRequest = loader()
|
(thisRequest = pendingRequest =
|
||||||
|
loader()
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
err = err instanceof Error ? err : new Error(String(err))
|
err = err instanceof Error ? err : new Error(String(err))
|
||||||
if (userOnError) {
|
if (userOnError) {
|
||||||
|
@ -133,7 +133,7 @@ export interface AppContext {
|
|||||||
type PluginInstallFunction = (app: App, ...options: any[]) => any
|
type PluginInstallFunction = (app: App, ...options: any[]) => any
|
||||||
|
|
||||||
export type Plugin =
|
export type Plugin =
|
||||||
| PluginInstallFunction & { install?: PluginInstallFunction }
|
| (PluginInstallFunction & { install?: PluginInstallFunction })
|
||||||
| {
|
| {
|
||||||
install: PluginInstallFunction
|
install: PluginInstallFunction
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,9 @@ export function injectHook(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createHook = <T extends Function = () => any>(
|
export const createHook =
|
||||||
lifecycle: LifecycleHooks
|
<T extends Function = () => any>(lifecycle: LifecycleHooks) =>
|
||||||
) => (hook: T, target: ComponentInternalInstance | null = currentInstance) =>
|
(hook: T, target: ComponentInternalInstance | null = currentInstance) =>
|
||||||
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
||||||
(!isInSSRComponentSetup || lifecycle === LifecycleHooks.SERVER_PREFETCH) &&
|
(!isInSSRComponentSetup || lifecycle === LifecycleHooks.SERVER_PREFETCH) &&
|
||||||
injectHook(lifecycle, hook, target)
|
injectHook(lifecycle, hook, target)
|
||||||
|
@ -130,12 +130,12 @@ export function defineExpose(exposed?: Record<string, any>) {
|
|||||||
type NotUndefined<T> = T extends undefined ? never : T
|
type NotUndefined<T> = T extends undefined ? never : T
|
||||||
|
|
||||||
type InferDefaults<T> = {
|
type InferDefaults<T> = {
|
||||||
[K in keyof T]?: NotUndefined<T[K]> extends (
|
[K in keyof T]?: NotUndefined<T[K]> extends
|
||||||
| number
|
| number
|
||||||
| string
|
| string
|
||||||
| boolean
|
| boolean
|
||||||
| symbol
|
| symbol
|
||||||
| Function)
|
| Function
|
||||||
? NotUndefined<T[K]>
|
? NotUndefined<T[K]>
|
||||||
: (props: T) => NotUndefined<T[K]>
|
: (props: T) => NotUndefined<T[K]>
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,13 @@ export type WatchCallback<V = any, OV = any> = (
|
|||||||
|
|
||||||
type MapSources<T, Immediate> = {
|
type MapSources<T, Immediate> = {
|
||||||
[K in keyof T]: T[K] extends WatchSource<infer V>
|
[K in keyof T]: T[K] extends WatchSource<infer V>
|
||||||
? Immediate extends true ? (V | undefined) : V
|
? Immediate extends true
|
||||||
|
? V | undefined
|
||||||
|
: V
|
||||||
: T[K] extends object
|
: T[K] extends object
|
||||||
? Immediate extends true ? (T[K] | undefined) : T[K]
|
? Immediate extends true
|
||||||
|
? T[K] | undefined
|
||||||
|
: T[K]
|
||||||
: never
|
: never
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,9 +85,13 @@ export function watchPostEffect(
|
|||||||
effect: WatchEffect,
|
effect: WatchEffect,
|
||||||
options?: DebuggerOptions
|
options?: DebuggerOptions
|
||||||
) {
|
) {
|
||||||
return doWatch(effect, null, (__DEV__
|
return doWatch(
|
||||||
|
effect,
|
||||||
|
null,
|
||||||
|
(__DEV__
|
||||||
? Object.assign(options || {}, { flush: 'post' })
|
? Object.assign(options || {}, { flush: 'post' })
|
||||||
: { flush: 'post' }) as WatchOptionsBase)
|
: { flush: 'post' }) as WatchOptionsBase
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// initial value for watchers to trigger on undefined initial values
|
// initial value for watchers to trigger on undefined initial values
|
||||||
@ -116,7 +124,7 @@ export function watch<
|
|||||||
// overload: single source + cb
|
// overload: single source + cb
|
||||||
export function watch<T, Immediate extends Readonly<boolean> = false>(
|
export function watch<T, Immediate extends Readonly<boolean> = false>(
|
||||||
source: WatchSource<T>,
|
source: WatchSource<T>,
|
||||||
cb: WatchCallback<T, Immediate extends true ? (T | undefined) : T>,
|
cb: WatchCallback<T, Immediate extends true ? T | undefined : T>,
|
||||||
options?: WatchOptions<Immediate>
|
options?: WatchOptions<Immediate>
|
||||||
): WatchStopHandle
|
): WatchStopHandle
|
||||||
|
|
||||||
@ -126,7 +134,7 @@ export function watch<
|
|||||||
Immediate extends Readonly<boolean> = false
|
Immediate extends Readonly<boolean> = false
|
||||||
>(
|
>(
|
||||||
source: T,
|
source: T,
|
||||||
cb: WatchCallback<T, Immediate extends true ? (T | undefined) : T>,
|
cb: WatchCallback<T, Immediate extends true ? T | undefined : T>,
|
||||||
options?: WatchOptions<Immediate>
|
options?: WatchOptions<Immediate>
|
||||||
): WatchStopHandle
|
): WatchStopHandle
|
||||||
|
|
||||||
|
@ -238,8 +238,9 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
|
|
||||||
[DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE]: {
|
[DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE]: {
|
||||||
message: componentName =>
|
message: componentName =>
|
||||||
`Component <${componentName ||
|
`Component <${
|
||||||
'Anonymous'}> has \`inheritAttrs: false\` but is ` +
|
componentName || 'Anonymous'
|
||||||
|
}> has \`inheritAttrs: false\` but is ` +
|
||||||
`relying on class/style fallthrough from parent. In Vue 3, class/style ` +
|
`relying on class/style fallthrough from parent. In Vue 3, class/style ` +
|
||||||
`are now included in $attrs and will no longer fallthrough when ` +
|
`are now included in $attrs and will no longer fallthrough when ` +
|
||||||
`inheritAttrs is false. If you are already using v-bind="$attrs" on ` +
|
`inheritAttrs is false. If you are already using v-bind="$attrs" on ` +
|
||||||
@ -317,9 +318,7 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
`${name}="false" instead of removing it in Vue 3. To remove the attribute, ` +
|
`${name}="false" instead of removing it in Vue 3. To remove the attribute, ` +
|
||||||
`use \`null\` or \`undefined\` instead. If the usage is intended, ` +
|
`use \`null\` or \`undefined\` instead. If the usage is intended, ` +
|
||||||
`you can disable the compat behavior and suppress this warning with:` +
|
`you can disable the compat behavior and suppress this warning with:` +
|
||||||
`\n\n configureCompat({ ${
|
`\n\n configureCompat({ ${DeprecationTypes.ATTR_FALSE_VALUE}: false })\n`,
|
||||||
DeprecationTypes.ATTR_FALSE_VALUE
|
|
||||||
}: false })\n`,
|
|
||||||
link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
|
link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -332,9 +331,7 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
`Always use explicit "true" or "false" values for enumerated attributes. ` +
|
`Always use explicit "true" or "false" values for enumerated attributes. ` +
|
||||||
`If the usage is intended, ` +
|
`If the usage is intended, ` +
|
||||||
`you can disable the compat behavior and suppress this warning with:` +
|
`you can disable the compat behavior and suppress this warning with:` +
|
||||||
`\n\n configureCompat({ ${
|
`\n\n configureCompat({ ${DeprecationTypes.ATTR_ENUMERATED_COERCION}: false })\n`,
|
||||||
DeprecationTypes.ATTR_ENUMERATED_COERCION
|
|
||||||
}: false })\n`,
|
|
||||||
link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
|
link: `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -348,9 +345,7 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
`default if no "tag" prop is specified. If you do not rely on the span ` +
|
`default if no "tag" prop is specified. If you do not rely on the span ` +
|
||||||
`for styling, you can disable the compat behavior and suppress this ` +
|
`for styling, you can disable the compat behavior and suppress this ` +
|
||||||
`warning with:` +
|
`warning with:` +
|
||||||
`\n\n configureCompat({ ${
|
`\n\n configureCompat({ ${DeprecationTypes.TRANSITION_GROUP_ROOT}: false })\n`,
|
||||||
DeprecationTypes.TRANSITION_GROUP_ROOT
|
|
||||||
}: false })\n`,
|
|
||||||
link: `https://v3.vuejs.org/guide/migration/transition-group.html`
|
link: `https://v3.vuejs.org/guide/migration/transition-group.html`
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -366,9 +361,7 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
`usage and intend to use plain functions for functional components, ` +
|
`usage and intend to use plain functions for functional components, ` +
|
||||||
`you can disable the compat behavior and suppress this ` +
|
`you can disable the compat behavior and suppress this ` +
|
||||||
`warning with:` +
|
`warning with:` +
|
||||||
`\n\n configureCompat({ ${
|
`\n\n configureCompat({ ${DeprecationTypes.COMPONENT_ASYNC}: false })\n`
|
||||||
DeprecationTypes.COMPONENT_ASYNC
|
|
||||||
}: false })\n`
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
link: `https://v3.vuejs.org/guide/migration/async-components.html`
|
link: `https://v3.vuejs.org/guide/migration/async-components.html`
|
||||||
@ -394,9 +387,7 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
message: (comp: ComponentOptions) => {
|
message: (comp: ComponentOptions) => {
|
||||||
const configMsg =
|
const configMsg =
|
||||||
`opt-in to ` +
|
`opt-in to ` +
|
||||||
`Vue 3 behavior on a per-component basis with \`compatConfig: { ${
|
`Vue 3 behavior on a per-component basis with \`compatConfig: { ${DeprecationTypes.COMPONENT_V_MODEL}: false }\`.`
|
||||||
DeprecationTypes.COMPONENT_V_MODEL
|
|
||||||
}: false }\`.`
|
|
||||||
if (
|
if (
|
||||||
comp.props &&
|
comp.props &&
|
||||||
(isArray(comp.props)
|
(isArray(comp.props)
|
||||||
@ -421,9 +412,7 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
|
|||||||
message:
|
message:
|
||||||
`Vue 3's render function API has changed. ` +
|
`Vue 3's render function API has changed. ` +
|
||||||
`You can opt-in to the new API with:` +
|
`You can opt-in to the new API with:` +
|
||||||
`\n\n configureCompat({ ${
|
`\n\n configureCompat({ ${DeprecationTypes.RENDER_FUNCTION}: false })\n` +
|
||||||
DeprecationTypes.RENDER_FUNCTION
|
|
||||||
}: false })\n` +
|
|
||||||
`\n (This can also be done per-component via the "compatConfig" option.)`,
|
`\n (This can also be done per-component via the "compatConfig" option.)`,
|
||||||
link: `https://v3.vuejs.org/guide/migration/render-function-api.html`
|
link: `https://v3.vuejs.org/guide/migration/render-function-api.html`
|
||||||
},
|
},
|
||||||
@ -565,9 +554,7 @@ export function validateCompatConfig(
|
|||||||
|
|
||||||
if (instance && config[DeprecationTypes.OPTIONS_DATA_MERGE] != null) {
|
if (instance && config[DeprecationTypes.OPTIONS_DATA_MERGE] != null) {
|
||||||
warn(
|
warn(
|
||||||
`Deprecation config "${
|
`Deprecation config "${DeprecationTypes.OPTIONS_DATA_MERGE}" can only be configured globally.`
|
||||||
DeprecationTypes.OPTIONS_DATA_MERGE
|
|
||||||
}" can only be configured globally.`
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ const skipLegacyRootLevelProps = /*#__PURE__*/ makeMap(
|
|||||||
function convertLegacyProps(
|
function convertLegacyProps(
|
||||||
legacyProps: LegacyVNodeProps | undefined,
|
legacyProps: LegacyVNodeProps | undefined,
|
||||||
type: any
|
type: any
|
||||||
): Data & VNodeProps | null {
|
): (Data & VNodeProps) | null {
|
||||||
if (!legacyProps) {
|
if (!legacyProps) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ export function legacyBindObjectProps(
|
|||||||
|
|
||||||
if (isSync) {
|
if (isSync) {
|
||||||
const on = data.on || (data.on = {})
|
const on = data.on || (data.on = {})
|
||||||
on[`update:${key}`] = function($event: any) {
|
on[`update:${key}`] = function ($event: any) {
|
||||||
value[key] = $event
|
value[key] = $event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -761,10 +761,8 @@ export function finishComponentSetup(
|
|||||||
startMeasure(instance, `compile`)
|
startMeasure(instance, `compile`)
|
||||||
}
|
}
|
||||||
const { isCustomElement, compilerOptions } = instance.appContext.config
|
const { isCustomElement, compilerOptions } = instance.appContext.config
|
||||||
const {
|
const { delimiters, compilerOptions: componentCompilerOptions } =
|
||||||
delimiters,
|
Component
|
||||||
compilerOptions: componentCompilerOptions
|
|
||||||
} = Component
|
|
||||||
const finalCompilerOptions: CompilerOptions = extend(
|
const finalCompilerOptions: CompilerOptions = extend(
|
||||||
extend(
|
extend(
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,9 @@ type RequiredKeys<T> = {
|
|||||||
// don't mark Boolean props as undefined
|
// don't mark Boolean props as undefined
|
||||||
| BooleanConstructor
|
| BooleanConstructor
|
||||||
| { type: BooleanConstructor }
|
| { type: BooleanConstructor }
|
||||||
? T[K] extends { default: undefined | (() => undefined) } ? never : K
|
? T[K] extends { default: undefined | (() => undefined) }
|
||||||
|
? never
|
||||||
|
: K
|
||||||
: never
|
: never
|
||||||
}[keyof T]
|
}[keyof T]
|
||||||
|
|
||||||
@ -106,7 +108,9 @@ type InferPropType<T> = [T] extends [null]
|
|||||||
: [T] extends [DateConstructor | { type: DateConstructor }]
|
: [T] extends [DateConstructor | { type: DateConstructor }]
|
||||||
? Date
|
? Date
|
||||||
: [T] extends [Prop<infer V, infer D>]
|
: [T] extends [Prop<infer V, infer D>]
|
||||||
? (unknown extends V ? D : V)
|
? unknown extends V
|
||||||
|
? D
|
||||||
|
: V
|
||||||
: T
|
: T
|
||||||
|
|
||||||
export type ExtractPropTypes<O> = O extends object
|
export type ExtractPropTypes<O> = O extends object
|
||||||
|
@ -72,7 +72,9 @@ import { installCompatInstanceProperties } from './compat/instance'
|
|||||||
export interface ComponentCustomProperties {}
|
export interface ComponentCustomProperties {}
|
||||||
|
|
||||||
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin
|
type IsDefaultMixinComponent<T> = T extends ComponentOptionsMixin
|
||||||
? ComponentOptionsMixin extends T ? true : false
|
? ComponentOptionsMixin extends T
|
||||||
|
? true
|
||||||
|
: false
|
||||||
: false
|
: false
|
||||||
|
|
||||||
type MixinToOptionTypes<T> = T extends ComponentOptionsBase<
|
type MixinToOptionTypes<T> = T extends ComponentOptionsBase<
|
||||||
@ -261,15 +263,8 @@ export interface ComponentRenderContext {
|
|||||||
|
|
||||||
export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
|
export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
|
||||||
get({ _: instance }: ComponentRenderContext, key: string) {
|
get({ _: instance }: ComponentRenderContext, key: string) {
|
||||||
const {
|
const { ctx, setupState, data, props, accessCache, type, appContext } =
|
||||||
ctx,
|
instance
|
||||||
setupState,
|
|
||||||
data,
|
|
||||||
props,
|
|
||||||
accessCache,
|
|
||||||
type,
|
|
||||||
appContext
|
|
||||||
} = instance
|
|
||||||
|
|
||||||
// for internal formatters to know that this is a Vue instance
|
// for internal formatters to know that this is a Vue instance
|
||||||
if (__DEV__ && key === '__isVue') {
|
if (__DEV__ && key === '__isVue') {
|
||||||
|
@ -257,7 +257,7 @@ if (__COMPAT__) {
|
|||||||
|
|
||||||
// export the public type for h/tsx inference
|
// export the public type for h/tsx inference
|
||||||
// also to avoid inline import() in generated d.ts files
|
// also to avoid inline import() in generated d.ts files
|
||||||
export const BaseTransition = (BaseTransitionImpl as any) as {
|
export const BaseTransition = BaseTransitionImpl as any as {
|
||||||
new (): {
|
new (): {
|
||||||
$props: BaseTransitionProps<any>
|
$props: BaseTransitionProps<any>
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ if (__COMPAT__) {
|
|||||||
|
|
||||||
// export the public type for h/tsx inference
|
// export the public type for h/tsx inference
|
||||||
// also to avoid inline import() in generated d.ts files
|
// also to avoid inline import() in generated d.ts files
|
||||||
export const KeepAlive = (KeepAliveImpl as any) as {
|
export const KeepAlive = KeepAliveImpl as any as {
|
||||||
__isKeepAlive: true
|
__isKeepAlive: true
|
||||||
new (): {
|
new (): {
|
||||||
$props: VNodeProps & KeepAliveProps
|
$props: VNodeProps & KeepAliveProps
|
||||||
|
@ -87,9 +87,7 @@ export const SuspenseImpl = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Force-casted public typing for h and TSX props inference
|
// Force-casted public typing for h and TSX props inference
|
||||||
export const Suspense = ((__FEATURE_SUSPENSE__
|
export const Suspense = (__FEATURE_SUSPENSE__ ? SuspenseImpl : null) as any as {
|
||||||
? SuspenseImpl
|
|
||||||
: null) as any) as {
|
|
||||||
__isSuspense: true
|
__isSuspense: true
|
||||||
new (): { $props: VNodeProps & SuspenseProps }
|
new (): { $props: VNodeProps & SuspenseProps }
|
||||||
}
|
}
|
||||||
@ -520,13 +518,8 @@ function createSuspenseBoundary(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { vnode, activeBranch, parentComponent, container, isSVG } =
|
||||||
vnode,
|
suspense
|
||||||
activeBranch,
|
|
||||||
parentComponent,
|
|
||||||
container,
|
|
||||||
isSVG
|
|
||||||
} = suspense
|
|
||||||
|
|
||||||
// invoke @fallback event
|
// invoke @fallback event
|
||||||
triggerEvent(vnode, 'onFallback')
|
triggerEvent(vnode, 'onFallback')
|
||||||
|
@ -371,7 +371,7 @@ function hydrateTeleport(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Force-casted public typing for h and TSX props inference
|
// Force-casted public typing for h and TSX props inference
|
||||||
export const Teleport = (TeleportImpl as any) as {
|
export const Teleport = TeleportImpl as any as {
|
||||||
__isTeleport: true
|
__isTeleport: true
|
||||||
new (): { $props: VNodeProps & TeleportProps }
|
new (): { $props: VNodeProps & TeleportProps }
|
||||||
}
|
}
|
||||||
|
@ -54,13 +54,11 @@ export const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook(
|
|||||||
DevtoolsHooks.COMPONENT_ADDED
|
DevtoolsHooks.COMPONENT_ADDED
|
||||||
)
|
)
|
||||||
|
|
||||||
export const devtoolsComponentUpdated = /*#__PURE__*/ createDevtoolsComponentHook(
|
export const devtoolsComponentUpdated =
|
||||||
DevtoolsHooks.COMPONENT_UPDATED
|
/*#__PURE__*/ createDevtoolsComponentHook(DevtoolsHooks.COMPONENT_UPDATED)
|
||||||
)
|
|
||||||
|
|
||||||
export const devtoolsComponentRemoved = /*#__PURE__*/ createDevtoolsComponentHook(
|
export const devtoolsComponentRemoved =
|
||||||
DevtoolsHooks.COMPONENT_REMOVED
|
/*#__PURE__*/ createDevtoolsComponentHook(DevtoolsHooks.COMPONENT_REMOVED)
|
||||||
)
|
|
||||||
|
|
||||||
function createDevtoolsComponentHook(hook: DevtoolsHooks) {
|
function createDevtoolsComponentHook(hook: DevtoolsHooks) {
|
||||||
return (component: ComponentInternalInstance) => {
|
return (component: ComponentInternalInstance) => {
|
||||||
|
@ -15,7 +15,8 @@ export function createSlots(
|
|||||||
dynamicSlots: (
|
dynamicSlots: (
|
||||||
| CompiledSlotDescriptor
|
| CompiledSlotDescriptor
|
||||||
| CompiledSlotDescriptor[]
|
| CompiledSlotDescriptor[]
|
||||||
| undefined)[]
|
| undefined
|
||||||
|
)[]
|
||||||
): Record<string, Slot> {
|
): Record<string, Slot> {
|
||||||
for (let i = 0; i < dynamicSlots.length; i++) {
|
for (let i = 0; i < dynamicSlots.length; i++) {
|
||||||
const slot = dynamicSlots[i]
|
const slot = dynamicSlots[i]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export type UnionToIntersection<U> = (U extends any
|
export type UnionToIntersection<U> = (
|
||||||
? (k: U) => void
|
U extends any ? (k: U) => void : never
|
||||||
: never) extends ((k: infer I) => void)
|
) extends (k: infer I) => void
|
||||||
? I
|
? I
|
||||||
: never
|
: never
|
||||||
|
|
||||||
|
@ -280,8 +280,8 @@ export function createHydrationFunctions(
|
|||||||
if (
|
if (
|
||||||
forcePatchValue ||
|
forcePatchValue ||
|
||||||
!optimized ||
|
!optimized ||
|
||||||
(patchFlag & PatchFlags.FULL_PROPS ||
|
patchFlag & PatchFlags.FULL_PROPS ||
|
||||||
patchFlag & PatchFlags.HYDRATE_EVENTS)
|
patchFlag & PatchFlags.HYDRATE_EVENTS
|
||||||
) {
|
) {
|
||||||
for (const key in props) {
|
for (const key in props) {
|
||||||
if (
|
if (
|
||||||
@ -346,7 +346,9 @@ export function createHydrationFunctions(
|
|||||||
hasMismatch = true
|
hasMismatch = true
|
||||||
__DEV__ &&
|
__DEV__ &&
|
||||||
warn(
|
warn(
|
||||||
`Hydration text content mismatch in <${vnode.type as string}>:\n` +
|
`Hydration text content mismatch in <${
|
||||||
|
vnode.type as string
|
||||||
|
}>:\n` +
|
||||||
`- Client: ${el.textContent}\n` +
|
`- Client: ${el.textContent}\n` +
|
||||||
`- Server: ${vnode.children as string}`
|
`- Server: ${vnode.children as string}`
|
||||||
)
|
)
|
||||||
|
@ -341,9 +341,9 @@ const _compatUtils = {
|
|||||||
/**
|
/**
|
||||||
* @internal only exposed in compat builds.
|
* @internal only exposed in compat builds.
|
||||||
*/
|
*/
|
||||||
export const compatUtils = (__COMPAT__
|
export const compatUtils = (
|
||||||
? _compatUtils
|
__COMPAT__ ? _compatUtils : null
|
||||||
: null) as typeof _compatUtils
|
) as typeof _compatUtils
|
||||||
|
|
||||||
// Ref macros ------------------------------------------------------------------
|
// Ref macros ------------------------------------------------------------------
|
||||||
// for dts generation only
|
// for dts generation only
|
||||||
|
@ -1444,7 +1444,7 @@ function baseCreateRenderer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isAsyncWrapper(initialVNode)) {
|
if (isAsyncWrapper(initialVNode)) {
|
||||||
(initialVNode.type as ComponentOptions).__asyncLoader!().then(
|
;(initialVNode.type as ComponentOptions).__asyncLoader!().then(
|
||||||
// note: we are moving the render call into an async callback,
|
// note: we are moving the render call into an async callback,
|
||||||
// which means it won't track dependencies - but it's ok because
|
// which means it won't track dependencies - but it's ok because
|
||||||
// a server-rendered async wrapper is already in resolved state
|
// a server-rendered async wrapper is already in resolved state
|
||||||
@ -2406,10 +2406,9 @@ function baseCreateRenderer(
|
|||||||
let hydrate: ReturnType<typeof createHydrationFunctions>[0] | undefined
|
let hydrate: ReturnType<typeof createHydrationFunctions>[0] | undefined
|
||||||
let hydrateNode: ReturnType<typeof createHydrationFunctions>[1] | undefined
|
let hydrateNode: ReturnType<typeof createHydrationFunctions>[1] | undefined
|
||||||
if (createHydrationFns) {
|
if (createHydrationFns) {
|
||||||
;[hydrate, hydrateNode] = createHydrationFns(internals as RendererInternals<
|
;[hydrate, hydrateNode] = createHydrationFns(
|
||||||
Node,
|
internals as RendererInternals<Node, Element>
|
||||||
Element
|
)
|
||||||
>)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -44,7 +44,7 @@ import { convertLegacyVModelProps } from './compat/componentVModel'
|
|||||||
import { defineLegacyVNodeProperties } from './compat/renderFn'
|
import { defineLegacyVNodeProperties } from './compat/renderFn'
|
||||||
import { convertLegacyRefInFor } from './compat/ref'
|
import { convertLegacyRefInFor } from './compat/ref'
|
||||||
|
|
||||||
export const Fragment = (Symbol(__DEV__ ? 'Fragment' : undefined) as any) as {
|
export const Fragment = Symbol(__DEV__ ? 'Fragment' : undefined) as any as {
|
||||||
__isFragment: true
|
__isFragment: true
|
||||||
new (): {
|
new (): {
|
||||||
$props: VNodeProps
|
$props: VNodeProps
|
||||||
@ -78,7 +78,7 @@ export type VNodeNormalizedRefAtom = {
|
|||||||
|
|
||||||
export type VNodeNormalizedRef =
|
export type VNodeNormalizedRef =
|
||||||
| VNodeNormalizedRefAtom
|
| VNodeNormalizedRefAtom
|
||||||
| (VNodeNormalizedRefAtom)[]
|
| VNodeNormalizedRefAtom[]
|
||||||
|
|
||||||
type VNodeMountHook = (vnode: VNode) => void
|
type VNodeMountHook = (vnode: VNode) => void
|
||||||
type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void
|
type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void
|
||||||
@ -381,11 +381,13 @@ const normalizeKey = ({ key }: VNodeProps): VNode['key'] =>
|
|||||||
key != null ? key : null
|
key != null ? key : null
|
||||||
|
|
||||||
const normalizeRef = ({ ref }: VNodeProps): VNodeNormalizedRefAtom | null => {
|
const normalizeRef = ({ ref }: VNodeProps): VNodeNormalizedRefAtom | null => {
|
||||||
return (ref != null
|
return (
|
||||||
|
ref != null
|
||||||
? isString(ref) || isRef(ref) || isFunction(ref)
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
||||||
? { i: currentRenderingInstance, r: ref }
|
? { i: currentRenderingInstance, r: ref }
|
||||||
: ref
|
: ref
|
||||||
: null) as any
|
: null
|
||||||
|
) as any
|
||||||
}
|
}
|
||||||
|
|
||||||
function createBaseVNode(
|
function createBaseVNode(
|
||||||
@ -475,9 +477,9 @@ function createBaseVNode(
|
|||||||
|
|
||||||
export { createBaseVNode as createElementVNode }
|
export { createBaseVNode as createElementVNode }
|
||||||
|
|
||||||
export const createVNode = (__DEV__
|
export const createVNode = (
|
||||||
? createVNodeWithArgsTransform
|
__DEV__ ? createVNodeWithArgsTransform : _createVNode
|
||||||
: _createVNode) as typeof _createVNode
|
) as typeof _createVNode
|
||||||
|
|
||||||
function _createVNode(
|
function _createVNode(
|
||||||
type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT,
|
type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT,
|
||||||
@ -579,7 +581,7 @@ export function guardReactiveProps(props: (Data & VNodeProps) | null) {
|
|||||||
|
|
||||||
export function cloneVNode<T, U>(
|
export function cloneVNode<T, U>(
|
||||||
vnode: VNode<T, U>,
|
vnode: VNode<T, U>,
|
||||||
extraProps?: Data & VNodeProps | null,
|
extraProps?: (Data & VNodeProps) | null,
|
||||||
mergeRef = false
|
mergeRef = false
|
||||||
): VNode<T, U> {
|
): VNode<T, U> {
|
||||||
// This is intentionally NOT using spread or extend to avoid the runtime
|
// This is intentionally NOT using spread or extend to avoid the runtime
|
||||||
|
@ -17,7 +17,7 @@ const triggerEvent = (type: string, el: Element) => {
|
|||||||
const withVModel = (node: VNode, arg: any, mods?: any) =>
|
const withVModel = (node: VNode, arg: any, mods?: any) =>
|
||||||
withDirectives(node, [[vModelDynamic, arg, '', mods]])
|
withDirectives(node, [[vModelDynamic, arg, '', mods]])
|
||||||
|
|
||||||
const setValue = function(this: any, value: any) {
|
const setValue = function (this: any, value: any) {
|
||||||
this.value = value
|
this.value = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,9 +41,9 @@ describe('runtime-dom: v-on directive', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('it should support key modifiers and system modifiers', () => {
|
test('it should support key modifiers and system modifiers', () => {
|
||||||
const keyNames = ["ctrl","shift","meta","alt"]
|
const keyNames = ['ctrl', 'shift', 'meta', 'alt']
|
||||||
|
|
||||||
keyNames.forEach(keyName=>{
|
keyNames.forEach(keyName => {
|
||||||
const el = document.createElement('div')
|
const el = document.createElement('div')
|
||||||
const fn = jest.fn()
|
const fn = jest.fn()
|
||||||
// <div @keyup[keyName].esc="test"/>
|
// <div @keyup[keyName].esc="test"/>
|
||||||
@ -73,7 +73,7 @@ describe('runtime-dom: v-on directive', () => {
|
|||||||
e.key = 'ArrowLeft'
|
e.key = 'ArrowLeft'
|
||||||
})
|
})
|
||||||
expect(fn).toBeCalledTimes(2)
|
expect(fn).toBeCalledTimes(2)
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('it should support "exact" modifier', () => {
|
test('it should support "exact" modifier', () => {
|
||||||
@ -114,7 +114,9 @@ describe('runtime-dom: v-on directive', () => {
|
|||||||
const fn = jest.fn()
|
const fn = jest.fn()
|
||||||
const handler = withModifiers(fn, [button])
|
const handler = withModifiers(fn, [button])
|
||||||
patchEvent(el, 'onMousedown', null, handler, null)
|
patchEvent(el, 'onMousedown', null, handler, null)
|
||||||
buttons.filter(b => b !== button).forEach(button => {
|
buttons
|
||||||
|
.filter(b => b !== button)
|
||||||
|
.forEach(button => {
|
||||||
triggerEvent(el, 'mousedown', e => (e.button = buttonCodes[button]))
|
triggerEvent(el, 'mousedown', e => (e.button = buttonCodes[button]))
|
||||||
})
|
})
|
||||||
expect(fn).not.toBeCalled()
|
expect(fn).not.toBeCalled()
|
||||||
|
@ -155,10 +155,8 @@ describe('useCssVars', () => {
|
|||||||
setup() {
|
setup() {
|
||||||
useCssVars(() => state)
|
useCssVars(() => state)
|
||||||
return () =>
|
return () =>
|
||||||
h(
|
h(Child, null, () =>
|
||||||
Child,
|
value.value ? [h('div')] : [h('div'), h('div')]
|
||||||
null,
|
|
||||||
() => (value.value ? [h('div')] : [h('div'), h('div')])
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,9 +157,9 @@ export const defineSSRCustomElement = ((options: any) => {
|
|||||||
return defineCustomElement(options, hydrate)
|
return defineCustomElement(options, hydrate)
|
||||||
}) as typeof defineCustomElement
|
}) as typeof defineCustomElement
|
||||||
|
|
||||||
const BaseClass = (typeof HTMLElement !== 'undefined'
|
const BaseClass = (
|
||||||
? HTMLElement
|
typeof HTMLElement !== 'undefined' ? HTMLElement : class {}
|
||||||
: class {}) as typeof HTMLElement
|
) as typeof HTMLElement
|
||||||
|
|
||||||
export class VueElement extends BaseClass {
|
export class VueElement extends BaseClass {
|
||||||
/**
|
/**
|
||||||
|
@ -69,11 +69,12 @@ const DOMTransitionPropsValidators = {
|
|||||||
leaveToClass: String
|
leaveToClass: String
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ extend(
|
export const TransitionPropsValidators = (Transition.props =
|
||||||
|
/*#__PURE__*/ extend(
|
||||||
{},
|
{},
|
||||||
(BaseTransition as any).props,
|
(BaseTransition as any).props,
|
||||||
DOMTransitionPropsValidators
|
DOMTransitionPropsValidators
|
||||||
))
|
))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
||||||
|
@ -159,7 +159,7 @@ if (__COMPAT__) {
|
|||||||
const removeMode = (props: any) => delete props.mode
|
const removeMode = (props: any) => delete props.mode
|
||||||
/*#__PURE__*/ removeMode(TransitionGroupImpl.props)
|
/*#__PURE__*/ removeMode(TransitionGroupImpl.props)
|
||||||
|
|
||||||
export const TransitionGroup = (TransitionGroupImpl as unknown) as {
|
export const TransitionGroup = TransitionGroupImpl as unknown as {
|
||||||
new (): {
|
new (): {
|
||||||
$props: TransitionGroupProps
|
$props: TransitionGroupProps
|
||||||
}
|
}
|
||||||
@ -210,9 +210,9 @@ function hasCSSTransform(
|
|||||||
}
|
}
|
||||||
moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c))
|
moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c))
|
||||||
clone.style.display = 'none'
|
clone.style.display = 'none'
|
||||||
const container = (root.nodeType === 1
|
const container = (
|
||||||
? root
|
root.nodeType === 1 ? root : root.parentNode
|
||||||
: root.parentNode) as HTMLElement
|
) as HTMLElement
|
||||||
container.appendChild(clone)
|
container.appendChild(clone)
|
||||||
const { hasTransform } = getTransitionInfo(clone)
|
const { hasTransform } = getTransitionInfo(clone)
|
||||||
container.removeChild(clone)
|
container.removeChild(clone)
|
||||||
|
@ -181,8 +181,7 @@ export const vModelSelect: ModelDirective<HTMLSelectElement> = {
|
|||||||
addEventListener(el, 'change', () => {
|
addEventListener(el, 'change', () => {
|
||||||
const selectedVal = Array.prototype.filter
|
const selectedVal = Array.prototype.filter
|
||||||
.call(el.options, (o: HTMLOptionElement) => o.selected)
|
.call(el.options, (o: HTMLOptionElement) => o.selected)
|
||||||
.map(
|
.map((o: HTMLOptionElement) =>
|
||||||
(o: HTMLOptionElement) =>
|
|
||||||
number ? toNumber(getValue(o)) : getValue(o)
|
number ? toNumber(getValue(o)) : getValue(o)
|
||||||
)
|
)
|
||||||
el._assign(
|
el._assign(
|
||||||
|
@ -66,7 +66,7 @@ export const withKeys = (fn: Function, modifiers: string[]) => {
|
|||||||
compatUtils.isCompatEnabled(DeprecationTypes.CONFIG_KEY_CODES, instance)
|
compatUtils.isCompatEnabled(DeprecationTypes.CONFIG_KEY_CODES, instance)
|
||||||
) {
|
) {
|
||||||
if (instance) {
|
if (instance) {
|
||||||
globalKeyCodes = ((instance.appContext.config as any) as LegacyConfig)
|
globalKeyCodes = (instance.appContext.config as any as LegacyConfig)
|
||||||
.keyCodes
|
.keyCodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,8 @@ export function patchClass(el: Element, value: string | null, isSVG: boolean) {
|
|||||||
// classes into account.
|
// classes into account.
|
||||||
const transitionClasses = (el as ElementWithTransition)._vtc
|
const transitionClasses = (el as ElementWithTransition)._vtc
|
||||||
if (transitionClasses) {
|
if (transitionClasses) {
|
||||||
value = (value
|
value = (
|
||||||
? [value, ...transitionClasses]
|
value ? [value, ...transitionClasses] : [...transitionClasses]
|
||||||
: [...transitionClasses]
|
|
||||||
).join(' ')
|
).join(' ')
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
@ -721,7 +721,7 @@ function testRender(type: string, render: typeof renderToString) {
|
|||||||
test('with client-compiled vnode slots', async () => {
|
test('with client-compiled vnode slots', async () => {
|
||||||
const Child = {
|
const Child = {
|
||||||
__scopeId: 'data-v-child',
|
__scopeId: 'data-v-child',
|
||||||
render: function(this: any) {
|
render: function (this: any) {
|
||||||
return h('div', null, [renderSlot(this.$slots, 'default')])
|
return h('div', null, [renderSlot(this.$slots, 'default')])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1069,7 +1069,7 @@ function testRender(type: string, render: typeof renderToString) {
|
|||||||
renderError = e
|
renderError = e
|
||||||
}
|
}
|
||||||
expect(renderError).toBe(null)
|
expect(renderError).toBe(null)
|
||||||
expect(((capturedError as unknown) as Error).message).toBe('An error')
|
expect((capturedError as unknown as Error).message).toBe('An error')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ describe('ssr: renderList', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should render an item for entry in an iterable', () => {
|
it('should render an item for entry in an iterable', () => {
|
||||||
const iterable = function*() {
|
const iterable = function* () {
|
||||||
yield 1
|
yield 1
|
||||||
yield 2
|
yield 2
|
||||||
yield 3
|
yield 3
|
||||||
|
@ -26,9 +26,7 @@ export function ssrCompile(
|
|||||||
isNativeTag: instance.appContext.config.isNativeTag || NO,
|
isNativeTag: instance.appContext.config.isNativeTag || NO,
|
||||||
onError(err: CompilerError) {
|
onError(err: CompilerError) {
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
const message = `[@vue/server-renderer] Template compilation error: ${
|
const message = `[@vue/server-renderer] Template compilation error: ${err.message}`
|
||||||
err.message
|
|
||||||
}`
|
|
||||||
const codeFrame =
|
const codeFrame =
|
||||||
err.loc &&
|
err.loc &&
|
||||||
generateCodeFrame(
|
generateCodeFrame(
|
||||||
|
@ -17,9 +17,7 @@ export function ssrRenderDynamicModel(
|
|||||||
case 'radio':
|
case 'radio':
|
||||||
return looseEqual(model, value) ? ' checked' : ''
|
return looseEqual(model, value) ? ' checked' : ''
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
return (isArray(model)
|
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
||||||
? ssrLooseContain(model, value)
|
|
||||||
: model)
|
|
||||||
? ' checked'
|
? ' checked'
|
||||||
: ''
|
: ''
|
||||||
default:
|
default:
|
||||||
@ -38,9 +36,7 @@ export function ssrGetDynamicModelProps(
|
|||||||
case 'radio':
|
case 'radio':
|
||||||
return looseEqual(model, value) ? { checked: true } : null
|
return looseEqual(model, value) ? { checked: true } : null
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
return (isArray(model)
|
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
||||||
? ssrLooseContain(model, value)
|
|
||||||
: model)
|
|
||||||
? { checked: true }
|
? { checked: true }
|
||||||
: null
|
: null
|
||||||
default:
|
default:
|
||||||
|
@ -74,9 +74,9 @@ async function resolveTeleports(context: SSRContext) {
|
|||||||
for (const key in context.__teleportBuffers) {
|
for (const key in context.__teleportBuffers) {
|
||||||
// note: it's OK to await sequentially here because the Promises were
|
// note: it's OK to await sequentially here because the Promises were
|
||||||
// created eagerly in parallel.
|
// created eagerly in parallel.
|
||||||
context.teleports[key] = await unrollBuffer((await Promise.all(
|
context.teleports[key] = await unrollBuffer(
|
||||||
context.__teleportBuffers[key]
|
(await Promise.all(context.__teleportBuffers[key])) as SSRBuffer
|
||||||
)) as SSRBuffer)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,12 +217,7 @@ async function doCompileScript(
|
|||||||
|
|
||||||
return [code, compiledScript.bindings]
|
return [code, compiledScript.bindings]
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
store.errors = [
|
store.errors = [e.stack.split('\n').slice(0, 12).join('\n')]
|
||||||
e.stack
|
|
||||||
.split('\n')
|
|
||||||
.slice(0, 12)
|
|
||||||
.join('\n')
|
|
||||||
]
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,27 +54,27 @@ describe('utils/looseEqual', () => {
|
|||||||
const date2 = new Date(2019, 1, 2, 3, 4, 5, 7)
|
const date2 = new Date(2019, 1, 2, 3, 4, 5, 7)
|
||||||
const file1 = new File([''], 'filename.txt', {
|
const file1 = new File([''], 'filename.txt', {
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
lastModified: date1.getTime(),
|
lastModified: date1.getTime()
|
||||||
})
|
})
|
||||||
const file2 = new File([''], 'filename.txt', {
|
const file2 = new File([''], 'filename.txt', {
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
lastModified: date1.getTime(),
|
lastModified: date1.getTime()
|
||||||
})
|
})
|
||||||
const file3 = new File([''], 'filename.txt', {
|
const file3 = new File([''], 'filename.txt', {
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
lastModified: date2.getTime(),
|
lastModified: date2.getTime()
|
||||||
})
|
})
|
||||||
const file4 = new File([''], 'filename.csv', {
|
const file4 = new File([''], 'filename.csv', {
|
||||||
type: 'text/csv',
|
type: 'text/csv',
|
||||||
lastModified: date1.getTime(),
|
lastModified: date1.getTime()
|
||||||
})
|
})
|
||||||
const file5 = new File(['abcdef'], 'filename.txt', {
|
const file5 = new File(['abcdef'], 'filename.txt', {
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
lastModified: date1.getTime(),
|
lastModified: date1.getTime()
|
||||||
})
|
})
|
||||||
const file6 = new File(['12345'], 'filename.txt', {
|
const file6 = new File(['12345'], 'filename.txt', {
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
lastModified: date1.getTime(),
|
lastModified: date1.getTime()
|
||||||
})
|
})
|
||||||
|
|
||||||
// Identical file object references
|
// Identical file object references
|
||||||
@ -163,7 +163,7 @@ describe('utils/looseEqual', () => {
|
|||||||
const date1 = new Date(2019, 1, 2, 3, 4, 5, 6)
|
const date1 = new Date(2019, 1, 2, 3, 4, 5, 6)
|
||||||
const file1 = new File([''], 'filename.txt', {
|
const file1 = new File([''], 'filename.txt', {
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
lastModified: date1.getTime(),
|
lastModified: date1.getTime()
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(looseEqual(123, '123')).toBe(true)
|
expect(looseEqual(123, '123')).toBe(true)
|
||||||
|
@ -6,7 +6,9 @@ describe('normalizeClass', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('handles array correctly', () => {
|
test('handles array correctly', () => {
|
||||||
expect(normalizeClass(['foo', undefined, true, false, 'bar'])).toEqual('foo bar')
|
expect(normalizeClass(['foo', undefined, true, false, 'bar'])).toEqual(
|
||||||
|
'foo bar'
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('handles object correctly', () => {
|
test('handles object correctly', () => {
|
||||||
|
@ -113,11 +113,9 @@ const camelizeRE = /-(\w)/g
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export const camelize = cacheStringFunction(
|
export const camelize = cacheStringFunction((str: string): string => {
|
||||||
(str: string): string => {
|
|
||||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''))
|
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''))
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
const hyphenateRE = /\B([A-Z])/g
|
const hyphenateRE = /\B([A-Z])/g
|
||||||
/**
|
/**
|
||||||
@ -137,8 +135,8 @@ export const capitalize = cacheStringFunction(
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export const toHandlerKey = cacheStringFunction(
|
export const toHandlerKey = cacheStringFunction((str: string) =>
|
||||||
(str: string) => (str ? `on${capitalize(str)}` : ``)
|
str ? `on${capitalize(str)}` : ``
|
||||||
)
|
)
|
||||||
|
|
||||||
// compare whether a value has changed, accounting for NaN.
|
// compare whether a value has changed, accounting for NaN.
|
||||||
|
@ -72,9 +72,7 @@ window.init = () => {
|
|||||||
lastSuccessfulMap = new SourceMapConsumer(map!)
|
lastSuccessfulMap = new SourceMapConsumer(map!)
|
||||||
lastSuccessfulMap!.computeColumnSpans()
|
lastSuccessfulMap!.computeColumnSpans()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
lastSuccessfulCode = `/* ERROR: ${
|
lastSuccessfulCode = `/* ERROR: ${e.message} (see console for more info) */`
|
||||||
e.message
|
|
||||||
} (see console for more info) */`
|
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
return lastSuccessfulCode
|
return lastSuccessfulCode
|
||||||
@ -195,8 +193,10 @@ window.init = () => {
|
|||||||
if (
|
if (
|
||||||
pos.line != null &&
|
pos.line != null &&
|
||||||
pos.column != null &&
|
pos.column != null &&
|
||||||
!// ignore mock location
|
!(
|
||||||
|
// ignore mock location
|
||||||
(pos.line === 1 && pos.column === 0)
|
(pos.line === 1 && pos.column === 0)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
const translatedPos = {
|
const translatedPos = {
|
||||||
column: pos.column + 1,
|
column: pos.column + 1,
|
||||||
|
@ -48,8 +48,7 @@ const App = {
|
|||||||
h(
|
h(
|
||||||
'a',
|
'a',
|
||||||
{
|
{
|
||||||
href:
|
href: 'https://app.netlify.com/sites/vue-next-template-explorer/deploys',
|
||||||
'https://app.netlify.com/sites/vue-next-template-explorer/deploys',
|
|
||||||
target: `_blank`
|
target: `_blank`
|
||||||
},
|
},
|
||||||
'History'
|
'History'
|
||||||
@ -147,7 +146,9 @@ const App = {
|
|||||||
checked: compilerOptions.hoistStatic && !isSSR,
|
checked: compilerOptions.hoistStatic && !isSSR,
|
||||||
disabled: isSSR,
|
disabled: isSSR,
|
||||||
onChange(e: Event) {
|
onChange(e: Event) {
|
||||||
compilerOptions.hoistStatic = (e.target as HTMLInputElement).checked
|
compilerOptions.hoistStatic = (
|
||||||
|
e.target as HTMLInputElement
|
||||||
|
).checked
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
h('label', { for: 'hoist' }, 'hoistStatic')
|
h('label', { for: 'hoist' }, 'hoistStatic')
|
||||||
@ -161,7 +162,9 @@ const App = {
|
|||||||
checked: usePrefix && compilerOptions.cacheHandlers && !isSSR,
|
checked: usePrefix && compilerOptions.cacheHandlers && !isSSR,
|
||||||
disabled: !usePrefix || isSSR,
|
disabled: !usePrefix || isSSR,
|
||||||
onChange(e: Event) {
|
onChange(e: Event) {
|
||||||
compilerOptions.cacheHandlers = (e.target as HTMLInputElement).checked
|
compilerOptions.cacheHandlers = (
|
||||||
|
e.target as HTMLInputElement
|
||||||
|
).checked
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
h('label', { for: 'cache' }, 'cacheHandlers')
|
h('label', { for: 'cache' }, 'cacheHandlers')
|
||||||
@ -191,7 +194,9 @@ const App = {
|
|||||||
id: 'inline',
|
id: 'inline',
|
||||||
checked: compilerOptions.inline,
|
checked: compilerOptions.inline,
|
||||||
onChange(e: Event) {
|
onChange(e: Event) {
|
||||||
compilerOptions.inline = (e.target as HTMLInputElement).checked
|
compilerOptions.inline = (
|
||||||
|
e.target as HTMLInputElement
|
||||||
|
).checked
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
h('label', { for: 'inline' }, 'inline')
|
h('label', { for: 'inline' }, 'inline')
|
||||||
@ -204,8 +209,9 @@ const App = {
|
|||||||
id: 'compat',
|
id: 'compat',
|
||||||
checked: compilerOptions.compatConfig!.MODE === 2,
|
checked: compilerOptions.compatConfig!.MODE === 2,
|
||||||
onChange(e: Event) {
|
onChange(e: Event) {
|
||||||
compilerOptions.compatConfig!.MODE = (e.target as HTMLInputElement)
|
compilerOptions.compatConfig!.MODE = (
|
||||||
.checked
|
e.target as HTMLInputElement
|
||||||
|
).checked
|
||||||
? 2
|
? 2
|
||||||
: 3
|
: 3
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ test('COMPONENT_FUNCTIONAL', async () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
(deprecationData[DeprecationTypes.COMPONENT_FUNCTIONAL]
|
(
|
||||||
.message as Function)(func)
|
deprecationData[DeprecationTypes.COMPONENT_FUNCTIONAL].message as Function
|
||||||
|
)(func)
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
@ -26,10 +26,7 @@ describe('FILTERS', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reverse(v: string) {
|
function reverse(v: string) {
|
||||||
return v
|
return v.split('').reverse().join('')
|
||||||
.split('')
|
|
||||||
.reverse()
|
|
||||||
.join('')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function double(v: number) {
|
function double(v: number) {
|
||||||
|
@ -145,10 +145,10 @@ describe('GLOBAL_EXTEND', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should not merge nested mixins created with Vue.extend', () => {
|
it('should not merge nested mixins created with Vue.extend', () => {
|
||||||
const a = jest.fn();
|
const a = jest.fn()
|
||||||
const b = jest.fn();
|
const b = jest.fn()
|
||||||
const c = jest.fn();
|
const c = jest.fn()
|
||||||
const d = jest.fn();
|
const d = jest.fn()
|
||||||
const A = Vue.extend({
|
const A = Vue.extend({
|
||||||
created: a
|
created: a
|
||||||
})
|
})
|
||||||
@ -163,7 +163,9 @@ describe('GLOBAL_EXTEND', () => {
|
|||||||
const D = Vue.extend({
|
const D = Vue.extend({
|
||||||
mixins: [C],
|
mixins: [C],
|
||||||
created: d,
|
created: d,
|
||||||
render() { return null },
|
render() {
|
||||||
|
return null
|
||||||
|
}
|
||||||
})
|
})
|
||||||
new D().$mount()
|
new D().$mount()
|
||||||
expect(a.mock.calls.length).toStrictEqual(1)
|
expect(a.mock.calls.length).toStrictEqual(1)
|
||||||
@ -255,7 +257,7 @@ describe('GLOBAL_PROTOTYPE', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('method this context', () => {
|
test('method this context', () => {
|
||||||
Vue.prototype.$test = function() {
|
Vue.prototype.$test = function () {
|
||||||
return this.msg
|
return this.msg
|
||||||
}
|
}
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
|
@ -57,7 +57,7 @@ describe('INSTANCE_EVENT_EMITTER', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('$on', () => {
|
it('$on', () => {
|
||||||
vm.$on('test', function(this: any) {
|
vm.$on('test', function (this: any) {
|
||||||
// expect correct context
|
// expect correct context
|
||||||
expect(this).toBe(vm)
|
expect(this).toBe(vm)
|
||||||
spy.apply(this, arguments)
|
spy.apply(this, arguments)
|
||||||
@ -71,7 +71,7 @@ describe('INSTANCE_EVENT_EMITTER', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('$on multi event', () => {
|
it('$on multi event', () => {
|
||||||
vm.$on(['test1', 'test2'], function(this: any) {
|
vm.$on(['test1', 'test2'], function (this: any) {
|
||||||
expect(this).toBe(vm)
|
expect(this).toBe(vm)
|
||||||
spy.apply(this, arguments)
|
spy.apply(this, arguments)
|
||||||
})
|
})
|
||||||
@ -179,8 +179,10 @@ describe('INSTANCE_EVENT_HOOKS', () => {
|
|||||||
vm.$mount()
|
vm.$mount()
|
||||||
expect(spy).toHaveBeenCalled()
|
expect(spy).toHaveBeenCalled()
|
||||||
expect(
|
expect(
|
||||||
(deprecationData[DeprecationTypes.INSTANCE_EVENT_HOOKS]
|
(
|
||||||
.message as Function)('hook:mounted')
|
deprecationData[DeprecationTypes.INSTANCE_EVENT_HOOKS]
|
||||||
|
.message as Function
|
||||||
|
)('hook:mounted')
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -197,8 +199,10 @@ describe('INSTANCE_EVENT_HOOKS', () => {
|
|||||||
}).$mount()
|
}).$mount()
|
||||||
expect(spy).toHaveBeenCalled()
|
expect(spy).toHaveBeenCalled()
|
||||||
expect(
|
expect(
|
||||||
(deprecationData[DeprecationTypes.INSTANCE_EVENT_HOOKS]
|
(
|
||||||
.message as Function)('hook:mounted')
|
deprecationData[DeprecationTypes.INSTANCE_EVENT_HOOKS]
|
||||||
|
.message as Function
|
||||||
|
)('hook:mounted')
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -319,7 +323,9 @@ test('INSTANCE_ATTR_CLASS_STYLE', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
(deprecationData[DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE]
|
(
|
||||||
.message as Function)('Anonymous')
|
deprecationData[DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE]
|
||||||
|
.message as Function
|
||||||
|
)('Anonymous')
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
@ -213,15 +213,21 @@ test('ATTR_ENUMERATED_COERCION', () => {
|
|||||||
expect(vm.$el.getAttribute('spellcheck')).toBe('true')
|
expect(vm.$el.getAttribute('spellcheck')).toBe('true')
|
||||||
expect(vm.$el.getAttribute('contenteditable')).toBe('true')
|
expect(vm.$el.getAttribute('contenteditable')).toBe('true')
|
||||||
expect(
|
expect(
|
||||||
(deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
|
(
|
||||||
.message as Function)('draggable', null, 'false')
|
deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
|
||||||
|
.message as Function
|
||||||
|
)('draggable', null, 'false')
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
expect(
|
expect(
|
||||||
(deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
|
(
|
||||||
.message as Function)('spellcheck', 0, 'true')
|
deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
|
||||||
|
.message as Function
|
||||||
|
)('spellcheck', 0, 'true')
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
expect(
|
expect(
|
||||||
(deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
|
(
|
||||||
.message as Function)('contenteditable', 'foo', 'true')
|
deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
|
||||||
|
.message as Function
|
||||||
|
)('contenteditable', 'foo', 'true')
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
@ -79,9 +79,9 @@ function compileToFunction(
|
|||||||
// with keys that cannot be mangled, and can be quite heavy size-wise.
|
// with keys that cannot be mangled, and can be quite heavy size-wise.
|
||||||
// In the global build we know `Vue` is available globally so we can avoid
|
// In the global build we know `Vue` is available globally so we can avoid
|
||||||
// the wildcard object.
|
// the wildcard object.
|
||||||
const render = (__GLOBAL__
|
const render = (
|
||||||
? new Function(code)()
|
__GLOBAL__ ? new Function(code)() : new Function('Vue', code)(runtimeDom)
|
||||||
: new Function('Vue', code)(runtimeDom)) as RenderFunction
|
) as RenderFunction
|
||||||
|
|
||||||
// mark the function as runtime compiled
|
// mark the function as runtime compiled
|
||||||
;(render as InternalRenderFunction)._rc = true
|
;(render as InternalRenderFunction)._rc = true
|
||||||
|
@ -3,15 +3,8 @@ import path from 'path'
|
|||||||
import { h, createApp, Transition, ref, nextTick } from 'vue'
|
import { h, createApp, Transition, ref, nextTick } from 'vue'
|
||||||
|
|
||||||
describe('e2e: Transition', () => {
|
describe('e2e: Transition', () => {
|
||||||
const {
|
const { page, html, classList, isVisible, timeout, nextFrame, click } =
|
||||||
page,
|
setupPuppeteer()
|
||||||
html,
|
|
||||||
classList,
|
|
||||||
isVisible,
|
|
||||||
timeout,
|
|
||||||
nextFrame,
|
|
||||||
click
|
|
||||||
} = setupPuppeteer()
|
|
||||||
const baseUrl = `file://${path.resolve(__dirname, './transition.html')}`
|
const baseUrl = `file://${path.resolve(__dirname, './transition.html')}`
|
||||||
|
|
||||||
const duration = process.env.CI ? 200 : 50
|
const duration = process.env.CI ? 200 : 50
|
||||||
@ -21,7 +14,7 @@ describe('e2e: Transition', () => {
|
|||||||
|
|
||||||
const classWhenTransitionStart = () =>
|
const classWhenTransitionStart = () =>
|
||||||
page().evaluate(() => {
|
page().evaluate(() => {
|
||||||
(document.querySelector('#toggleBtn') as any)!.click()
|
;(document.querySelector('#toggleBtn') as any)!.click()
|
||||||
return Promise.resolve().then(() => {
|
return Promise.resolve().then(() => {
|
||||||
return document.querySelector('#container div')!.className.split(/\s+/g)
|
return document.querySelector('#container div')!.className.split(/\s+/g)
|
||||||
})
|
})
|
||||||
@ -1066,7 +1059,7 @@ describe('e2e: Transition', () => {
|
|||||||
|
|
||||||
// change view -> 'two'
|
// change view -> 'two'
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
(document.querySelector('#changeViewBtn') as any)!.click()
|
;(document.querySelector('#changeViewBtn') as any)!.click()
|
||||||
})
|
})
|
||||||
// enter
|
// enter
|
||||||
expect(await classWhenTransitionStart()).toStrictEqual([
|
expect(await classWhenTransitionStart()).toStrictEqual([
|
||||||
@ -1085,7 +1078,7 @@ describe('e2e: Transition', () => {
|
|||||||
|
|
||||||
// change view -> 'one'
|
// change view -> 'one'
|
||||||
await page().evaluate(() => {
|
await page().evaluate(() => {
|
||||||
(document.querySelector('#changeViewBtn') as any)!.click()
|
;(document.querySelector('#changeViewBtn') as any)!.click()
|
||||||
})
|
})
|
||||||
// leave
|
// leave
|
||||||
expect(await classWhenTransitionStart()).toStrictEqual([
|
expect(await classWhenTransitionStart()).toStrictEqual([
|
||||||
@ -1172,7 +1165,7 @@ describe('e2e: Transition', () => {
|
|||||||
|
|
||||||
// enter
|
// enter
|
||||||
const enterClass = await page().evaluate(async () => {
|
const enterClass = await page().evaluate(async () => {
|
||||||
(document.querySelector('#toggleBtn') as any)!.click()
|
;(document.querySelector('#toggleBtn') as any)!.click()
|
||||||
// nextTrick for patch start
|
// nextTrick for patch start
|
||||||
await Promise.resolve()
|
await Promise.resolve()
|
||||||
// nextTrick for Suspense resolve
|
// nextTrick for Suspense resolve
|
||||||
@ -2001,10 +1994,8 @@ describe('e2e: Transition', () => {
|
|||||||
const root = document.createElement('div')
|
const root = document.createElement('div')
|
||||||
createApp({
|
createApp({
|
||||||
render() {
|
render() {
|
||||||
return h(
|
return h(MyTransition, { onLeave: () => outerSpy() }, () =>
|
||||||
MyTransition,
|
toggle.value ? h('div') : null
|
||||||
{ onLeave: () => outerSpy() },
|
|
||||||
() => (toggle.value ? h('div') : null)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}).mount(root)
|
}).mount(root)
|
||||||
|
@ -11,7 +11,7 @@ describe('e2e: TransitionGroup', () => {
|
|||||||
|
|
||||||
const htmlWhenTransitionStart = () =>
|
const htmlWhenTransitionStart = () =>
|
||||||
page().evaluate(() => {
|
page().evaluate(() => {
|
||||||
(document.querySelector('#toggleBtn') as any)!.click()
|
;(document.querySelector('#toggleBtn') as any)!.click()
|
||||||
return Promise.resolve().then(() => {
|
return Promise.resolve().then(() => {
|
||||||
return document.querySelector('#container')!.innerHTML
|
return document.querySelector('#container')!.innerHTML
|
||||||
})
|
})
|
||||||
|
@ -18,11 +18,9 @@ export default {
|
|||||||
message: 'test: add test for runtime-dom/modules/class (#75)',
|
message: 'test: add test for runtime-dom/modules/class (#75)',
|
||||||
tree: {
|
tree: {
|
||||||
sha: 'f53f761827af281db86c31d113086c068c1d0789',
|
sha: 'f53f761827af281db86c31d113086c068c1d0789',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/trees/f53f761827af281db86c31d113086c068c1d0789'
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/trees/f53f761827af281db86c31d113086c068c1d0789'
|
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/commits/d1527fbee422c7170e56845e55b49c4fd6de72a7',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/commits/d1527fbee422c7170e56845e55b49c4fd6de72a7',
|
|
||||||
comment_count: 0,
|
comment_count: 0,
|
||||||
verification: {
|
verification: {
|
||||||
verified: false,
|
verified: false,
|
||||||
@ -31,8 +29,7 @@ export default {
|
|||||||
payload: null
|
payload: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/d1527fbee422c7170e56845e55b49c4fd6de72a7',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/d1527fbee422c7170e56845e55b49c4fd6de72a7',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/d1527fbee422c7170e56845e55b49c4fd6de72a7',
|
'https://github.com/vuejs/vue-next/commit/d1527fbee422c7170e56845e55b49c4fd6de72a7',
|
||||||
comments_url:
|
comments_url:
|
||||||
@ -87,8 +84,7 @@ export default {
|
|||||||
parents: [
|
parents: [
|
||||||
{
|
{
|
||||||
sha: '2383b45e322272ddc102d6914c149b284a25d04f',
|
sha: '2383b45e322272ddc102d6914c149b284a25d04f',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/2383b45e322272ddc102d6914c149b284a25d04f',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/2383b45e322272ddc102d6914c149b284a25d04f',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/2383b45e322272ddc102d6914c149b284a25d04f'
|
'https://github.com/vuejs/vue-next/commit/2383b45e322272ddc102d6914c149b284a25d04f'
|
||||||
}
|
}
|
||||||
@ -112,11 +108,9 @@ export default {
|
|||||||
message: 'chore: fix typo (#530) [ci skip]',
|
message: 'chore: fix typo (#530) [ci skip]',
|
||||||
tree: {
|
tree: {
|
||||||
sha: '2a5872ff8dc8ccb8121abd7e890ac3c0c9f1209f',
|
sha: '2a5872ff8dc8ccb8121abd7e890ac3c0c9f1209f',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/trees/2a5872ff8dc8ccb8121abd7e890ac3c0c9f1209f'
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/trees/2a5872ff8dc8ccb8121abd7e890ac3c0c9f1209f'
|
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/commits/2383b45e322272ddc102d6914c149b284a25d04f',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/commits/2383b45e322272ddc102d6914c149b284a25d04f',
|
|
||||||
comment_count: 0,
|
comment_count: 0,
|
||||||
verification: {
|
verification: {
|
||||||
verified: false,
|
verified: false,
|
||||||
@ -125,8 +119,7 @@ export default {
|
|||||||
payload: null
|
payload: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/2383b45e322272ddc102d6914c149b284a25d04f',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/2383b45e322272ddc102d6914c149b284a25d04f',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/2383b45e322272ddc102d6914c149b284a25d04f',
|
'https://github.com/vuejs/vue-next/commit/2383b45e322272ddc102d6914c149b284a25d04f',
|
||||||
comments_url:
|
comments_url:
|
||||||
@ -182,8 +175,7 @@ export default {
|
|||||||
parents: [
|
parents: [
|
||||||
{
|
{
|
||||||
sha: 'e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
sha: 'e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad'
|
'https://github.com/vuejs/vue-next/commit/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad'
|
||||||
}
|
}
|
||||||
@ -207,11 +199,9 @@ export default {
|
|||||||
message: 'test: fix warning',
|
message: 'test: fix warning',
|
||||||
tree: {
|
tree: {
|
||||||
sha: 'd942b17681e2e2fbbcd2ee04092390c7f2cf534d',
|
sha: 'd942b17681e2e2fbbcd2ee04092390c7f2cf534d',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/trees/d942b17681e2e2fbbcd2ee04092390c7f2cf534d'
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/trees/d942b17681e2e2fbbcd2ee04092390c7f2cf534d'
|
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/commits/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/commits/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
|
||||||
comment_count: 0,
|
comment_count: 0,
|
||||||
verification: {
|
verification: {
|
||||||
verified: false,
|
verified: false,
|
||||||
@ -220,8 +210,7 @@ export default {
|
|||||||
payload: null
|
payload: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
'https://github.com/vuejs/vue-next/commit/e7e1314cccd1a66fcf8b8526ec21350ec16cc3ad',
|
||||||
comments_url:
|
comments_url:
|
||||||
@ -277,8 +266,7 @@ export default {
|
|||||||
parents: [
|
parents: [
|
||||||
{
|
{
|
||||||
sha: '12ec62e6881f83dfa6c7f8a3c3650ec2567e6b1e',
|
sha: '12ec62e6881f83dfa6c7f8a3c3650ec2567e6b1e',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/12ec62e6881f83dfa6c7f8a3c3650ec2567e6b1e',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/12ec62e6881f83dfa6c7f8a3c3650ec2567e6b1e',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/12ec62e6881f83dfa6c7f8a3c3650ec2567e6b1e'
|
'https://github.com/vuejs/vue-next/commit/12ec62e6881f83dfa6c7f8a3c3650ec2567e6b1e'
|
||||||
}
|
}
|
||||||
@ -304,11 +292,9 @@ export default {
|
|||||||
message: 'chore: fix tests',
|
message: 'chore: fix tests',
|
||||||
tree: {
|
tree: {
|
||||||
sha: '6ac7bd078a6eb0ad32b5102e0c5d2c29f2b20a48',
|
sha: '6ac7bd078a6eb0ad32b5102e0c5d2c29f2b20a48',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/trees/6ac7bd078a6eb0ad32b5102e0c5d2c29f2b20a48'
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/trees/6ac7bd078a6eb0ad32b5102e0c5d2c29f2b20a48'
|
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/commits/ecf4da822eea97f5db5fa769d39f994755384a4b',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/commits/ecf4da822eea97f5db5fa769d39f994755384a4b',
|
|
||||||
comment_count: 0,
|
comment_count: 0,
|
||||||
verification: {
|
verification: {
|
||||||
verified: false,
|
verified: false,
|
||||||
@ -317,8 +303,7 @@ export default {
|
|||||||
payload: null
|
payload: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/ecf4da822eea97f5db5fa769d39f994755384a4b',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/ecf4da822eea97f5db5fa769d39f994755384a4b',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/ecf4da822eea97f5db5fa769d39f994755384a4b',
|
'https://github.com/vuejs/vue-next/commit/ecf4da822eea97f5db5fa769d39f994755384a4b',
|
||||||
comments_url:
|
comments_url:
|
||||||
@ -374,8 +359,7 @@ export default {
|
|||||||
parents: [
|
parents: [
|
||||||
{
|
{
|
||||||
sha: 'ca296812d54aff123472d7147b83fddfb634d9bc',
|
sha: 'ca296812d54aff123472d7147b83fddfb634d9bc',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/ca296812d54aff123472d7147b83fddfb634d9bc',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/ca296812d54aff123472d7147b83fddfb634d9bc',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/ca296812d54aff123472d7147b83fddfb634d9bc'
|
'https://github.com/vuejs/vue-next/commit/ca296812d54aff123472d7147b83fddfb634d9bc'
|
||||||
}
|
}
|
||||||
@ -399,11 +383,9 @@ export default {
|
|||||||
message: 'refactor: bring back clone for reused nodes',
|
message: 'refactor: bring back clone for reused nodes',
|
||||||
tree: {
|
tree: {
|
||||||
sha: '2cec32c97686e0ee9af1b87f0abdbbbdc18b6de6',
|
sha: '2cec32c97686e0ee9af1b87f0abdbbbdc18b6de6',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/trees/2cec32c97686e0ee9af1b87f0abdbbbdc18b6de6'
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/trees/2cec32c97686e0ee9af1b87f0abdbbbdc18b6de6'
|
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/commits/ca296812d54aff123472d7147b83fddfb634d9bc',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/commits/ca296812d54aff123472d7147b83fddfb634d9bc',
|
|
||||||
comment_count: 0,
|
comment_count: 0,
|
||||||
verification: {
|
verification: {
|
||||||
verified: false,
|
verified: false,
|
||||||
@ -412,8 +394,7 @@ export default {
|
|||||||
payload: null
|
payload: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/ca296812d54aff123472d7147b83fddfb634d9bc',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/ca296812d54aff123472d7147b83fddfb634d9bc',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/ca296812d54aff123472d7147b83fddfb634d9bc',
|
'https://github.com/vuejs/vue-next/commit/ca296812d54aff123472d7147b83fddfb634d9bc',
|
||||||
comments_url:
|
comments_url:
|
||||||
@ -469,8 +450,7 @@ export default {
|
|||||||
parents: [
|
parents: [
|
||||||
{
|
{
|
||||||
sha: 'e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
sha: 'e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b'
|
'https://github.com/vuejs/vue-next/commit/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b'
|
||||||
}
|
}
|
||||||
@ -494,11 +474,9 @@ export default {
|
|||||||
message: 'chore: relax render type for tsx',
|
message: 'chore: relax render type for tsx',
|
||||||
tree: {
|
tree: {
|
||||||
sha: '7e2b3bb92ab91f755b2251e4a7903e6dd2042602',
|
sha: '7e2b3bb92ab91f755b2251e4a7903e6dd2042602',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/trees/7e2b3bb92ab91f755b2251e4a7903e6dd2042602'
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/trees/7e2b3bb92ab91f755b2251e4a7903e6dd2042602'
|
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/git/commits/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/git/commits/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
|
||||||
comment_count: 0,
|
comment_count: 0,
|
||||||
verification: {
|
verification: {
|
||||||
verified: false,
|
verified: false,
|
||||||
@ -507,8 +485,7 @@ export default {
|
|||||||
payload: null
|
payload: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
'https://github.com/vuejs/vue-next/commit/e6be55a4989edb6f8750dbaa14eb693ec1f0d67b',
|
||||||
comments_url:
|
comments_url:
|
||||||
@ -564,8 +541,7 @@ export default {
|
|||||||
parents: [
|
parents: [
|
||||||
{
|
{
|
||||||
sha: 'ccc835caff0344baad3c92ce786ad4f804bf667b',
|
sha: 'ccc835caff0344baad3c92ce786ad4f804bf667b',
|
||||||
url:
|
url: 'https://api.github.com/repos/vuejs/vue-next/commits/ccc835caff0344baad3c92ce786ad4f804bf667b',
|
||||||
'https://api.github.com/repos/vuejs/vue-next/commits/ccc835caff0344baad3c92ce786ad4f804bf667b',
|
|
||||||
html_url:
|
html_url:
|
||||||
'https://github.com/vuejs/vue-next/commit/ccc835caff0344baad3c92ce786ad4f804bf667b'
|
'https://github.com/vuejs/vue-next/commit/ccc835caff0344baad3c92ce786ad4f804bf667b'
|
||||||
}
|
}
|
||||||
|
@ -74,9 +74,9 @@ function compileToFunction(
|
|||||||
// with keys that cannot be mangled, and can be quite heavy size-wise.
|
// with keys that cannot be mangled, and can be quite heavy size-wise.
|
||||||
// In the global build we know `Vue` is available globally so we can avoid
|
// In the global build we know `Vue` is available globally so we can avoid
|
||||||
// the wildcard object.
|
// the wildcard object.
|
||||||
const render = (__GLOBAL__
|
const render = (
|
||||||
? new Function(code)()
|
__GLOBAL__ ? new Function(code)() : new Function('Vue', code)(runtimeDom)
|
||||||
: new Function('Vue', code)(runtimeDom)) as RenderFunction
|
) as RenderFunction
|
||||||
|
|
||||||
// mark the function as runtime compiled
|
// mark the function as runtime compiled
|
||||||
;(render as InternalRenderFunction)._rc = true
|
;(render as InternalRenderFunction)._rc = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user