@@ -4,16 +4,19 @@ import { drop, map, not, pipe, reduce } from "../src/index";
4
4
5
5
const SOURCE_DIR = "./src" ;
6
6
const OUTPUT_DIR = "./dist" ;
7
+ const TYPES_ROOT_DIR = `${ OUTPUT_DIR } /types` ;
7
8
const CJS_ROOT_DIR = `${ OUTPUT_DIR } /cjs` ;
8
9
const ESM_ROOT_DIR = `${ OUTPUT_DIR } /esm` ;
9
10
const ESM5_ROOT_DIR = `${ OUTPUT_DIR } /esm5` ;
10
11
11
12
const conditionalRootIndex = {
13
+ types : `${ TYPES_ROOT_DIR } /index.d.ts` ,
12
14
import : `${ ESM_ROOT_DIR } /index.js` ,
13
15
require : `${ CJS_ROOT_DIR } /index.js` ,
14
16
} ;
15
17
16
18
const conditionalRootIndexLazy = {
19
+ types : `${ TYPES_ROOT_DIR } /Lazy/index.d.ts` ,
17
20
import : `${ ESM_ROOT_DIR } /Lazy/index.js` ,
18
21
require : `${ CJS_ROOT_DIR } /Lazy/index.js` ,
19
22
} ;
@@ -52,6 +55,7 @@ async function generateExports() {
52
55
fileNames ,
53
56
map ( ( name ) => {
54
57
const conditionalSubPaths = {
58
+ types : `${ TYPES_ROOT_DIR } /${ name } .d.ts` ,
55
59
import : `${ ESM_ROOT_DIR } /${ name } .js` ,
56
60
require : `${ CJS_ROOT_DIR } /${ name } .js` ,
57
61
} ;
@@ -84,8 +88,9 @@ async function generateExports() {
84
88
85
89
( async function main ( ) {
86
90
await Promise . all ( [
87
- // Add package.json file to cjs directory
88
- writeFile ( `${ CJS_ROOT_DIR } /package.json` , '{ "type": "commonjs" }' ) ,
91
+ // Add package.json file to esm/esm5 directory
92
+ writeFile ( `${ ESM_ROOT_DIR } /package.json` , '{ "type": "module" }' ) ,
93
+ writeFile ( `${ ESM5_ROOT_DIR } /package.json` , '{ "type": "module" }' ) ,
89
94
// Generate and add 'exports' field to root package.json
90
95
generateExports ( ) ,
91
96
] ) ;
0 commit comments