@@ -27,8 +27,8 @@ const STYLE_TRANSFORMS: Record<
27
27
> = {
28
28
postcss : transformWithPostCSS ,
29
29
pcss : transformWithPostCSS ,
30
- scss : ( node , context ) => transformWithSass ( node , context , "scss" ) ,
31
- sass : ( node , context ) => transformWithSass ( node , context , "sass" ) ,
30
+ scss : ( node , text , context ) => transformWithSass ( node , text , context , "scss" ) ,
31
+ sass : ( node , text , context ) => transformWithSass ( node , text , context , "sass" ) ,
32
32
less : transformWithLess ,
33
33
stylus : transformWithStylus ,
34
34
styl : transformWithStylus ,
@@ -94,7 +94,11 @@ function getSvelteCompileWarningsWithoutCache(
94
94
for ( const style of styleElementsWithNotCSS ) {
95
95
const transform = STYLE_TRANSFORMS [ style . lang ]
96
96
if ( transform ) {
97
- const result = transform ( style . node , context )
97
+ const result = transform (
98
+ style . node ,
99
+ context . getSourceCode ( ) . text ,
100
+ context ,
101
+ )
98
102
if ( result ) {
99
103
transformResults . push ( result )
100
104
continue
@@ -110,7 +114,7 @@ function getSvelteCompileWarningsWithoutCache(
110
114
111
115
const text = buildStrippedText ( context , ignoreComments , stripStyleTokens )
112
116
113
- transformResults . push ( ...transformScripts ( context ) )
117
+ transformResults . push ( ...transformScripts ( context , text ) )
114
118
115
119
if ( ! transformResults . length ) {
116
120
const warnings = getWarningsFromCode ( text )
@@ -396,7 +400,7 @@ function buildStrippedText(
396
400
}
397
401
398
402
/** Returns the result of transforming the required script for the transform. */
399
- function * transformScripts ( context : RuleContext ) {
403
+ function * transformScripts ( context : RuleContext , text : string ) {
400
404
const transform = isUseTypeScript ( context )
401
405
? hasTypeScript ( context )
402
406
? transformWithTypescript
@@ -410,7 +414,7 @@ function* transformScripts(context: RuleContext) {
410
414
const root = sourceCode . ast
411
415
for ( const node of root . body ) {
412
416
if ( node . type === "SvelteScriptElement" ) {
413
- const result = transform ( node , context )
417
+ const result = transform ( node , text , context )
414
418
if ( result ) {
415
419
yield result
416
420
}
0 commit comments