1- import { type ImportSpecifier , init , parse } from 'es-module-lexer'
1+ import { init , parse , type ImportSpecifier } from 'es-module-lexer'
22import MagicString from 'magic-string'
3- import { type Options } from '../index'
3+ import type { Options } from '../index'
44
55type FormatType = 'cjs' | 'esm'
66
@@ -13,7 +13,7 @@ const formatMap = {
1313 esm : 'es' ,
1414}
1515
16- const multilineCommentsRE = / \/ \* \s ( .| [ \n \r ] ) * ?\* \/ / gm
16+ const multilineCommentsRE = / \/ \* \s ( .| [ \n \r ] ) * ?\* \/ / g
1717const singlelineCommentsRE = / \/ \/ \s .* / g
1818
1919function stripeComments ( code : string ) {
@@ -31,12 +31,12 @@ export function transformImportStyle(
3131 lib : string
3232 format : FormatType
3333 ignoreComponents : string [ ]
34- }
34+ } ,
3535) : string | undefined {
3636 const { prefix, lib, format, ignoreComponents } = options
3737 const statement = stripeComments ( source . slice ( specifier . ss , specifier . se ) )
3838 const leftBracket = statement . indexOf ( '{' )
39- if ( leftBracket > - 1 ) {
39+ if ( leftBracket !== - 1 ) {
4040 // remove { } to get raw imported items. Maybe this will fail since there could be
4141 // special cases
4242 const identifiers = statement . slice ( leftBracket + 1 , statement . indexOf ( '}' ) )
@@ -50,14 +50,14 @@ export function transformImportStyle(
5050 if ( useSource ) {
5151 styleImports . push (
5252 `import '${ lib } /${ formatMap [ format ] } /components/${ hyphenate (
53- component
54- ) } /style/index'`
53+ component ,
54+ ) } /style/index'`,
5555 )
5656 } else {
5757 styleImports . push (
5858 `import '${ lib } /${ formatMap [ format ] } /components/${ hyphenate (
59- component
60- ) } /style/css'`
59+ component ,
60+ ) } /style/css'`,
6161 )
6262 }
6363 }
@@ -68,7 +68,7 @@ export function transformImportStyle(
6868
6969export async function transformStyle (
7070 source : string ,
71- options : Options
71+ options : Options ,
7272) : Promise <
7373 | {
7474 code : string
0 commit comments