@@ -63,7 +63,10 @@ const transformContext: CompilerDOM.TransformContext = {
63
63
expressionPlugins : [ 'typescript' ] ,
64
64
} ;
65
65
66
- type _CodeAndStack = [ codeType : 'ts' | 'tsFormat' | 'inlineCss' , ...codeAndStack : CodeAndStack ] ;
66
+ export type _CodeAndStack = [
67
+ codeType : 'ts' | 'tsFormat' ,
68
+ ...codeAndStack : CodeAndStack ,
69
+ ] ;
67
70
68
71
export function * generate (
69
72
ts : typeof import ( 'typescript' ) ,
@@ -111,9 +114,6 @@ export function* generate(
111
114
const _tsFormat = codegenStack
112
115
? ( code : Code ) : _CodeAndStack => [ 'tsFormat' , code , getStack ( ) ]
113
116
: ( code : Code ) : _CodeAndStack => [ 'tsFormat' , code , '' ] ;
114
- const _inlineCss = codegenStack
115
- ? ( code : Code ) : _CodeAndStack => [ 'inlineCss' , code , getStack ( ) ]
116
- : ( code : Code ) : _CodeAndStack => [ 'inlineCss' , code , '' ] ;
117
117
const nativeTags = new Set ( vueCompilerOptions . nativeTags ) ;
118
118
const slots = new Map < string , {
119
119
name ?: string ;
@@ -180,7 +180,7 @@ export function* generate(
180
180
return tagOffsetsMap ;
181
181
}
182
182
183
- for ( const node of eachElementNode ( template . ast ) ) {
183
+ for ( const node of forEachElementNode ( template . ast ) ) {
184
184
if ( node . tag === 'slot' ) {
185
185
// ignore
186
186
}
@@ -818,8 +818,6 @@ export function* generate(
818
818
}
819
819
}
820
820
821
- yield * generateInlineCss ( props ) ;
822
-
823
821
const vScope = props . find ( prop => prop . type === CompilerDOM . NodeTypes . DIRECTIVE && ( prop . name === 'scope' || prop . name === 'data' ) ) ;
824
822
let inScope = false ;
825
823
let originalConditionsNum = blockConditions . length ;
@@ -1422,36 +1420,6 @@ export function* generate(
1422
1420
}
1423
1421
}
1424
1422
1425
- function * generateInlineCss ( props : CompilerDOM . ElementNode [ 'props' ] ) : Generator < _CodeAndStack > {
1426
- for ( const prop of props ) {
1427
- if (
1428
- prop . type === CompilerDOM . NodeTypes . DIRECTIVE
1429
- && prop . name === 'bind'
1430
- && prop . arg ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION
1431
- && prop . exp ?. type === CompilerDOM . NodeTypes . SIMPLE_EXPRESSION
1432
- && prop . arg . content === 'style'
1433
- && prop . exp . constType === CompilerDOM . ConstantTypes . CAN_STRINGIFY
1434
- ) {
1435
- const endCrt = prop . arg . loc . source [ prop . arg . loc . source . length - 1 ] ; // " | '
1436
- const start = prop . arg . loc . source . indexOf ( endCrt ) + 1 ;
1437
- const end = prop . arg . loc . source . lastIndexOf ( endCrt ) ;
1438
- const content = prop . arg . loc . source . substring ( start , end ) ;
1439
-
1440
- yield _inlineCss ( `x { ` ) ;
1441
- yield _inlineCss ( [
1442
- content ,
1443
- 'template' ,
1444
- prop . arg . loc . start . offset + start ,
1445
- enableAllFeatures ( {
1446
- format : false ,
1447
- structure : false ,
1448
- } ) ,
1449
- ] ) ;
1450
- yield _inlineCss ( ` }\n` ) ;
1451
- }
1452
- }
1453
- }
1454
-
1455
1423
function * generateDirectives ( node : CompilerDOM . ElementNode ) : Generator < _CodeAndStack > {
1456
1424
for ( const prop of node . props ) {
1457
1425
if (
@@ -1986,21 +1954,21 @@ function getPossibleOriginalComponentNames(tagText: string) {
1986
1954
] ) ] ;
1987
1955
}
1988
1956
1989
- export function * eachElementNode ( node : CompilerDOM . RootNode | CompilerDOM . TemplateChildNode ) : Generator < CompilerDOM . ElementNode > {
1957
+ export function * forEachElementNode ( node : CompilerDOM . RootNode | CompilerDOM . TemplateChildNode ) : Generator < CompilerDOM . ElementNode > {
1990
1958
if ( node . type === CompilerDOM . NodeTypes . ROOT ) {
1991
1959
for ( const child of node . children ) {
1992
- yield * eachElementNode ( child ) ;
1960
+ yield * forEachElementNode ( child ) ;
1993
1961
}
1994
1962
}
1995
1963
else if ( node . type === CompilerDOM . NodeTypes . ELEMENT ) {
1996
1964
const patchForNode = getVForNode ( node ) ;
1997
1965
if ( patchForNode ) {
1998
- yield * eachElementNode ( patchForNode ) ;
1966
+ yield * forEachElementNode ( patchForNode ) ;
1999
1967
}
2000
1968
else {
2001
1969
yield node ;
2002
1970
for ( const child of node . children ) {
2003
- yield * eachElementNode ( child ) ;
1971
+ yield * forEachElementNode ( child ) ;
2004
1972
}
2005
1973
}
2006
1974
}
@@ -2009,14 +1977,14 @@ export function* eachElementNode(node: CompilerDOM.RootNode | CompilerDOM.Templa
2009
1977
for ( let i = 0 ; i < node . branches . length ; i ++ ) {
2010
1978
const branch = node . branches [ i ] ;
2011
1979
for ( const childNode of branch . children ) {
2012
- yield * eachElementNode ( childNode ) ;
1980
+ yield * forEachElementNode ( childNode ) ;
2013
1981
}
2014
1982
}
2015
1983
}
2016
1984
else if ( node . type === CompilerDOM . NodeTypes . FOR ) {
2017
1985
// v-for
2018
1986
for ( const child of node . children ) {
2019
- yield * eachElementNode ( child ) ;
1987
+ yield * forEachElementNode ( child ) ;
2020
1988
}
2021
1989
}
2022
1990
}
0 commit comments