feat(ssr): support custom directive getSSRProps in optimized compilation

close #5304
This commit is contained in:
Evan You
2022-02-04 08:58:28 +08:00
parent a51f935b72
commit 60cf175d88
14 changed files with 228 additions and 45 deletions

View File

@@ -54,7 +54,9 @@ export {
export {
transformElement,
resolveComponentType,
buildProps
buildProps,
buildDirectiveArgs,
PropsExpression
} from './transforms/transformElement'
export { processSlotOutlet } from './transforms/transformSlotOutlet'
export { generateCodeFrame } from '@vue/shared'

View File

@@ -29,7 +29,8 @@ import {
isObject,
isReservedProp,
capitalize,
camelize
camelize,
isBuiltInDirective
} from '@vue/shared'
import { createCompilerError, ErrorCodes } from '../errors'
import {
@@ -665,7 +666,7 @@ export function buildProps(
directiveImportMap.set(prop, needRuntime)
}
}
} else {
} else if (!isBuiltInDirective(name)) {
// no built-in transform, this is a user custom directive.
runtimeDirectives.push(prop)
// custom dirs may use beforeUpdate so they need to force blocks
@@ -853,7 +854,7 @@ function mergeAsArray(existing: Property, incoming: Property) {
}
}
function buildDirectiveArgs(
export function buildDirectiveArgs(
dir: DirectiveNode,
context: TransformContext
): ArrayExpression {