11import { externalModules } from '@proc7ts/rollup-helpers' ;
2+ import flatDts from '@proc7ts/rollup-plugin-flat-dts' ;
23import commonjs from '@rollup/plugin-commonjs' ;
34import nodeResolve from '@rollup/plugin-node-resolve' ;
45import path from 'path' ;
@@ -19,40 +20,51 @@ export default {
1920 typescript,
2021 tsconfig : 'tsconfig.main.json' ,
2122 cacheRoot : 'target/.rts2_cache' ,
22- useTsconfigDeclarationDir : true ,
2323 } ) ,
2424 nodeResolve ( ) ,
2525 sourcemaps ( ) ,
2626 ] ,
2727 external : externalModules ( ) ,
2828 manualChunks ( id ) {
29- if ( id . startsWith ( path . join ( __dirname , 'src' , 'testing' ) + path . sep ) ) {
29+ if ( id . startsWith ( path . resolve ( 'src' , 'testing' ) + path . sep ) ) {
3030 return 'hatsy.testing' ;
3131 }
32- if ( id . startsWith ( path . join ( __dirname , 'src' , 'core' ) + path . sep ) ) {
32+ if ( id . startsWith ( path . resolve ( 'src' , 'core' ) + path . sep ) ) {
3333 return 'hatsy.core' ;
3434 }
35- if ( id . startsWith ( path . join ( __dirname , 'src' , 'impl' ) + path . sep ) ) {
35+ if ( id . startsWith ( path . resolve ( 'src' , 'impl' ) + path . sep ) ) {
3636 return 'hatsy.impl' ;
3737 }
3838 return 'hatsy' ;
3939 } ,
4040 output : [
4141 {
42+ dir : 'dist' ,
4243 format : 'cjs' ,
4344 sourcemap : true ,
44- dir : './dist' ,
4545 entryFileNames : '[name].cjs' ,
46- chunkFileNames : `_[name].cjs` ,
47- hoistTransitiveImports : false ,
46+ chunkFileNames : '_[name].cjs' ,
4847 } ,
4948 {
49+ dir : '.' ,
5050 format : 'esm' ,
5151 sourcemap : true ,
52- dir : './dist' ,
53- entryFileNames : '[name].js' ,
54- chunkFileNames : `_[name].js` ,
55- hoistTransitiveImports : false ,
52+ entryFileNames : 'dist/[name].js' ,
53+ chunkFileNames : 'dist/_[name].js' ,
54+ plugins : [
55+ flatDts ( {
56+ tsconfig : 'tsconfig.main.json' ,
57+ lib : true ,
58+ entries : {
59+ core : {
60+ file : 'core/index.d.ts' ,
61+ } ,
62+ testing : {
63+ file : 'testing/index.d.ts' ,
64+ } ,
65+ } ,
66+ } ) ,
67+ ] ,
5668 } ,
5769 ] ,
5870} ;
0 commit comments