6
6
ParserOptions ,
7
7
RootNode ,
8
8
noopDirectiveTransform ,
9
- TransformPreset ,
10
- getBaseTransformPreset
9
+ NodeTransform ,
10
+ DirectiveTransform
11
11
} from '@vue/compiler-core'
12
12
import { parserOptionsMinimal } from './parserOptionsMinimal'
13
13
import { parserOptionsStandard } from './parserOptionsStandard'
@@ -23,43 +23,30 @@ export const parserOptions = __BROWSER__
23
23
? parserOptionsMinimal
24
24
: parserOptionsStandard
25
25
26
- export function getDOMTransformPreset (
27
- prefixIdentifiers ?: boolean
28
- ) : TransformPreset {
29
- const [ nodeTransforms , directiveTransforms ] = getBaseTransformPreset (
30
- prefixIdentifiers
31
- )
32
- return [
33
- [
34
- ...nodeTransforms ,
35
- transformStyle ,
36
- ...( __DEV__ ? [ warnTransitionChildren ] : [ ] )
37
- ] ,
38
- {
39
- ...directiveTransforms ,
40
- cloak : noopDirectiveTransform ,
41
- html : transformVHtml ,
42
- text : transformVText ,
43
- model : transformModel , // override compiler-core
44
- on : transformOn , // override compiler-core
45
- show : transformShow
46
- }
47
- ]
26
+ export const DOMNodeTransforms : NodeTransform [ ] = [
27
+ transformStyle ,
28
+ ...( __DEV__ ? [ warnTransitionChildren ] : [ ] )
29
+ ]
30
+
31
+ export const DOMDirectiveTransforms : Record < string , DirectiveTransform > = {
32
+ cloak : noopDirectiveTransform ,
33
+ html : transformVHtml ,
34
+ text : transformVText ,
35
+ model : transformModel , // override compiler-core
36
+ on : transformOn , // override compiler-core
37
+ show : transformShow
48
38
}
49
39
50
40
export function compile (
51
41
template : string ,
52
42
options : CompilerOptions = { }
53
43
) : CodegenResult {
54
- const [ nodeTransforms , directiveTransforms ] = getDOMTransformPreset (
55
- options . prefixIdentifiers
56
- )
57
44
return baseCompile ( template , {
58
45
...parserOptions ,
59
46
...options ,
60
- nodeTransforms : [ ...nodeTransforms , ...( options . nodeTransforms || [ ] ) ] ,
47
+ nodeTransforms : [ ...DOMNodeTransforms , ...( options . nodeTransforms || [ ] ) ] ,
61
48
directiveTransforms : {
62
- ...directiveTransforms ,
49
+ ...DOMDirectiveTransforms ,
63
50
...( options . directiveTransforms || { } )
64
51
}
65
52
} )
0 commit comments