@@ -14,7 +14,7 @@ interface Options {
1414 debug ?: boolean
1515}
1616
17- export async function transfromCode ( code : string , options : Options ) {
17+ export async function transformCode ( code : string , options : Options ) {
1818 const {
1919 filepath,
2020 isRem,
@@ -25,25 +25,28 @@ export async function transfromCode(code: string, options: Options) {
2525 } = options || { }
2626
2727 if ( debug ) {
28- console . log ( '[DEBUG] transfromCode started:' , {
29- filepath,
30- type,
31- isJsx,
32- isRem,
33- codeLength : code . length ,
34- } )
28+ console . log (
29+ '[DEBUG] transformCode started:' ,
30+ JSON . stringify ( {
31+ filepath,
32+ type,
33+ isJsx,
34+ isRem,
35+ codeLength : code . length ,
36+ } ) ,
37+ )
3538 }
3639
3740 // 删除代码中的注释部分
3841 // code = code.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '')
3942 if ( type === 'tsx' )
40- return transformJsx ( code , filepath , isRem , globalCss )
43+ return transformJsx ( code , { filepath, isRem, globalCss, debug } )
4144 if ( type === 'html' )
42- return transformHtml ( code , filepath , isRem )
45+ return transformHtml ( code , { filepath, globalCss , debug } )
4346 if ( type === 'svelte' )
44- return transformSvelte ( code , isRem , globalCss )
47+ return transformSvelte ( code , { filepath , isRem, globalCss, debug } )
4548 if ( type === 'astro' )
46- return transformAstro ( code , isRem , globalCss )
49+ return transformAstro ( code , { filepath , isRem, globalCss, debug } )
4750
4851 return transformVue ( code , { isJsx, filepath, isRem, globalCss, debug } )
4952}
0 commit comments