fix: transform-sfc not parsing .ts file
This commit is contained in:
parent
b2f2981377
commit
6d36be6440
|
|
@ -6,7 +6,7 @@ const require = createRequire(import.meta.url)
|
||||||
const { transform } = require('detype')
|
const { transform } = require('detype')
|
||||||
|
|
||||||
export async function transformSFC(opts: TransformOpts) {
|
export async function transformSFC(opts: TransformOpts) {
|
||||||
if (opts.config?.typescript || opts.filename.includes('.ts'))
|
if (opts.config?.typescript)
|
||||||
return opts.raw
|
return opts.raw
|
||||||
|
|
||||||
return await transformByDetype(opts.raw, opts.filename).then(res => res as string)
|
return await transformByDetype(opts.raw, opts.filename).then(res => res as string)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ it('transform import', async () => {
|
||||||
components: '@/components',
|
components: '@/components',
|
||||||
utils: '@/lib/utils',
|
utils: '@/lib/utils',
|
||||||
},
|
},
|
||||||
|
typescript: true,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
).toMatchSnapshot()
|
).toMatchSnapshot()
|
||||||
|
|
@ -41,6 +42,7 @@ it('transform import', async () => {
|
||||||
components: '~/src/components',
|
components: '~/src/components',
|
||||||
utils: '~/lib',
|
utils: '~/lib',
|
||||||
},
|
},
|
||||||
|
typescript: true,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
).toMatchSnapshot()
|
).toMatchSnapshot()
|
||||||
|
|
@ -61,6 +63,7 @@ it('transform import', async () => {
|
||||||
components: '~/src/components',
|
components: '~/src/components',
|
||||||
utils: '~/src/utils',
|
utils: '~/src/utils',
|
||||||
},
|
},
|
||||||
|
typescript: true,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
).toMatchSnapshot()
|
).toMatchSnapshot()
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ it('transform tailwind prefix', async () => {
|
||||||
components: '@/components',
|
components: '@/components',
|
||||||
utils: '@/lib/utils',
|
utils: '@/lib/utils',
|
||||||
},
|
},
|
||||||
|
typescript: true,
|
||||||
},
|
},
|
||||||
baseColor: 'stone',
|
baseColor: 'stone',
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user