@@ -585,7 +585,7 @@ export async function generateRollupConfiguration(
585585 )
586586 . to . have . ownProperty ( "browser" )
587587 . that . is . a ( "string" )
588- . and . equals ( `peer/umd/${ libraryFilename } .min.js ` ) ;
588+ . and . equals ( `peer/umd/${ libraryFilename } .min.cjs ` ) ;
589589 } ) ;
590590 validate ( ( expect ) : void => {
591591 expect (
@@ -594,7 +594,7 @@ export async function generateRollupConfiguration(
594594 )
595595 . to . have . ownProperty ( "main" )
596596 . that . is . a ( "string" )
597- . and . equals ( `peer/umd/${ libraryFilename } .js ` ) ;
597+ . and . equals ( `peer/umd/${ libraryFilename } .cjs ` ) ;
598598 } ) ;
599599 validate ( ( expect ) : void => {
600600 expect (
@@ -603,7 +603,7 @@ export async function generateRollupConfiguration(
603603 )
604604 . to . have . ownProperty ( "module" )
605605 . that . is . a ( "string" )
606- . and . equals ( `peer/esm/${ libraryFilename } .js ` ) ;
606+ . and . equals ( `peer/esm/${ libraryFilename } .mjs ` ) ;
607607 } ) ;
608608 validate ( ( expect ) : void => {
609609 expect (
@@ -612,7 +612,46 @@ export async function generateRollupConfiguration(
612612 )
613613 . to . have . ownProperty ( "jsnext" )
614614 . that . is . a ( "string" )
615- . and . equals ( `esnext/esm/${ libraryFilename } .js` ) ;
615+ . and . equals ( `esnext/esm/${ libraryFilename } .mjs` ) ;
616+ } ) ;
617+
618+ validate ( ( expect ) : void => {
619+ expect ( packageJSONRest , "Package JSON's exports have to contain ./" )
620+ . to . have . ownProperty ( "exports" )
621+ . that . is . an ( "object" )
622+ . and . has . ownProperty ( "." )
623+ . that . is . an ( "object" )
624+ . and . has . keys ( [ "import" , "require" , "types" ] ) ;
625+ } ) ;
626+
627+ validate ( ( expect ) : void => {
628+ expect (
629+ packageJSONRest ,
630+ "Package JSON's exports have to contain ./standalone" ,
631+ )
632+ . to . have . ownProperty ( "exports" )
633+ . that . is . an ( "object" )
634+ . and . has . ownProperty ( "./standalone" )
635+ . that . is . an ( "object" )
636+ . and . has . keys ( [ "import" , "require" , "types" ] ) ;
637+ } ) ;
638+
639+ validate ( ( expect ) : void => {
640+ expect ( packageJSONRest , "Package JSON's exports have to contain ./peer" )
641+ . to . have . ownProperty ( "exports" )
642+ . that . is . an ( "object" )
643+ . and . has . ownProperty ( "./peer" )
644+ . that . is . an ( "object" )
645+ . and . has . keys ( [ "import" , "require" , "types" ] ) ;
646+ } ) ;
647+
648+ validate ( ( expect ) : void => {
649+ expect ( packageJSONRest , "Package JSON's exports have to contain ./esnext" )
650+ . to . have . ownProperty ( "exports" )
651+ . that . is . an ( "object" )
652+ . and . has . ownProperty ( "./esnext" )
653+ . that . is . an ( "object" )
654+ . and . has . keys ( [ "import" , "require" , "types" ] ) ;
616655 } ) ;
617656
618657 validate ( async ( expect ) : Promise < void > => {
@@ -689,10 +728,18 @@ export async function generateRollupConfiguration(
689728 ...commonOutputESM ,
690729 entryFileNames : `standalone/esm/${ libraryFilename } .js` ,
691730 } ,
731+ {
732+ ...commonOutputESM ,
733+ entryFileNames : `standalone/esm/${ libraryFilename } .mjs` ,
734+ } ,
692735 {
693736 ...commonOutputUMD ,
694737 entryFileNames : `standalone/umd/${ libraryFilename } .js` ,
695738 } ,
739+ {
740+ ...commonOutputUMD ,
741+ entryFileNames : `standalone/umd/${ libraryFilename } .cjs` ,
742+ } ,
696743 ] ,
697744 plugins : getPlugins ( "standalone" , {
698745 injectCSS,
@@ -708,10 +755,18 @@ export async function generateRollupConfiguration(
708755 ...commonOutputESM ,
709756 entryFileNames : `standalone/esm/${ libraryFilename } .min.js` ,
710757 } ,
758+ {
759+ ...commonOutputESM ,
760+ entryFileNames : `standalone/esm/${ libraryFilename } .min.mjs` ,
761+ } ,
711762 {
712763 ...commonOutputUMD ,
713764 entryFileNames : `standalone/umd/${ libraryFilename } .min.js` ,
714765 } ,
766+ {
767+ ...commonOutputUMD ,
768+ entryFileNames : `standalone/umd/${ libraryFilename } .min.cjs` ,
769+ } ,
715770 ] ,
716771 plugins : getPlugins ( "standalone" , {
717772 injectCSS,
@@ -730,11 +785,21 @@ export async function generateRollupConfiguration(
730785 entryFileNames : `peer/esm/${ libraryFilename } .js` ,
731786 paths : getPaths ( "peer" , "esm" ) ,
732787 } ,
788+ {
789+ ...commonOutputESM ,
790+ entryFileNames : `peer/esm/${ libraryFilename } .mjs` ,
791+ paths : getPaths ( "peer" , "esm" ) ,
792+ } ,
733793 {
734794 ...commonOutputUMD ,
735795 entryFileNames : `peer/umd/${ libraryFilename } .js` ,
736796 paths : getPaths ( "peer" , "umd" ) ,
737797 } ,
798+ {
799+ ...commonOutputUMD ,
800+ entryFileNames : `peer/umd/${ libraryFilename } .cjs` ,
801+ paths : getPaths ( "peer" , "umd" ) ,
802+ } ,
738803 ] ,
739804 plugins : getPlugins ( "peer" , {
740805 transpile,
@@ -750,11 +815,21 @@ export async function generateRollupConfiguration(
750815 entryFileNames : `peer/esm/${ libraryFilename } .min.js` ,
751816 paths : getPaths ( "peer" , "esm" ) ,
752817 } ,
818+ {
819+ ...commonOutputESM ,
820+ entryFileNames : `peer/esm/${ libraryFilename } .min.mjs` ,
821+ paths : getPaths ( "peer" , "esm" ) ,
822+ } ,
753823 {
754824 ...commonOutputUMD ,
755825 entryFileNames : `peer/umd/${ libraryFilename } .min.js` ,
756826 paths : getPaths ( "peer" , "umd" ) ,
757827 } ,
828+ {
829+ ...commonOutputUMD ,
830+ entryFileNames : `peer/umd/${ libraryFilename } .min.cjs` ,
831+ paths : getPaths ( "peer" , "umd" ) ,
832+ } ,
758833 ] ,
759834 plugins : getPlugins ( "peer" , {
760835 minimize,
@@ -773,10 +848,20 @@ export async function generateRollupConfiguration(
773848 paths : getPaths ( "esnext" , "esm" ) ,
774849 } ,
775850 {
776- ...commonOutputUMD ,
851+ ...commonOutputESM ,
852+ entryFileNames : `esnext/esm/${ libraryFilename } .mjs` ,
853+ paths : getPaths ( "esnext" , "esm" ) ,
854+ } ,
855+ {
856+ ...commonOutputESM ,
777857 entryFileNames : `esnext/umd/${ libraryFilename } .js` ,
778858 paths : getPaths ( "esnext" , "umd" ) ,
779859 } ,
860+ {
861+ ...commonOutputESM ,
862+ entryFileNames : `esnext/umd/${ libraryFilename } .cjs` ,
863+ paths : getPaths ( "esnext" , "umd" ) ,
864+ } ,
780865 ] ,
781866 plugins : getPlugins ( "esnext" , {
782867 typescript : isTS ( esnextEntry ) ,
@@ -791,11 +876,21 @@ export async function generateRollupConfiguration(
791876 entryFileNames : `esnext/esm/${ libraryFilename } .min.js` ,
792877 paths : getPaths ( "esnext" , "esm" ) ,
793878 } ,
879+ {
880+ ...commonOutputESM ,
881+ entryFileNames : `esnext/esm/${ libraryFilename } .min.mjs` ,
882+ paths : getPaths ( "esnext" , "esm" ) ,
883+ } ,
794884 {
795885 ...commonOutputUMD ,
796886 entryFileNames : `esnext/umd/${ libraryFilename } .min.js` ,
797887 paths : getPaths ( "esnext" , "umd" ) ,
798888 } ,
889+ {
890+ ...commonOutputUMD ,
891+ entryFileNames : `esnext/umd/${ libraryFilename } .min.cjs` ,
892+ paths : getPaths ( "esnext" , "umd" ) ,
893+ } ,
799894 ] ,
800895 plugins : getPlugins ( "esnext" , {
801896 minimize,
0 commit comments