File tree Expand file tree Collapse file tree 3 files changed +4
-19
lines changed
packages/language-core/lib/codegen Expand file tree Collapse file tree 3 files changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import { generateStyleModules } from '../style/modules';
5
5
import { generateStyleScopedClasses } from '../style/scopedClasses' ;
6
6
import { type TemplateCodegenContext , createTemplateCodegenContext } from '../template/context' ;
7
7
import { generateInterpolation } from '../template/interpolation' ;
8
- import { generateStyleScopedClassReferences } from '../template/styleScopedClasses' ;
9
8
import { endOfLine , newLine } from '../utils' ;
10
9
import type { ScriptCodegenContext } from './context' ;
11
10
import type { ScriptCodegenOptions } from './index' ;
@@ -115,8 +114,7 @@ function* generateTemplateBody(
115
114
options : ScriptCodegenOptions ,
116
115
templateCodegenCtx : TemplateCodegenContext
117
116
) : Generator < Code > {
118
- yield * generateStyleScopedClasses ( options , templateCodegenCtx ) ;
119
- yield * generateStyleScopedClassReferences ( templateCodegenCtx , true ) ;
117
+ yield * generateStyleScopedClasses ( options ) ;
120
118
yield * generateStyleModules ( options ) ;
121
119
yield * generateCssVars ( options , templateCodegenCtx ) ;
122
120
Original file line number Diff line number Diff line change 1
1
import type { Code } from '../../types' ;
2
2
import type { ScriptCodegenOptions } from '../script' ;
3
- import type { TemplateCodegenContext } from '../template/context' ;
4
3
import { endOfLine } from '../utils' ;
5
4
import { generateClassProperty } from './classProperty' ;
6
5
7
6
export function * generateStyleScopedClasses (
8
- options : ScriptCodegenOptions ,
9
- ctx : TemplateCodegenContext
7
+ options : ScriptCodegenOptions
10
8
) : Generator < Code > {
11
9
const option = options . vueCompilerOptions . experimentalResolveStyleCssClasses ;
12
10
const styles = options . sfc . styles
@@ -16,19 +14,9 @@ export function* generateStyleScopedClasses(
16
14
return ;
17
15
}
18
16
19
- const firstClasses = new Set < string > ( ) ;
20
17
yield `type __VLS_StyleScopedClasses = {}` ;
21
18
for ( const [ style , i ] of styles ) {
22
19
for ( const className of style . classNames ) {
23
- if ( firstClasses . has ( className . text ) ) {
24
- ctx . scopedClasses . push ( {
25
- source : 'style_' + i ,
26
- className : className . text . slice ( 1 ) ,
27
- offset : className . offset + 1
28
- } ) ;
29
- continue ;
30
- }
31
- firstClasses . add ( className . text ) ;
32
20
yield * generateClassProperty (
33
21
i ,
34
22
className . text ,
Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ import type { TemplateCodegenOptions } from './index';
11
11
const classNameEscapeRegex = / ( [ \\ ' ] ) / ;
12
12
13
13
export function * generateStyleScopedClassReferences (
14
- ctx : TemplateCodegenContext ,
15
- withDot = false
14
+ ctx : TemplateCodegenContext
16
15
) : Generator < Code > {
17
16
for ( const offset of ctx . emptyClassOffsets ) {
18
17
yield `/** @type {__VLS_StyleScopedClasses['` ;
@@ -27,7 +26,7 @@ export function* generateStyleScopedClassReferences(
27
26
for ( const { source, className, offset } of ctx . scopedClasses ) {
28
27
yield `/** @type {__VLS_StyleScopedClasses[` ;
29
28
yield * wrapWith (
30
- offset - ( withDot ? 1 : 0 ) ,
29
+ offset ,
31
30
offset + className . length ,
32
31
source ,
33
32
ctx . codeFeatures . navigation ,
You can’t perform that action at this time.
0 commit comments