refactor(compiler-core): centralize compiler options

This commit is contained in:
Evan You
2019-12-10 12:53:26 -05:00
parent 03301b264e
commit 5cd1495767
7 changed files with 92 additions and 79 deletions

View File

@@ -1,3 +1,4 @@
import { TransformOptions } from './options'
import {
RootNode,
NodeTypes,
@@ -18,7 +19,7 @@ import {
createCacheExpression
} from './ast'
import { isString, isArray, NOOP } from '@vue/shared'
import { CompilerError, defaultOnError } from './errors'
import { defaultOnError } from './errors'
import {
TO_STRING,
FRAGMENT,
@@ -65,17 +66,7 @@ export type StructuralDirectiveTransform = (
context: TransformContext
) => void | (() => void)
export interface TransformOptions {
nodeTransforms?: NodeTransform[]
directiveTransforms?: { [name: string]: DirectiveTransform }
isBuiltInComponent?: (tag: string) => symbol | void
prefixIdentifiers?: boolean
hoistStatic?: boolean
cacheHandlers?: boolean
onError?: (error: CompilerError) => void
}
export interface ImportsOption {
export interface ImportItem {
exp: string | ExpressionNode
path: string
}
@@ -86,7 +77,7 @@ export interface TransformContext extends Required<TransformOptions> {
components: Set<string>
directives: Set<string>
hoists: JSChildNode[]
imports: Set<ImportsOption>
imports: Set<ImportItem>
cached: number
identifiers: { [name: string]: number | undefined }
scopes: {