11import commonjs from '@rollup/plugin-commonjs' ;
22import resolve from '@rollup/plugin-node-resolve' ;
33import cleanup from 'rollup-plugin-cleanup' ;
4- // import dts from 'rollup-plugin-dts';
4+ import dts from 'rollup-plugin-dts' ;
55import typescript from '@rollup/plugin-typescript' ;
66import { terser } from 'rollup-plugin-terser' ;
77import replace from '@rollup/plugin-replace' ;
@@ -23,10 +23,10 @@ const banner = `/**
2323 */
2424const watchOnly = [ 'umd' ] ;
2525
26- const isDependency = ( v ) => Object . keys ( pkg . dependencies || { } ) . some ( ( e ) => e === v || v . startsWith ( e + '/' ) ) ;
27- const isPeerDependency = ( v ) => Object . keys ( pkg . peerDependencies || { } ) . some ( ( e ) => e === v || v . startsWith ( e + '/' ) ) ;
26+ const isDependency = ( v ) => Object . keys ( pkg . dependencies || { } ) . some ( ( e ) => e === v || v . startsWith ( ` ${ e } /` ) ) ;
27+ const isPeerDependency = ( v ) => Object . keys ( pkg . peerDependencies || { } ) . some ( ( e ) => e === v || v . startsWith ( ` ${ e } /` ) ) ;
2828
29- export default ( options ) => {
29+ export default function Config ( options ) {
3030 const buildFormat = ( format ) => {
3131 return ! options . watch || watchOnly . includes ( format ) ;
3232 } ;
@@ -102,22 +102,22 @@ export default (options) => {
102102 ] . filter ( Boolean ) ,
103103 external : ( v ) => isPeerDependency ( v ) ,
104104 } ,
105- // buildFormat('types') && {
106- // ...base,
107- // output: {
108- // ...commonOutput,
109- // file: pkg.types,
110- // format: 'es',
111- // },
112- // plugins: [
113- // dts({
114- // respectExternal: true,
115- // compilerOptions: {
116- // skipLibCheck: true,
117- // skipDefaultLibCheck: true,
118- // },
119- // }),
120- // ],
121- // },
105+ buildFormat ( 'types' ) && {
106+ ...base ,
107+ output : {
108+ ...commonOutput ,
109+ file : pkg . types ,
110+ format : 'es' ,
111+ } ,
112+ plugins : [
113+ dts ( {
114+ respectExternal : true ,
115+ compilerOptions : {
116+ skipLibCheck : true ,
117+ skipDefaultLibCheck : true ,
118+ } ,
119+ } ) ,
120+ ] ,
121+ } ,
122122 ] . filter ( Boolean ) ;
123- } ;
123+ }
0 commit comments