refactor: move transformStyle to compiler-dom

This commit is contained in:
Evan You 2019-10-03 16:55:14 -04:00
parent c2fc7e3347
commit 3354837ce1
11 changed files with 11 additions and 8 deletions

View File

@ -21,8 +21,8 @@ import {
RootNode
} from '../../src/ast'
import { transformElement } from '../../src/transforms/transformElement'
import { transformStyle } from '../../../compiler-dom/src/transforms/transformStyle'
import { transformOn } from '../../src/transforms/vOn'
import { transformStyle } from '../../src/transforms/transformStyle'
import { transformBind } from '../../src/transforms/vBind'
import { PatchFlags } from '@vue/shared'
import { createObjectMatcher } from '../testUtils'

View File

@ -6,7 +6,6 @@ import { isString } from '@vue/shared'
import { transformIf } from './transforms/vIf'
import { transformFor } from './transforms/vFor'
import { transformExpression } from './transforms/transformExpression'
import { transformStyle } from './transforms/transformStyle'
import { transformSlotOutlet } from './transforms/transfromSlotOutlet'
import { transformElement } from './transforms/transformElement'
import { transformOn } from './transforms/vOn'
@ -54,7 +53,6 @@ export function baseCompile(
: []),
trackSlotScopes,
optimizeText,
transformStyle,
transformSlotOutlet,
transformElement,
...(options.nodeTransforms || []) // user transforms

View File

@ -4,10 +4,10 @@ import {
CompilerOptions,
ElementNode,
NodeTypes
} from '../../src'
} from '@vue/compiler-core'
import { transformBind } from '../../../compiler-core/src/transforms/vBind'
import { transformElement } from '../../../compiler-core/src/transforms/transformElement'
import { transformStyle } from '../../src/transforms/transformStyle'
import { transformBind } from '../../src/transforms/vBind'
import { transformElement } from '../../src/transforms/transformElement'
function transformWithStyleTransform(
template: string,

View File

@ -1,6 +1,7 @@
import { baseCompile, CompilerOptions, CodegenResult } from '@vue/compiler-core'
import { parserOptionsMinimal } from './parserOptionsMinimal'
import { parserOptionsStandard } from './parserOptionsStandard'
import { transformStyle } from './transforms/transformStyle'
export function compile(
template: string,
@ -9,6 +10,7 @@ export function compile(
return baseCompile(template, {
...options,
...(__BROWSER__ ? parserOptionsMinimal : parserOptionsStandard),
nodeTransforms: [transformStyle, ...(options.nodeTransforms || [])],
directiveTransforms: {
// TODO include DOM-specific directiveTransforms
...(options.directiveTransforms || {})

View File

@ -1,5 +1,8 @@
import { NodeTransform } from '../transform'
import { NodeTypes, createSimpleExpression } from '../ast'
import {
NodeTransform,
NodeTypes,
createSimpleExpression
} from '@vue/compiler-core'
// Parse inline CSS strings for static style attributes into an object.
// This is a NodeTransform since it works on the static `style` attribute and