@@ -27,8 +27,8 @@ const STYLE_TRANSFORMS: Record<
2727> = {
2828 postcss : transformWithPostCSS ,
2929 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" ) ,
3232 less : transformWithLess ,
3333 stylus : transformWithStylus ,
3434 styl : transformWithStylus ,
@@ -94,7 +94,11 @@ function getSvelteCompileWarningsWithoutCache(
9494 for ( const style of styleElementsWithNotCSS ) {
9595 const transform = STYLE_TRANSFORMS [ style . lang ]
9696 if ( transform ) {
97- const result = transform ( style . node , context )
97+ const result = transform (
98+ style . node ,
99+ context . getSourceCode ( ) . text ,
100+ context ,
101+ )
98102 if ( result ) {
99103 transformResults . push ( result )
100104 continue
@@ -110,7 +114,7 @@ function getSvelteCompileWarningsWithoutCache(
110114
111115 const text = buildStrippedText ( context , ignoreComments , stripStyleTokens )
112116
113- transformResults . push ( ...transformScripts ( context ) )
117+ transformResults . push ( ...transformScripts ( context , text ) )
114118
115119 if ( ! transformResults . length ) {
116120 const warnings = getWarningsFromCode ( text )
@@ -396,7 +400,7 @@ function buildStrippedText(
396400}
397401
398402/** Returns the result of transforming the required script for the transform. */
399- function * transformScripts ( context : RuleContext ) {
403+ function * transformScripts ( context : RuleContext , text : string ) {
400404 const transform = isUseTypeScript ( context )
401405 ? hasTypeScript ( context )
402406 ? transformWithTypescript
@@ -410,7 +414,7 @@ function* transformScripts(context: RuleContext) {
410414 const root = sourceCode . ast
411415 for ( const node of root . body ) {
412416 if ( node . type === "SvelteScriptElement" ) {
413- const result = transform ( node , context )
417+ const result = transform ( node , text , context )
414418 if ( result ) {
415419 yield result
416420 }
0 commit comments