File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ interface SizeInfo {
2828 brotliText : string
2929}
3030
31- export function ReportPlugin ( cwd : string ) : Plugin {
31+ export function ReportPlugin ( cwd : string , cjsDts ?: boolean ) : Plugin {
3232 return {
3333 name : 'tsdown:report' ,
3434 async writeBundle ( options , bundle ) {
@@ -75,17 +75,16 @@ export function ReportPlugin(cwd: string): Plugin {
7575 return b . brotli - a . brotli
7676 } )
7777
78+ const format = cjsDts ? 'cjs' : options . format
79+ const formatColor =
80+ format === 'es' ? blue : format === 'cjs' ? yellow : noop
81+ const formatText = formatColor ( `[${ prettyFormat ( format ) } ]` )
82+
7883 for ( const size of sizes ) {
79- const formatColor =
80- options . format === 'es'
81- ? blue
82- : options . format === 'cjs'
83- ? yellow
84- : noop
8584 const filenameColor = size . dts ? green : noop
8685
8786 logger . info (
88- formatColor ( `[ ${ prettyFormat ( options . format ) } ]` ) ,
87+ formatText ,
8988 dim ( `${ outDir } /` ) +
9089 filenameColor ( ( size . isEntry ? bold : noop ) ( size . filename ) ) ,
9190 ` ` . repeat ( filenameLength - size . filename . length ) ,
Original file line number Diff line number Diff line change @@ -206,8 +206,12 @@ async function getBuildOptions(
206206 } ) ,
207207 )
208208 }
209- plugins . push ( ShebangPlugin ( cwd ) , report && ReportPlugin ( cwd ) )
209+ plugins . push ( ShebangPlugin ( cwd ) )
210210 }
211+ if ( report ) {
212+ plugins . push ( ReportPlugin ( cwd , cjsDts ) )
213+ }
214+
211215 plugins . push ( userPlugins )
212216
213217 const inputOptions = await mergeUserOptions (
You can’t perform that action at this time.
0 commit comments