File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env bun
2+
3+ const dir = new URL ( ".." , import . meta. url ) . pathname
4+ process . chdir ( dir )
5+
6+ const pkg = await import ( "../package.json" ) . then ( ( m ) => m . default )
7+ const next = JSON . parse ( JSON . stringify ( pkg ) )
8+
9+ const items = Object . entries ( next . exports )
10+ for ( const item of items ) {
11+ const key = item [ 0 ]
12+ const value = item [ 1 ]
13+ const data =
14+ typeof value === "object" && value !== null && "import" in value
15+ ? ( value as { import ?: unknown } ) . import
16+ : undefined
17+ const text = typeof value === "string" ? value : data
18+ if ( typeof text !== "string" ) continue
19+ const file = text . replace ( "./src/" , "./dist/" ) . replace ( ".ts" , "" )
20+ next . exports [ key ] = {
21+ import : file + ".js" ,
22+ types : file + ".d.ts" ,
23+ }
24+ }
25+
26+ await Bun . write ( "package.json" , JSON . stringify ( next , null , 2 ) )
You can’t perform that action at this time.
0 commit comments