refactor: move transformStyle to compiler-dom
This commit is contained in:
parent
c2fc7e3347
commit
3354837ce1
@ -21,8 +21,8 @@ import {
|
|||||||
RootNode
|
RootNode
|
||||||
} from '../../src/ast'
|
} from '../../src/ast'
|
||||||
import { transformElement } from '../../src/transforms/transformElement'
|
import { transformElement } from '../../src/transforms/transformElement'
|
||||||
|
import { transformStyle } from '../../../compiler-dom/src/transforms/transformStyle'
|
||||||
import { transformOn } from '../../src/transforms/vOn'
|
import { transformOn } from '../../src/transforms/vOn'
|
||||||
import { transformStyle } from '../../src/transforms/transformStyle'
|
|
||||||
import { transformBind } from '../../src/transforms/vBind'
|
import { transformBind } from '../../src/transforms/vBind'
|
||||||
import { PatchFlags } from '@vue/shared'
|
import { PatchFlags } from '@vue/shared'
|
||||||
import { createObjectMatcher } from '../testUtils'
|
import { createObjectMatcher } from '../testUtils'
|
||||||
|
@ -6,7 +6,6 @@ import { isString } from '@vue/shared'
|
|||||||
import { transformIf } from './transforms/vIf'
|
import { transformIf } from './transforms/vIf'
|
||||||
import { transformFor } from './transforms/vFor'
|
import { transformFor } from './transforms/vFor'
|
||||||
import { transformExpression } from './transforms/transformExpression'
|
import { transformExpression } from './transforms/transformExpression'
|
||||||
import { transformStyle } from './transforms/transformStyle'
|
|
||||||
import { transformSlotOutlet } from './transforms/transfromSlotOutlet'
|
import { transformSlotOutlet } from './transforms/transfromSlotOutlet'
|
||||||
import { transformElement } from './transforms/transformElement'
|
import { transformElement } from './transforms/transformElement'
|
||||||
import { transformOn } from './transforms/vOn'
|
import { transformOn } from './transforms/vOn'
|
||||||
@ -54,7 +53,6 @@ export function baseCompile(
|
|||||||
: []),
|
: []),
|
||||||
trackSlotScopes,
|
trackSlotScopes,
|
||||||
optimizeText,
|
optimizeText,
|
||||||
transformStyle,
|
|
||||||
transformSlotOutlet,
|
transformSlotOutlet,
|
||||||
transformElement,
|
transformElement,
|
||||||
...(options.nodeTransforms || []) // user transforms
|
...(options.nodeTransforms || []) // user transforms
|
||||||
|
@ -4,10 +4,10 @@ import {
|
|||||||
CompilerOptions,
|
CompilerOptions,
|
||||||
ElementNode,
|
ElementNode,
|
||||||
NodeTypes
|
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 { transformStyle } from '../../src/transforms/transformStyle'
|
||||||
import { transformBind } from '../../src/transforms/vBind'
|
|
||||||
import { transformElement } from '../../src/transforms/transformElement'
|
|
||||||
|
|
||||||
function transformWithStyleTransform(
|
function transformWithStyleTransform(
|
||||||
template: string,
|
template: string,
|
@ -1,6 +1,7 @@
|
|||||||
import { baseCompile, CompilerOptions, CodegenResult } from '@vue/compiler-core'
|
import { baseCompile, CompilerOptions, CodegenResult } from '@vue/compiler-core'
|
||||||
import { parserOptionsMinimal } from './parserOptionsMinimal'
|
import { parserOptionsMinimal } from './parserOptionsMinimal'
|
||||||
import { parserOptionsStandard } from './parserOptionsStandard'
|
import { parserOptionsStandard } from './parserOptionsStandard'
|
||||||
|
import { transformStyle } from './transforms/transformStyle'
|
||||||
|
|
||||||
export function compile(
|
export function compile(
|
||||||
template: string,
|
template: string,
|
||||||
@ -9,6 +10,7 @@ export function compile(
|
|||||||
return baseCompile(template, {
|
return baseCompile(template, {
|
||||||
...options,
|
...options,
|
||||||
...(__BROWSER__ ? parserOptionsMinimal : parserOptionsStandard),
|
...(__BROWSER__ ? parserOptionsMinimal : parserOptionsStandard),
|
||||||
|
nodeTransforms: [transformStyle, ...(options.nodeTransforms || [])],
|
||||||
directiveTransforms: {
|
directiveTransforms: {
|
||||||
// TODO include DOM-specific directiveTransforms
|
// TODO include DOM-specific directiveTransforms
|
||||||
...(options.directiveTransforms || {})
|
...(options.directiveTransforms || {})
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { NodeTransform } from '../transform'
|
import {
|
||||||
import { NodeTypes, createSimpleExpression } from '../ast'
|
NodeTransform,
|
||||||
|
NodeTypes,
|
||||||
|
createSimpleExpression
|
||||||
|
} from '@vue/compiler-core'
|
||||||
|
|
||||||
// Parse inline CSS strings for static style attributes into an object.
|
// Parse inline CSS strings for static style attributes into an object.
|
||||||
// This is a NodeTransform since it works on the static `style` attribute and
|
// This is a NodeTransform since it works on the static `style` attribute and
|
Loading…
Reference in New Issue
Block a user