@@ -28,28 +28,34 @@ export async function compile(
28
28
const dirToFiles = await recursiveReaddirFiles ( path . dirname ( entry ) , {
29
29
exclude : / ( t s c o n f i g .j s o n | .d .t s | .( t e s t | s p e c ) .( t s | t s x | j s | j s x ) ) $ / ,
30
30
} ) ;
31
- if ( ! disableBabel ) {
32
- await Promise . all (
33
- dirToFiles . map ( async ( item ) => {
34
- if ( cjs ) {
35
- const cjsPath = item . path . replace ( entryDir , cjs ) ;
36
- if ( isMatch ( item . path , [ '**/*.[jt]s?(x)' ] ) && ! isMatch ( item . path , [ '**/?(*.)+(spec|test).[jt]s?(x)' ] ) ) {
37
- transform ( item . path , { entryDir, cjs, ...other } ) ;
38
- } else {
39
- copyFiles ( item . path , cjsPath ) ;
40
- }
31
+ await Promise . all (
32
+ dirToFiles . map ( async ( item ) => {
33
+ if ( cjs ) {
34
+ const cjsPath = item . path . replace ( entryDir , cjs ) ;
35
+ if (
36
+ ! disableBabel &&
37
+ isMatch ( item . path , [ '**/*.[jt]s?(x)' ] ) &&
38
+ ! isMatch ( item . path , [ '**/?(*.)+(spec|test).[jt]s?(x)' ] )
39
+ ) {
40
+ transform ( item . path , { entryDir, cjs, ...other } ) ;
41
+ } else {
42
+ copyFiles ( item . path , cjsPath ) ;
41
43
}
42
- if ( esm ) {
43
- const esmPath = item . path . replace ( entryDir , esm ) ;
44
- if ( isMatch ( item . path , [ '**/*.[jt]s?(x)' ] ) && ! isMatch ( item . path , [ '**/?(*.)+(spec|test).[jt]s?(x)' ] ) ) {
45
- transform ( item . path , { entryDir, esm, ...other } ) ;
46
- } else {
47
- copyFiles ( item . path , esmPath ) ;
48
- }
44
+ }
45
+ if ( esm ) {
46
+ const esmPath = item . path . replace ( entryDir , esm ) ;
47
+ if (
48
+ ! disableBabel &&
49
+ isMatch ( item . path , [ '**/*.[jt]s?(x)' ] ) &&
50
+ ! isMatch ( item . path , [ '**/?(*.)+(spec|test).[jt]s?(x)' ] )
51
+ ) {
52
+ transform ( item . path , { entryDir, esm, ...other } ) ;
53
+ } else {
54
+ copyFiles ( item . path , esmPath ) ;
49
55
}
50
- } ) ,
51
- ) ;
52
- }
56
+ }
57
+ } ) ,
58
+ ) ;
53
59
54
60
// Create a Program with an in-memory emit
55
61
const createdFiles : Record < string , string > = { } ;
0 commit comments