18
18
"test:e2e:nodejs20x" : " RUNTIME=nodejs20x jest --group=e2e" ,
19
19
"test:e2e" : " jest --group=e2e" ,
20
20
"watch" : " jest --watch --group=unit" ,
21
- "build" : " tsc --build --force" ,
21
+ "build:cjs" : " tsc --build --force && echo '{ \" type\" : \" commonjs\" }' > lib/cjs/package.json" ,
22
+ "build:esm" : " tsc --project tsconfig.esm.json && echo '{ \" type\" : \" module\" }' > lib/esm/package.json" ,
23
+ "build" : " npm run build:esm & npm run build:cjs" ,
22
24
"lint" : " eslint --ext .ts,.js --no-error-on-unmatched-pattern ." ,
23
25
"lint-fix" : " eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern ." ,
24
26
"prebuild" : " rimraf ./lib" ,
27
+ "postbuild" : " rimraf ./lib/*.tsbuildinfo" ,
25
28
"prepack" : " node ../../.github/scripts/release_patch_package_json.js ."
26
29
},
27
30
"lint-staged" : {
28
31
"*.{js,ts}" : " npm run lint-fix"
29
32
},
30
33
"homepage" : " https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/packages/logger#readme" ,
31
34
"license" : " MIT-0" ,
32
- "main" : " ./lib/index.js" ,
33
- "types" : " ./lib/index.d.ts" ,
35
+ "type" : " module" ,
36
+ "exports" : {
37
+ "." : {
38
+ "require" : {
39
+ "types" : " ./lib/cjs/index.d.ts" ,
40
+ "default" : " ./lib/cjs/index.js"
41
+ },
42
+ "import" : {
43
+ "types" : " ./lib/esm/index.d.ts" ,
44
+ "default" : " ./lib/esm/index.js"
45
+ }
46
+ },
47
+ "./middleware" : {
48
+ "import" : " ./lib/esm/middleware/middy.js" ,
49
+ "require" : " ./lib/cjs/middleware/middy.js"
50
+ },
51
+ "./types" : {
52
+ "import" : " ./lib/esm/types/index.js" ,
53
+ "require" : " ./lib/cjs/types/index.js"
54
+ }
55
+ },
56
+ "typesVersions" : {
57
+ "*" : {
58
+ "middleware" : [
59
+ " lib/cjs/middleware/middy.d.ts" ,
60
+ " lib/esm/middleware/middy.d.ts"
61
+ ],
62
+ "types" : [
63
+ " lib/cjs/types/index.d.ts" ,
64
+ " lib/esm/types/index.d.ts"
65
+ ]
66
+ }
67
+ },
68
+ "types" : " ./lib/cjs/index.d.ts" ,
69
+ "main" : " ./lib/cjs/index.js" ,
34
70
"devDependencies" : {
35
71
"@aws-lambda-powertools/testing-utils" : " file:../testing" ,
36
72
"@types/lodash.merge" : " ^4.6.9"
66
102
" serverless" ,
67
103
" nodejs"
68
104
]
69
- }
105
+ }
0 commit comments