@@ -53,43 +53,45 @@ export function resolveAliases(ctx: BuildContext): Record<string, string> {
53
53
return aliases ;
54
54
}
55
55
56
- function inferAliasesFromTsconfig ( ctx : BuildContext ) : Record <
57
- string ,
58
- string
59
- > | undefined {
56
+ function inferAliasesFromTsconfig (
57
+ ctx : BuildContext ,
58
+ ) : Record < string , string > | undefined {
60
59
const tsconfig = getTsconfig ( ctx ) ;
61
60
62
61
if ( ! tsconfig . compilerOptions ?. paths ) {
63
62
return ;
64
63
}
65
64
66
- const tsconfigDir = tsconfig . path
67
- ? dirname ( tsconfig . path )
65
+ const tsconfigDir = tsconfig . path
66
+ ? dirname ( tsconfig . path )
68
67
: ctx . options . rootDir ;
69
-
70
- const resolvedBaseUrl = resolve ( tsconfigDir , tsconfig . compilerOptions ?. baseUrl || "." ) ;
68
+
69
+ const resolvedBaseUrl = resolve (
70
+ tsconfigDir ,
71
+ tsconfig . compilerOptions ?. baseUrl || "." ,
72
+ ) ;
71
73
72
74
const aliases = Object . fromEntries (
73
- Object . entries ( tsconfig . compilerOptions . paths ) . map ( ( [ pattern , substitutions ] ) => {
74
- const find = pattern . replace ( / \/ \* $ / , "" ) ;
75
- // Pick only the first path.
76
- const replacement = substitutions [ 0 ] . replace ( / \* $ / , "" ) ;
77
- const resolvedReplacement = resolve ( resolvedBaseUrl , replacement ) ;
78
- return [ find , resolvedReplacement ] ;
79
- } ) ,
75
+ Object . entries ( tsconfig . compilerOptions . paths ) . map (
76
+ ( [ pattern , substitutions ] ) => {
77
+ const find = pattern . replace ( / \/ \* $ / , "" ) ;
78
+ // Pick only the first path.
79
+ const replacement = substitutions [ 0 ] . replace ( / \* $ / , "" ) ;
80
+ const resolvedReplacement = resolve ( resolvedBaseUrl , replacement ) ;
81
+ return [ find , resolvedReplacement ] ;
82
+ } ,
83
+ ) ,
80
84
) ;
81
85
82
86
return aliases ;
83
87
}
84
88
85
- function getTsconfig ( ctx : BuildContext ) : {
86
- path ?: string ,
87
- compilerOptions ?: CompilerOptions
89
+ function getTsconfig ( ctx : BuildContext ) : {
90
+ path ?: string ;
91
+ compilerOptions ?: CompilerOptions ;
88
92
} {
89
- const {
90
- tsconfig : overridePath ,
91
- compilerOptions : overrideCompilerOptions
92
- } = ctx . options . rollup . dts ;
93
+ const { tsconfig : overridePath , compilerOptions : overrideCompilerOptions } =
94
+ ctx . options . rollup . dts ;
93
95
94
96
const tsconfigPath = overridePath
95
97
? resolve ( ctx . options . rootDir , overridePath )
@@ -99,10 +101,7 @@ function getTsconfig(ctx: BuildContext): {
99
101
return { compilerOptions : overrideCompilerOptions } ;
100
102
}
101
103
102
- const { config : tsconfigRaw } = readConfigFile (
103
- tsconfigPath ,
104
- sys . readFile ,
105
- ) ;
104
+ const { config : tsconfigRaw } = readConfigFile ( tsconfigPath , sys . readFile ) ;
106
105
const { options : compilerOptions } = parseJsonConfigFileContent (
107
106
tsconfigRaw ,
108
107
sys ,
@@ -112,7 +111,7 @@ function getTsconfig(ctx: BuildContext): {
112
111
return {
113
112
path : tsconfigPath ,
114
113
compilerOptions : { ...compilerOptions , ...overrideCompilerOptions } ,
115
- }
114
+ } ;
116
115
}
117
116
118
117
export function getChunkFilename (
0 commit comments