11import { defineConfig } from "tsdown" ;
22
33export default defineConfig ( {
4- entry : [ "src/index.ts" , "src/api/*/*.ts" , "src/api/*/*.zod.ts" ] ,
4+ entry : [
5+ "src/index.ts" ,
6+ "src/api/*/*.ts" ,
7+ "src/api/*/*.fetch.ts" ,
8+ "src/api/*/*.zod.ts" ,
9+ "!src/api/api-schemas/**" ,
10+ ] ,
511 dts : true ,
612 format : [ "cjs" , "esm" ] ,
713 target : "es2022" ,
@@ -23,7 +29,7 @@ export default defineConfig({
2329 if ( chunks ) {
2430 for ( const chunk of chunks ) {
2531 if ( chunk . type === "chunk" && chunk . fileName ) {
26- // Match pattern: api/{moduleName}/{moduleName}.js (or .cjs) and api/{moduleName}/{moduleName}.zod.js
32+ // Match pattern: api/{moduleName}/{moduleName}.js (or .cjs) for axios client
2733 const match = chunk . fileName . match ( / ^ a p i \/ ( [ ^ / ] + ) \/ \1\. ( j s | c j s ) $ / ) ;
2834 if ( match && match [ 1 ] ) {
2935 modules . add ( match [ 1 ] ) ;
@@ -33,9 +39,9 @@ export default defineConfig({
3339 }
3440 }
3541
36- // For each module, create simplified export paths for both regular and zod files
42+ // For each module, create simplified export paths for axios, fetch, and zod files
3743 for ( const moduleName of modules ) {
38- // Regular exports
44+ // Axios client (default)
3945 pkg [ `./${ moduleName } ` ] = {
4046 import : {
4147 types : `./dist/api/${ moduleName } /${ moduleName } .d.ts` ,
@@ -47,7 +53,19 @@ export default defineConfig({
4753 } ,
4854 } ;
4955
50- // Zod exports
56+ // Fetch client
57+ pkg [ `./${ moduleName } /fetch` ] = {
58+ import : {
59+ types : `./dist/api/${ moduleName } /${ moduleName } .fetch.d.ts` ,
60+ default : `./dist/api/${ moduleName } /${ moduleName } .fetch.js` ,
61+ } ,
62+ require : {
63+ types : `./dist/api/${ moduleName } /${ moduleName } .fetch.d.cts` ,
64+ default : `./dist/api/${ moduleName } /${ moduleName } .fetch.cjs` ,
65+ } ,
66+ } ;
67+
68+ // Zod schemas
5169 pkg [ `./${ moduleName } /zod` ] = {
5270 import : {
5371 types : `./dist/api/${ moduleName } /${ moduleName } .zod.d.ts` ,
0 commit comments